/* --- Theme variables & toggle styling (append near top of file) --- */
/* Light defaults */
:root{
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --purple: #6C5CE7;
  --purple-700: #5a47d0;
  --card-border: rgba(16,24,40,0.04);
  --shadow: 0 8px 28px rgba(16,24,40,0.06);
  --glass: rgba(255,255,255,0.6);
}

/* Respect system preference */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #0f1724;
    --text: #e6eef8;
    --muted: #9aa6bf;
    --purple: #8f7cff;
    --purple-700: #7b68f0;
    --card-border: rgba(255,255,255,0.04);
    --shadow: 0 10px 30px rgba(2,6,23,0.6);
    --glass: rgba(255,255,255,0.03);
  }
}

/* Explicit dark theme via attribute */
[data-theme="dark"]{
  --bg: #0b1020;
  --surface: #0f1724;
  --text: #e6eef8;
  --muted: #9aa6bf;
  --purple: #8f7cff;
  --purple-700: #7b68f0;
  --card-border: rgba(255,255,255,0.04);
  --shadow: 0 10px 30px rgba(2,6,23,0.6);
  --glass: rgba(255,255,255,0.03);
}

/* apply variables */
html,body{
  background: linear-gradient(180deg, var(--bg), var(--surface));
  color: var(--text);
}

/* components using vars already in project should pick up the theme */
/* Theme toggle control */
.theme-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:40px;
  height:40px;
  border-radius:10px;
  border:1px solid rgba(16,24,40,0.06);
  background:transparent;
  color:var(--text);
  cursor:pointer;
  font-size:16px;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.theme-toggle:hover{ transform: translateY(-3px); box-shadow: 0 8px 20px rgba(16,24,40,0.06); }

/* floating variant (optional) */
.theme-toggle.floating{ position:fixed; right:16px; top:16px; z-index:9999; }

/* smooth theme transitions */
*{ transition: background-color .12s ease, color .12s ease, border-color .12s ease, box-shadow .12s ease; }

/* Brand variables */
:root{
    --purple: #6C5CE7;
    --purple-dark: #5a47d0;
    --bg: #f7f7fb;
    --card: #ffffff;
    --muted: #6b7280;
    --radius: 12px;
    --max-width: 420px;
    --shadow-soft: 0 8px 30px rgba(108,92,231,0.12);
    font-synthesis: none;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
    margin:0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    background: linear-gradient(180deg, var(--bg), var(--surface));
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
    color: var(--text);
}

/* Page layout */
.page{
    min-height:100vh;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:24px;
    padding:32px;
}

/* Top brand */
.brand{
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}
.logo{
    font-weight:700;
    font-size:20px;
    color:var(--purple);
    letter-spacing:0.6px;
}
.logo .dot{
    color:var(--purple-dark);
    margin-left:4px;
}
.subtitle{
    margin:6px 0 0 0;
    font-size:13px;
    color:var(--muted);
}
.brand .logo img{
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    padding: 10px;
    box-shadow: 0 8px 30px rgba(108,92,231,0.14);
    border: 2px solid rgba(255,255,255,0.08);
}

/* Card */
.card{
    width:100%;
    max-width:var(--max-width);
    background:var(--card);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    padding:28px;
    border:1px solid rgba(99,102,241,0.06);
}

.card-title{
    margin:0 0 18px 0;
    font-size:18px;
    font-weight:600;
    color:#111827;
}

/* Form controls */
.form{ display:flex; flex-direction:column; gap:12px; }
.label{ font-size:13px; color:var(--muted); margin-bottom:6px; }
.input{
    appearance:none;
    width:100%;
    padding:12px 14px;
    border-radius:10px;
    border:1px solid #e6e9ef;
    background:#fff;
    font-size:14px;
    transition:box-shadow .14s, border-color .14s, transform .06s;
}
.input:focus{
    outline:none;
    border-color:var(--purple);
    box-shadow:0 6px 20px rgba(108,92,231,0.12);
    transform:translateY(-1px);
}

/* Button */
.btn{
    margin-top:6px;
    padding:12px 14px;
    width:100%;
    background:linear-gradient(90deg,var(--purple),var(--purple-dark));
    color:#fff;
    border:none;
    border-radius:10px;
    font-weight:600;
    cursor:pointer;
    box-shadow:0 10px 24px rgba(108,92,231,0.12);
    transition:transform .12s, box-shadow .12s, opacity .12s;
}
.btn:hover{ transform:translateY(-3px); }
.btn:active{ transform:translateY(0); opacity:0.96; }

/* Alerts for forms */
.alert{
    padding:10px 12px;
    border-radius:10px;
    font-size:14px;
    margin-bottom:12px;
}
.alert-success{
    background: rgba(76,175,80,0.08);
    color: #166534;
    border: 1px solid rgba(34,197,94,0.12);
}
.alert-error{
    background: rgba(239,68,68,0.06);
    color:#7f1d1d;
    border: 1px solid rgba(239,68,68,0.08);
}

/* Grid layout for register form */
.form-grid{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:12px;
    align-items:start;
}
.form-grid .col-full{
    grid-column: 1 / -1;
}

/* Ensure selects inherit input styling */
select.input{
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, rgba(0,0,0,0.35) 50%),
                      linear-gradient(135deg, rgba(0,0,0,0.35) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 38px;
}

/* Adjustments for small screens */
@media (max-width: 600px){
    .form-grid{ grid-template-columns: 1fr; }
    .logo img{ width:80px; height:80px; }
    .card{ padding:20px; }
}

/* Responsive tweaks */
@media (max-width:480px){
    .card{ padding:20px; border-radius:10px; }
    .logo{ font-size:18px; }
}

/* Optional: place brand to the left of the card on wide screens */
@media (min-width: 900px) {
    .page{
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 36px;
    }
    .brand{
        justify-content: flex-start;
        text-align: left;
    }
    .card{
        max-width: 460px;
    }
}