/* =========================
FILE: static/css/styles.css
========================= */

/* Theme tokens */
:root{
  --bg: #f7fbff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;

  --green: #2e7d32;     /* growth */
  --blue:  #1565c0;     /* trust */
  --yellow:#f9a825;     /* hope */

  --border: rgba(15,23,42,.12);
  --shadow: 0 10px 30px rgba(2, 8, 23, .08);
  --radius: 16px;

  --maxw: 1060px;
  --focus: 0 0 0 4px rgba(21,101,192,.18);
}

body.theme{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  background: linear-gradient(180deg, #f7fbff 0%, #f2fff6 70%, #fffdf2 100%);
}

a{ color: var(--blue); text-decoration: none; }
a:hover{ text-decoration: underline; }

.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;

  padding: 14px 18px;

  /* for absolute-positioned close button on mobile */
  position: sticky;
}

.footer{
  padding: 14px 18px;
}

.brand{
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  color: var(--text);
}
.brand-mark{
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(46,125,50,.10);
  border: 1px solid rgba(46,125,50,.20);
}
.brand-name{ letter-spacing: .2px; }

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
  margin-left:auto;
}

.iconbtn{
  border:1px solid rgba(0,0,0,0.12);
  background:transparent;
  border-radius:12px;
  padding:10px 12px;
  font-size:18px;
  line-height:1;
  cursor:pointer;
}
.iconbtn:focus{ box-shadow: var(--focus); }

.topnav{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.navlink{
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  border: none;
  background: transparent;
  cursor: pointer;
}
.navlink:hover{
  background: rgba(21,101,192,.08);
  text-decoration: none;
}
.navlink-quiet{ color: var(--muted); }

.page{
  max-width: var(--maxw);
  margin: 22px auto;
  padding: 0 18px 30px;
}

.footer{
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.7);
}
.footer-inner{
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 6px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.muted{ color: var(--muted); }
.tiny{ font-size: 12px; }
.h2{ margin: 0; }

.section{ margin: 18px 0 26px; }
.section-head h1, .section-head h2{ margin: 0 0 6px; }
.section-head p{ margin: 0; }

.hero{
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(21,101,192,.08), rgba(46,125,50,.06), rgba(249,168,37,.08));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-inner{ padding: 18px; }
.hero h1{ margin: 0 0 8px; }

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card-soft{
  background: rgba(255,255,255,.65);
  border: 1px dashed rgba(15,23,42,.15);
  border-radius: var(--radius);
  padding: 14px;
}
.card-link{
  display: block;
  color: inherit;
  transition: transform .08s ease;
}
.card-link:hover{
  transform: translateY(-2px);
  text-decoration: none;
}
.card-icon{ font-size: 26px; }
.cta{
  display: inline-block;
  margin-top: 8px;
  font-weight: 700;
  color: var(--blue);
}

.cards{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 820px){
  .cards{ grid-template-columns: 1fr; }
}

.track-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.track{
  background: rgba(255,255,255,.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.track h3{ margin: 0 0 6px; }
.track p{ margin: 0; }
@media (max-width: 900px){
  .track-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px){
  .track-grid{ grid-template-columns: 1fr; }
}

.challenge{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-left: 6px solid rgba(249,168,37,.75);
}

.auth{
  display: grid;
  place-items: center;
  min-height: calc(100vh - 160px);
}
.auth-card{
  width: min(560px, 100%);
}
.auth-head{ margin-bottom: 10px; }
.logo{
  display: flex;
  gap: 12px;
  align-items: center;
}
.logo-icon{
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(46,125,50,.10);
  border: 1px solid rgba(46,125,50,.20);
  font-size: 24px;
}
.auth h1{ margin: 0; }
.auth p{ margin: 4px 0 0; }

.form{ display: grid; gap: 12px; margin-top: 10px; }
.field{ display: grid; gap: 7px; }
.field span{ font-weight: 700; font-size: 14px; }
input, select{
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  outline: none;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus{
  box-shadow: var(--focus);
  border-color: rgba(21,101,192,.4);
}

.grid2{
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}
.grid3{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
@media (max-width: 720px){
  .grid2, .grid3{ grid-template-columns: 1fr; }
}

.row{ display: flex; gap: 10px; align-items: center; }
.row-wrap{ flex-wrap: wrap; }
.row-between{ justify-content: space-between; }

.check{ display:flex; gap:10px; align-items:center; }
.check input{ width: 18px; height: 18px; }

.btn{
  border: 1px solid var(--border);
  background: #fff;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}
.btn:focus{ box-shadow: var(--focus); }
.btn-primary{
  background: linear-gradient(135deg, rgba(21,101,192,.95), rgba(46,125,50,.92));
  color: white;
  border: none;
}
.btn-secondary{
  background: rgba(249,168,37,.16);
  border-color: rgba(249,168,37,.35);
}
.btn-ghost{
  background: rgba(21,101,192,.06);
  border-color: rgba(21,101,192,.18);
}
.btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}

.form-foot{
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.hint{
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.alert{
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(21,101,192,.06);
}
.alert.error{ background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.24); }
.alert.success{ background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.24); }

.tabs{
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.tab{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.8);
  font-weight: 800;
  cursor: pointer;
}
.tab.active{
  background: rgba(21,101,192,.10);
  border-color: rgba(21,101,192,.22);
}

.output{
  margin-top: 10px;
  line-height: 1.6;
}
.pre{
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 14px;
  background: rgba(2,8,23,.03);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(2,8,23,.08);
}

.split{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.mini h3{ margin: 0 0 8px; }
.list{ margin: 0; padding-left: 18px; }

.search{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  min-width: 220px;
}

.accordion{
  display: grid;
  gap: 10px;
}
.acc-head{
  width: 100%;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.85);
  font-weight: 900;
  cursor: pointer;
}

/* ===== Responsive Topbar (mobile drawer) ===== */
@media (max-width: 720px){
  .topbar{
    flex-wrap:nowrap;
    position: sticky;
  }

  .brand-name{
    font-size:16px;
    white-space:nowrap;
  }

  /* nav becomes a dropdown drawer */
  .topnav{
    width:100%;
    display:none;
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    padding:12px 0 6px;
  }
  .topnav.is-open{
    display:flex;
  }

  .topnav .navlink,
  .topnav button{
    width:100%;
    justify-content:center;
    text-align:center;
  }

  /* Move the close button to the upper-right of the opened menu */
  .topbar.menu-open{
    position: sticky;
  }
  .topbar.menu-open #navToggle{
    position:absolute;
    right:18px;
    top:14px;
    z-index: 20;
    background: rgba(255,255,255,.95);
  }
}

/* Desktop: show nav normally, hide hamburger */
@media (min-width: 721px){
  #navToggle{ display:none; }
  .topnav{ width:auto; display:flex !important; }
}
