@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;900&family=Inter:wght@300;400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1a1a5e;
    --primary-light: #2d4a7a;
    --accent: #3a7bd5;
    --accent-light: #edf2fa;
    --gold: #c9a84c;
    --gold-light: #f5efd6;
    --text: #1a1a2e;
    --text-light: #555;
    --text-muted: #888;
    --bg: #f5f3ef;
    --white: #ffffff;
    --border: #e2ddd5;
    --green: #2e7d32;
    --green-bg: #e8f5e9;
    --red: #c62828;
    --red-bg: #fce4ec;
    --orange: #ef6c00;
    --orange-bg: #fff3e0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ============== AUTH PAGES (login/register/change-password/pending) ============== */
.auth-shell {
    flex: 1;
    display: flex;
    align-items: stretch;
    background: linear-gradient(160deg, #0d0d3b 0%, #1a1a5e 30%, #2d4a7a 60%, #1a3a5c 100%);
    position: relative;
    overflow: hidden;
}
.auth-shell::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -25%;
    width: 70%;
    height: 180%;
    background: radial-gradient(ellipse, rgba(201,168,76,0.10) 0%, transparent 70%);
    pointer-events: none;
}

.auth-side {
    flex: 1.1;
    padding: 80px 70px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 1;
}
.auth-brand {
    font-family: 'Playfair Display', serif;
    font-size: 0.78rem;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 12px;
}
.auth-title {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 24px;
}
.auth-tag {
    color: rgba(255,255,255,0.65);
    max-width: 480px;
    font-size: 1.05rem;
    line-height: 1.6;
}
.auth-divider {
    width: 60px;
    height: 2px;
    background: var(--gold);
    margin: 28px 0;
}

.auth-card {
    flex: 0.9;
    background: var(--white);
    padding: 70px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: -10px 0 60px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
    overflow-y: auto;
}
.auth-form-wrap {
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
}
.auth-card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}
.auth-card .subtitle {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.field {
    margin-bottom: 20px;
}
.field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-light);
    margin-bottom: 7px;
}
.field input {
    width: 100%;
    padding: 13px 16px;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    color: var(--text);
    transition: all 0.18s;
}
.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(58,123,213,0.12);
}
.field .hint {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border: 0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    width: 100%;
    margin-top: 8px;
    box-shadow: 0 6px 20px rgba(26,26,94,0.18);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(26,26,94,0.26);
    text-decoration: none;
}
.btn-ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--accent-light);
    text-decoration: none;
}
.btn-success {
    background: var(--green);
    color: white;
    padding: 8px 14px;
    font-size: 0.85rem;
}
.btn-success:hover { background: #1b5e20; text-decoration: none; }
.btn-danger {
    background: var(--red);
    color: white;
    padding: 8px 14px;
    font-size: 0.85rem;
}
.btn-danger:hover { background: #8e1c1c; text-decoration: none; }
.btn-warn {
    background: var(--orange);
    color: white;
    padding: 8px 14px;
    font-size: 0.85rem;
}
.btn-warn:hover { background: #b55300; text-decoration: none; }

.auth-foot {
    margin-top: 26px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.92rem;
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 0.92rem;
    border-left: 4px solid;
}
.alert.error { background: var(--red-bg); border-color: var(--red); color: #7a1818; }
.alert.ok    { background: var(--green-bg); border-color: var(--green); color: #1c5421; }
.alert.info  { background: var(--accent-light); border-color: var(--accent); color: #1a3766; }
.alert.warn  { background: var(--orange-bg); border-color: var(--orange); color: #7c3d00; }

/* ============== ADMIN PAGE ============== */
.admin-shell {
    flex: 1;
    background: var(--bg);
    padding-top: 60px;
}
.admin-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    z-index: 50;
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}
.admin-topbar h1 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 700;
}
.admin-topbar .spacer { flex: 1; }
.admin-topbar nav { display: flex; gap: 18px; align-items: center; }
.admin-topbar nav a {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
}
.admin-topbar nav a:hover { background: var(--accent-light); color: var(--accent); text-decoration: none; }
.admin-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--gold-light);
    color: #6b5615;
    border-radius: 16px;
    font-size: 0.82rem;
    font-weight: 600;
}

.admin-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 28px 60px;
}

.section-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(26,26,94,0.04);
}
.section-card h2 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-card .count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 9px;
    min-width: 24px;
    height: 22px;
}
.section-card .count-pill.warn { background: var(--orange); }
.section-card .count-pill.muted { background: #ccc; }
.section-card .desc {
    color: var(--text-light);
    margin-bottom: 18px;
    font-size: 0.92rem;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
}
.user-table th, .user-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    vertical-align: middle;
}
.user-table th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    background: #fafaf7;
    border-bottom: 1px solid var(--border);
}
.user-table tr:last-child td { border-bottom: 0; }
.user-table .username {
    font-weight: 600;
    color: var(--text);
}
.user-table .role-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.user-table .role-badge.admin { background: var(--gold-light); color: #6b5615; }
.user-table .role-badge.user  { background: #f0ede8; color: #555; }
.user-table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.user-table .actions form { display: inline; }
.user-table .actions .btn {
    padding: 7px 12px;
    font-size: 0.82rem;
}

.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 0;
    font-style: italic;
}

/* ============== ERROR PAGE ============== */
.error-shell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 40px;
}
.error-card {
    max-width: 480px;
    width: 100%;
    text-align: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 50px 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.error-card h1 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 12px;
}
.error-card p { color: var(--text-light); margin-bottom: 24px; }

/* ============== RESPONSIVE ============== */
@media (max-width: 900px) {
    .auth-shell { flex-direction: column; }
    .auth-side { padding: 50px 30px 30px; flex: 0; }
    .auth-title { font-size: 2rem; }
    .auth-tag { font-size: 0.95rem; }
    .auth-card { padding: 40px 28px 60px; }
    .admin-main { padding: 24px 14px 60px; }
    .section-card { padding: 18px 18px; }
    .user-table th:nth-child(3), .user-table td:nth-child(3) { display: none; }
}
