/* =========================================================
   Functional/Layout Styles (uses variables from colors.css)
   ========================================================= */

* { box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text-color);
  background:
    var(--bg-body-deco1),
    var(--bg-body-deco2),
    var(--bg-body);
  /* Center simple pages (e.g., auth) without using CSS Grid */
  display: flex;
  align-items: center;
  justify-content: center;
  min-height:100vh;
  flex-direction: column; /* keeps stacked content natural */
}

a{ color: var(--link-color); text-decoration: none; }
a:hover{ text-decoration: underline; }

/* Signed-in banner */
.topbar{
  position:fixed;
  top:10px;
  left:50%;
  transform:translateX(-50%);
  background: var(--topbar-bg);
  border: 1px solid var(--topbar-br);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: var(--shadow-1);
}

/* Card */
.card{
  background: var(--card-bg);
  border: 1px solid var(--card-br);
  border-radius:16px;
  width:min(92vw, 420px);
  padding:24px 20px;
  box-shadow: var(--shadow-2);
}
@media (min-width: 480px){
  .card{ width: 440px; }
}

h1{ font-size:20px; margin:0 0 16px; }

/* Forms */
label{
  display:block;
  font-size:14px;
  margin:10px 0 6px;
  color: var(--ink-400);
}

input[type="email"],
input[type="password"],
input[type="text"]{
  width:100%;
  padding:12px;
  border-radius:10px;
  border:1px solid var(--input-br);
  background: var(--input-bg);
  color: var(--text-color);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder{ color: var(--ink-500); }
input:focus{
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(29,197,239,0.25);
  background: var(--input-bg-focus);
}

/* Inline row */
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:10px 0 0;
  gap:10px;
}

/* Buttons */
.btn{
  -webkit-appearance: none;
  appearance: none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:none;
  border-radius:10px;
  padding:12px 16px;
  font-weight:600;
  cursor:pointer;
  color: var(--btn-primary-fg);
  background: var(--btn-primary-bg);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 6px 16px rgba(0,0,0,0.18);
  transition: transform .06s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover{
  filter: brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    0 8px 22px rgba(0,0,0,0.22);
}
.btn:active{ transform: translateY(1px); }

.btn.secondary{
  color: var(--btn-secondary-fg);
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-br);
  box-shadow: none;
}
.btn.secondary:hover{ border-color: var(--brand-accent); }

/* Flash messages */
.flash{
  padding:10px 12px;
  border-radius:10px;
  margin-bottom:12px;
  border:1px solid transparent;
}
.flash.error{
  background: var(--error-bg);
  border-color: var(--error-br);
  color: var(--error-fg);
}
.flash.info{
  background: var(--info-bg);
  border-color: var(--info-br);
  color: var(--info-fg);
}

small{ color:#94a3b8; }

/* Toolbar for theme toggle (optional; used on index.php) */
.page-toolbar{
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  z-index: 2;
}
.theme-toggle .label{ display:inline-block; margin-left:4px; font-weight:600; }
.theme-toggle .icon{ font-size: 14px; line-height: 1; }

/* Flush, full-width header pinned to the top */
.site-header{
  position: sticky; /* stays at top on scroll, but participates in flow */
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;                /* no outside spacing */
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-br);
  z-index: 100;
}
.site-header .header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;       /* inner breathing room */
}

/* Nav links */
.nav-list{ display:flex; align-items:center; gap:16px; list-style:none; margin:0; padding:0; }
.nav-list a{
  color: var(--link-color);
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
}
.nav-list a:hover{ background: rgba(29,197,239,0.10); }

/* Right-side actions */
.header-actions{ display:flex; align-items:center; gap:10px; }

/* Make body layout not center everything on pages with header */
body.has-header{
  display: block;          /* override the flex centering */
  min-height: 100vh;
}

/* Main area spacing under the header */
.page-main{
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}

/* Avatar (profile/account) */
.avatar{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  border-radius:9999px;
  text-decoration:none;
  font-weight:700;
  font-size:13px;
  letter-spacing:.3px;
  color:#fff;
  background: linear-gradient(180deg, var(--indigo-500), var(--brand-primary));
  border:1px solid var(--topbar-br);
  box-shadow: var(--shadow-1);
}
.avatar:hover{
  filter: brightness(1.06);
}
.header-actions{ display:flex; align-items:center; gap:10px; } /* ensures spacing around avatar */
/* A11y helper */
.sr-only{
  position:absolute !important; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* Base tweaks */
.site-header .menu-toggle{ display:none; }

@media (max-width: 720px){
  .site-header .menu-toggle{ display:inline-flex; }

  /* Drawer (fully hidden & non-interactive by default) */
  #primaryNav{
    position: fixed;
    top: 0; left: 0;
    height: 100dvh;
    width: min(84vw, 320px);
    background: var(--topbar-bg);
    border-right: 1px solid var(--topbar-br);
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    transform: translateX(-100%);
    transition: transform .22s ease-out, visibility 0s linear .22s;
    z-index: 1100;
    padding-top: 64px;

    /* hide-before-open safeguards */
    visibility: hidden;           /* no paint */
    pointer-events: none;         /* no clicks */
    opacity: 0;                   /* belt + suspenders for some UAs */
  }

  /* Drawer content */
  #primaryNav .nav-list{
    display:flex; flex-direction:column;
    gap:4px; padding:12px;
  }
  #primaryNav .nav-list a{ display:block; padding:12px 14px; border-radius:12px; }

  /* Backdrop */
  .site-header .nav-backdrop{
    position: fixed; inset:0;
    background: rgba(8,12,32,.45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 1090;
    display:none;
  }

  /* When open */
  .nav-open #primaryNav{
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    transition: transform .22s ease-out;
  }
  .nav-open .site-header .nav-backdrop{ display:block; }

  /* keep header bar compact */
  .site-header .header-actions .signout{ padding:10px 12px; }
  .site-header .theme-toggle .label{ display:none; }
  
  .header-actions .signout{
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center; /* true center alignment */
  }
  .header-actions .signout::before{
    content: "⏻";
    font-size: 18px;
    line-height: 1;
    color: var(--btn-secondary-fg);
    display: inline-block;
    transform: translateY(1px); /* ↓ adjust vertical centering */
  }
  .header-actions .signout:hover::before{
    color: var(--brand-accent);
  }
}


@media (max-width: 380px){
  .avatar{ width:32px; height:32px; font-size:12px; }
  .site-header .header-inner{ padding:10px 12px; }
}

/* --- Normalize action buttons (desktop) --- */
.header-actions .btn,
.header-actions .signout,
.header-actions .theme-toggle{
  height: 36px;           /* same height */
  padding: 8px 12px;      /* same padding */
  line-height: 1;         /* avoid icon stretching */
  border-radius: 10px;
}

/* Tweak icon alignment on desktop */
.header-actions .theme-toggle .icon{ font-size: 16px; transform: translateY(1px); }

/* --- Mobile: make both true icon buttons (same square size) --- */
@media (max-width: 720px){
  .header-actions .theme-toggle,
  .header-actions .signout{
    width: 36px;
    height: 36px;
    padding: 0;                   /* kill default .btn padding */
    display: inline-flex;
    align-items: center;
    justify-content: center;      /* perfect center */
    gap: 0;                       /* no icon/label gap */
  }

  /* Hide theme label and size the icon */
  .site-header .theme-toggle .label{ display:none; }
  .header-actions .theme-toggle .icon{ font-size: 18px; transform: translateY(1px); }

  /* Signout already uses ::before; ensure same visual weight */
  .header-actions .signout{ font-size: 0; } /* hide link text on mobile */
  .header-actions .signout::before{
    content: "⏻";
    font-size: 18px;
    line-height: 1;
    transform: translateY(1px);
    color: var(--btn-secondary-fg);
  }
  .header-actions .signout:hover::before{ color: var(--brand-accent); }
}

/* ============================
   Coach / SDR Practice Page
   ============================ */

.coach-main{
  max-width:clamp(1100px, 94vw, 1400px);
  width:100%;
  margin:24px auto 40px;
  padding:0 16px 32px;
}

.coach-toolbar{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.coach-toolbar h1{
  font-size:22px;
  margin:0;
}
.coach-toolbar .muted{
  font-size:12px;
}

.coach-company-form{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.coach-company-form select{
  min-width:220px;
  border-radius:10px;
  padding:8px 10px;
  border:1px solid var(--card-br);
  background:var(--card-bg);
  color:var(--text-color);
}

.coach-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:20px;
  margin-top:10px;
}
@media (max-width: 900px){
  .coach-grid{
    grid-template-columns:minmax(0,1fr);
  }
}

.coach-grid .card{
  width:100%;
  max-width:100%;
  padding:18px 18px 20px;
  margin:0;
  border-radius:16px;
  box-shadow:var(--shadow-1);
}

.coach-card-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.coach-card-title{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.coach-step-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.06em;
  padding:3px 8px;
  border-radius:999px;
  background:rgba(29,197,239,0.12);
  border:1px solid rgba(29,197,239,0.45);
  color:var(--info-fg);
}
.coach-step-badge span.dot{
  width:6px;
  height:6px;
  border-radius:999px;
  background:var(--cyan-500);
}
.coach-card-header h2{
  font-size:18px;
  margin:2px 0 2px;
}
.coach-subtitle{
  margin:0;
  font-size:13px;
  color:var(--ink-400);
}

.coach-meta{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:6px;
  min-width:120px;
}
.coach-pill{
  font-size:11px;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid rgba(73,81,168,0.55);
  background:rgba(18,20,51,0.8);
  color:var(--ink-300);
  white-space:nowrap;
}
.coach-status-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid rgba(29,197,239,0.45);
  background:rgba(29,197,239,0.10);
  color:var(--cyan-200);
}
.coach-status-pill .dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:var(--cyan-500);
  box-shadow:0 0 8px rgba(79,210,243,0.75);
}

.coach-kv{
  display:grid;
  grid-template-columns:180px minmax(0,1fr);
  gap:10px 14px;
  align-items:flex-start;
}
@media (max-width: 720px){
  .coach-kv{
    grid-template-columns:minmax(0,1fr);
  }
}
.coach-kv-label{
  font-size:13px;
  color:var(--ink-300);
  padding-top:6px;
}

.coach-select,
.coach-select select{
  width:100%;
}
.coach-select select{
  border-radius:10px;
  padding:9px 10px;
  border:1px solid var(--card-br);
  background:var(--card-bg);
  color:var(--text-color);
}
.coach-hint{
  margin-top:6px;
  font-size:12px;
  color:var(--ink-400);
}

.coach-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.coach-actions .btn{
  min-width:130px;
}
.coach-status-text{
  font-size:13px;
  color:var(--ink-400);
}

/* ============================
   Coach page – call waveform
   ============================ */

.coach-wave{
  display:none;                  /* hidden until call is active */
  align-items:flex-end;
  gap:3px;
  height:16px;
  padding-left:6px;
}

.coach-wave span{
  display:block;
  width:3px;
  border-radius:999px;
  background:var(--cyan-500);
  opacity:0.55;
  transform-origin:bottom center;
  height:4px;                    /* flat baseline */
  transition:
    height 80ms linear,
    opacity 80ms linear;
}

/* Show waveform when call is active */
.coach-wave.active{
  display:flex;
}

/* Optional emphasis state if you want to tint while speaking */
.coach-wave.speaking span{
  opacity:0.9;
}

/* ============================
   Light theme tweaks for coach
   ============================ */

html[data-theme="light"] .coach-grid .card{
  box-shadow:0 8px 24px rgba(49,57,136,0.16);
  border:1px solid rgba(49,57,136,0.14);
}

html[data-theme="light"] .coach-step-badge{
  background:rgba(32,185,241,0.16);
  border-color:rgba(32,185,241,0.45);
  color:#0f3d57;
}

html[data-theme="light"] .coach-step-badge .dot{
  background:var(--cyan-600);
}

html[data-theme="light"] .coach-pill{
  background:rgba(73,81,168,0.08);
  border-color:rgba(49,57,136,0.35);
  color:#1b2150;
}

html[data-theme="light"] .coach-status-pill{
  background:rgba(32,185,241,0.15);
  border-color:rgba(32,185,241,0.50);
  color:#0f3d57;
}

html[data-theme="light"] .coach-status-text,
html[data-theme="light"] .coach-toolbar .muted,
html[data-theme="light"] .coach-hint{
  color:#4a4a4a;
}

html[data-theme="light"] .coach-kv-label{
  color:#5a5a5a;
}
