/* ============================================================
   ZUDAD — Main Stylesheet
   ============================================================ */

:root {
    --burnt:       #9B4F1A;
    --amber:       #C97A3A;
    --amber-glow:  #D9924E;
    --navy:        #1D3B8A;
    --navy-deep:   #152B6A;
    --cream:       #F8F4EF;
    --dark:        #0F0D0B;
    --dark-mid:    #1A1612;
    --dark-card:   #221E19;
    --text-main:   #F0EBE3;
    --text-muted:  #A89880;
    --text-dim:    #6B5C4E;
    --danger:      #C0392B;
    --font-display: 'Georgia', serif;
    --font-body:    system-ui, -apple-system, sans-serif;
    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
    background: var(--dark);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input  { font-family: inherit; }

/* ── App container ──────────────────────────────── */
#app {
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Loading / error states ─────────────────────── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: var(--text-dim);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
}

.error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1.2rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.error-screen button {
    background: var(--burnt);
    color: var(--cream);
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

/* ── Auth screen ────────────────────────────────── */
.auth-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem;
    padding-top: calc(1.5rem + var(--safe-top));
    padding-bottom: calc(1.5rem + var(--safe-bottom));
    background: radial-gradient(ellipse at 50% 0%, rgba(155,79,26,0.15), transparent 60%);
}

.auth-card {
    background: var(--dark-card);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-lg);
    padding: 2.2rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.auth-logo img {
    height: 36px;
    width: auto;
}

.auth-tagline {
    text-align: center;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 2rem;
}

/* Tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1.8rem;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 0.6rem 0;
    font-size: 0.9rem;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
}

.auth-tab.active {
    color: var(--amber);
    border-bottom-color: var(--amber);
}

/* Form fields */
.field-group {
    margin-bottom: 1.1rem;
}

.field-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    letter-spacing: 0.04em;
}

.optional {
    color: var(--text-dim);
    font-weight: normal;
}

.field-group input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.field-group input:focus {
    outline: none;
    border-color: rgba(201,122,58,0.5);
    background: rgba(255,255,255,0.07);
}

.field-group input::placeholder {
    color: var(--text-dim);
}

/* Error message */
.auth-error {
    min-height: 1.2rem;
    font-size: 0.85rem;
    color: #E07070;
    margin-bottom: 0.8rem;
}

/* Submit button */
.btn-auth {
    width: 100%;
    background: var(--burnt);
    color: var(--cream);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    transition: background 0.2s, opacity 0.2s;
    box-shadow: 0 4px 16px rgba(155,79,26,0.35);
}

.btn-auth:hover  { background: var(--amber-glow); }
.btn-auth:disabled { opacity: 0.6; cursor: not-allowed; }

.hidden { display: none !important; }

/* ── Main app layout ────────────────────────────── */
.main-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    padding-top: calc(0.8rem + var(--safe-top));
    background: rgba(15,13,11,0.95);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-logo {
    height: 28px;
    width: auto;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.app-username {
    font-size: 0.82rem;
    color: var(--text-muted);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-dim);
    font-size: 0.78rem;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: rgba(201,122,58,0.4);
    color: var(--text-muted);
}

.app-main {
    flex: 1;
    padding: 1.5rem 1.2rem;
    padding-bottom: calc(1.5rem + var(--safe-bottom));
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.welcome h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--cream);
    margin-bottom: 0.4rem;
}

.welcome p {
    font-size: 0.9rem;
    color: var(--text-muted);
}
