/**
 * styles.css — Cava Component Styles
 * All component and layout styles. References tokens.css.
 */

/* ─────────────────────────────────────────────────────────────
   Reset & base
───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────
   Typography helpers
───────────────────────────────────────────────────────────── */

/* Display heading — STIX Two Text, mixed regular + italic spans inside */
.heading-display {
  font-family: var(--font-display);
  font-size: var(--text-h1);
  font-weight: var(--weight-regular);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--black);
  text-align: center;
}
.heading-display em {
  font-style: italic;
}

/* Platform page heading (H2 size, no italic mix) */
.heading-page {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: var(--weight-regular);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--black);
}

/* Welcome heading on Home — same as H2, mixed italic */
.heading-welcome {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: var(--weight-regular);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--black);
  text-align: center;
}
.heading-welcome em { font-style: italic; }

.body-light {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  line-height: var(--leading-base);
  color: var(--black);
}

/* ─────────────────────────────────────────────────────────────
   Buttons
───────────────────────────────────────────────────────────── */

/* Large black button — primary action on auth pages */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-base);
  padding: 12px var(--space-10);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: background var(--ease);
  white-space: nowrap;
  backdrop-filter: blur(6px);
}
.btn-primary:hover:not(:disabled) { background: var(--very-dark-grey); }
.btn-primary:active:not(:disabled) { background: var(--dark-grey); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* Border button — secondary action, nav button */
.btn-border {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--white);
  color: var(--black);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-sm);
  padding: 8px 20px 8px 16px;
  height: 40px;
  border: 1px solid var(--very-light-grey);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
  white-space: nowrap;
  text-decoration: none;
  backdrop-filter: blur(6px);
}
.btn-border:hover:not(:disabled) { border-color: var(--grey); }
.btn-border:active:not(:disabled) { background: var(--very-very-light-grey); border-color: var(--grey); }

/* Border button without icon — log out, "Return to login" */
.btn-border-plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  color: var(--black);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-sm);
  padding: 8px 20px;
  height: 40px;
  border: 1px solid var(--very-light-grey);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--ease);
  white-space: nowrap;
  width: 100%;
  backdrop-filter: blur(6px);
}
.btn-border-plain:hover { border-color: var(--grey); }

/* Inline text link */
.text-link {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

/* ─────────────────────────────────────────────────────────────
   Form inputs
───────────────────────────────────────────────────────────── */

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

/* Floating label above input (10px Geist Regular #aaa) */
.form-label {
  display: block;
  padding-left: 8px;
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-regular);
  line-height: var(--leading-xxs);
  color: var(--grey);
  transition: color var(--ease);
}

.form-input {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--grey);
  border-radius: var(--radius-lg);
  padding: 16px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  line-height: var(--leading-base);
  color: var(--black);
  outline: none;
  transition: border-color var(--ease);
  -webkit-appearance: none;
}
.form-input::placeholder { color: var(--grey); font-weight: var(--weight-light); }
.form-input:hover:not(:focus):not(.is-error) { border-color: var(--very-dark-grey); }
.form-input:focus, .form-input:focus + .form-label { border-color: var(--black); }
.form-input:focus ~ .form-label,
.form-field:focus-within .form-label { color: var(--black); }
.form-input.is-error { border-color: var(--error); }

.form-error {
  padding-left: 8px;
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-regular);
  line-height: var(--leading-xxs);
  color: var(--error);
}

/* ─────────────────────────────────────────────────────────────
   Auth layout
───────────────────────────────────────────────────────────── */

.auth-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--white);
}

/* Top nav — no border */
.auth-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px var(--content-pad-h);
  height: var(--nav-height-auth);
  flex-shrink: 0;
}

.auth-nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

/* Two-column body */
.auth-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.auth-form-panel {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-15) var(--space-10);
}

.auth-form-inner {
  width: 100%;
  max-width: var(--form-max-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Form elements container */
.auth-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-6);
  width: 100%;
}

.auth-form .form-field { text-align: left; }

.auth-subtext {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  line-height: var(--leading-base);
  color: var(--black);
  text-align: center;
  margin-top: var(--space-4);
}

.auth-footer {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  line-height: var(--leading-base);
  color: var(--black);
  text-align: center;
  margin-top: var(--space-6);
}

/* Right panel — dark gradient image placeholder */
.auth-right-panel {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 0 80px;
}

.auth-placeholder-image {
  width: var(--auth-image-size);
  height: var(--auth-image-size);
  border-radius: var(--radius-lg);
  background: #fafafa;
  flex-shrink: 0;
  overflow: hidden;
}

/* Info box (mail sent confirmation) */
.auth-info-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.auth-info-box-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  line-height: var(--leading-base);
  color: var(--black);
  flex: 1;
  min-width: 0;
  text-align: left;
}

.auth-info-box-text strong {
  font-weight: var(--weight-medium);
}

@media (min-width: 1024px) {
  .auth-form-panel { width: var(--auth-split); }
  .auth-right-panel { display: flex; }
}

/* ─────────────────────────────────────────────────────────────
   Platform layout
───────────────────────────────────────────────────────────── */

.platform-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--white);
}

/* Top nav — no border */
.platform-header {
  height: var(--nav-height-platform);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 24px var(--content-pad-h);
  flex-shrink: 0;
}

.platform-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.platform-main {
  flex: 1;
  overflow: auto;
  min-width: 0;
}

/* Desktop sidebar */
.sidebar-desktop {
  display: none;
  flex-direction: column;
  width: var(--sidebar-width);
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .sidebar-desktop { display: flex; }
}

/* Sidebar inner layout */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 60px var(--content-pad-h) var(--content-pad-h);
  justify-content: space-between;
}

.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: var(--sidebar-nav-width);
}

/* Nav items */
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--sidebar-nav-width);
  height: 40px;
  padding: 8px 10px 8px 14px;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-sm);
  color: var(--very-dark-grey);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--ease), color var(--ease);
  gap: 10px;
  overflow: hidden;
}
.nav-item:hover {
  background: linear-gradient(90deg, rgba(0,0,0,.02), rgba(0,0,0,.02)), var(--very-very-light-grey);
}
.nav-item.is-active {
  background: var(--very-very-light-grey);
  color: var(--black);
  font-weight: var(--weight-medium);
}

/* Nav item counter chip */
.nav-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: var(--very-light-grey);
  font-family: var(--font-body);
  font-size: var(--text-chip);
  font-weight: var(--weight-medium);
  line-height: var(--leading-chip);
  color: var(--dark-grey);
  flex-shrink: 0;
}
.nav-item.is-active .nav-chip {
  background: var(--very-light-grey);
}

/* Sidebar account section */
.sidebar-account {
  width: var(--sidebar-nav-width);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-client-info {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 8px 4px;
  border-radius: 10px;
  overflow: hidden;
}

.sidebar-client-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: #c31414;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  color: var(--white);
  overflow: hidden;
}

.sidebar-client-name {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-sm);
  color: var(--very-dark-grey);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-client-company {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-sm);
  color: var(--grey);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile hamburger */
.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  margin-left: calc(-1 * var(--space-2));
  background: none;
  border: none;
  cursor: pointer;
  color: var(--very-dark-grey);
}
@media (min-width: 1024px) { .mobile-menu-btn { display: none; } }

/* Mobile drawer overlay */
.nav-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.2);
  z-index: 40;
}
.nav-overlay-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 280px;
  background: var(--white);
  z-index: 50;
  box-shadow: 4px 0 24px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────────────────────────
   Platform pages
───────────────────────────────────────────────────────────── */

/* Dark placeholder card (Home + Campaigns content area) */
.placeholder-card {
  flex: 1;
  width: 100%;
  min-height: 400px;
  background: #fafafa;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

/* Campaigns tab bar */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  backdrop-filter: blur(12px);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-sm);
  color: var(--neutral-500);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), font-weight var(--ease);
}
.tab.is-active {
  background: var(--very-very-light-grey);
  color: var(--black);
  font-weight: var(--weight-medium);
}

/* Sort dropdown button */
.btn-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 8px 16px 8px 20px;
  background: var(--white);
  border: 1px solid var(--very-light-grey);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-sm);
  color: var(--black);
  cursor: pointer;
  transition: border-color var(--ease);
  white-space: nowrap;
  backdrop-filter: blur(6px);
}
.btn-sort:hover { border-color: var(--grey); }

/* Layout toggle (list/grid) */
.layout-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.layout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--grey);
  transition: color var(--ease), background var(--ease);
}
.layout-btn:hover { color: var(--black); background: var(--very-very-light-grey); }
.layout-btn.is-active { color: var(--black); }

/* ─────────────────────────────────────────────────────────────
   Spinner / loading
───────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
.spinner-lg { width: 24px; height: 24px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────────────────────
   Account page (not in Figma — styled to match system)
───────────────────────────────────────────────────────────── */

.account-card {
  border: 1px solid var(--very-light-grey);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-display-field {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  line-height: var(--leading-base);
  color: var(--black);
  padding: 16px;
  background: var(--very-very-light-grey);
  border: 1px solid var(--very-light-grey);
  border-radius: var(--radius-lg);
  margin-top: 4px;
}

.section-label {
  font-family: var(--font-body);
  font-size: var(--text-xxs);
  font-weight: var(--weight-medium);
  color: var(--grey);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}
