:root {
    --primary-color:   #0d1b4b;
    --primary-mid:     #1a2f6b;
    --gold:            #c8960c;
    --gold-lt:         #f5c842;
    --danger-color:    #dc143c;
    --secondary-color: #198754;
    --bg-color:        #0d1b4b;
    --text-color:      #1e293b;
}

* { box-sizing: border-box; }

body {
    font-family: 'Sarabun', sans-serif;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(200,150,12,.12) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(245,200,66,.08) 0%, transparent 45%),
        linear-gradient(160deg, #0d1b4b 0%, #1a2f6b 50%, #0b1535 100%);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    color: var(--text-color);
}

/* ── CARD ─────────────────────────────────────────────── */
.auth-container {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow:
        0 0 0 1px rgba(200,150,12,.25),
        0 24px 60px rgba(0,0,0,.45),
        0 0 40px rgba(200,150,12,.08);
    padding: 2.5rem 2.25rem;
    position: relative;
    overflow: hidden;
}

/* gold top bar */
.auth-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold), var(--gold-lt), var(--gold));
}

/* subtle inner glow */
.auth-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(200,150,12,.04) 0%, transparent 60%);
    pointer-events: none;
}

/* ── HEADING ──────────────────────────────────────────── */
h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    color: var(--primary-color);
    letter-spacing: .04em;
}

.subtitle {
    text-align: center;
    margin-top: .35rem;
    margin-bottom: 1.5rem;
    color: #64748b;
    font-weight: 600;
}

/* ── TABS ─────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: .6rem;
    margin-bottom: 1.5rem;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px;
}

.tab {
    flex: 1;
    padding: .65rem .75rem;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    transition: all .2s ease;
    font-family: 'Sarabun', sans-serif;
}

.tab.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13,27,75,.35);
}

.tab-content {
    display: none;
    animation: fadeIn .25s ease;
}
.tab-content.active { display: block; }

/* ── FORM ─────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

label {
    display: block;
    font-weight: 600;
    font-size: .88rem;
    margin-bottom: .35rem;
    color: #374151;
}

input {
    width: 100%;
    padding: .75rem .9rem;
    border-radius: 10px;
    border: 1.5px solid #dde3ed;
    font-size: .95rem;
    font-family: 'Sarabun', sans-serif;
    transition: border .2s ease, box-shadow .2s ease;
    background: #f8fafc;
    color: var(--text-color);
}
input[type="file"] { padding: .5rem .75rem; cursor: pointer; }
input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(200,150,12,.15);
    outline: none;
    background: #fff;
}

/* ── SUBMIT BUTTON ────────────────────────────────────── */
button[type="submit"] {
    width: 100%;
    padding: .9rem;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-mid));
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: .5rem;
    font-family: 'Sarabun', sans-serif;
    letter-spacing: .03em;
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
}
button[type="submit"]::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(200,150,12,.15), rgba(245,200,66,.1));
    opacity: 0;
    transition: opacity .2s;
}
button[type="submit"]:hover::after { opacity: 1; }
button[type="submit"]:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(13,27,75,.35); }
button:disabled { opacity: .6; cursor: not-allowed; }

/* ── ALERTS ───────────────────────────────────────────── */
.loader,
.error-message,
.success-message {
    display: none;
    margin-top: .85rem;
    border-radius: 10px;
    padding: .85rem;
    font-size: .9rem;
}
.loader {
    background: #eef2ff;
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-mid);
}
.error-message {
    background: #fff5f5;
    color: var(--danger-color);
    border-left: 3px solid var(--danger-color);
}
.success-message {
    background: #f0fdf4;
    color: var(--secondary-color);
    border-left: 3px solid var(--secondary-color);
}
.show { display: block; }

/* ── FORGOT PANEL ─────────────────────────────────────── */
.link-row {
    margin-top: 1rem;
    text-align: center;
    font-size: .9rem;
}
.link-row a {
    color: var(--gold);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.forgot-panel {
    margin-top: .85rem;
    padding: .85rem .85rem .6rem;
    border-radius: 12px;
    background: #fffbeb;
    border: 1px dashed rgba(200,150,12,.4);
    font-size: .9rem;
}
.forgot-panel h3 {
    margin: 0 0 .35rem;
    font-size: .95rem;
    font-weight: 700;
    color: var(--gold);
}
.forgot-panel small {
    display: block;
    margin-bottom: .5rem;
    color: #6b7280;
    font-size: .8rem;
}
.forgot-panel .form-group-inline { margin-bottom: .5rem; }
.forgot-panel input {
    font-size: .9rem;
    padding: .45rem .6rem;
    border-radius: 8px;
}
.forgot-panel button {
    border-radius: 999px;
    padding: .4rem .95rem;
    font-size: .85rem;
}

/* ── FORGOT LINK (เหนือปุ่มเข้าสู่ระบบ ชิดขวา) ─────────── */
.forgot-link-row {
    text-align: right;
    margin: -.35rem 0 .85rem;
}
.forgot-link-row a {
    color: var(--gold);
    font-weight: 600;
    font-size: .85rem;
    text-decoration: none;
    cursor: pointer;
}
.forgot-link-row a:hover { text-decoration: underline; }

/* ── MODAL POPUP (ลืมรหัสผ่าน) ─────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 27, 75, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn .2s ease;
}
.modal-card {
    position: relative;
    width: 100%;
    max-width: 390px;
    background: #fff;
    border-radius: 16px;
    padding: 1.9rem 1.5rem 1.5rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
    border-top: 4px solid var(--gold);
    animation: fadeIn .25s ease;
}
.modal-card h3 {
    margin: 0 0 .35rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
}
.modal-card small {
    display: block;
    color: #6b7280;
    font-size: .82rem;
    margin-bottom: .25rem;
}
.modal-card button#forgotRequestBtn {
    width: 100%;
    padding: .8rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-mid));
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Sarabun', sans-serif;
    margin-top: .25rem;
    transition: box-shadow .2s ease, transform .2s ease;
}
.modal-card button#forgotRequestBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 27, 75, .35);
}
.modal-close {
    position: absolute;
    top: .55rem;
    right: .7rem;
    width: auto;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: .1rem .35rem;
}
.modal-close:hover { color: var(--danger-color); }

/* ── ANIMATION ────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 480px) {
    body { padding: .75rem; }
    .auth-container { padding: 2rem 1.25rem; border-radius: 16px; }
    h1 { font-size: 1.5rem; }
    input, button[type="submit"] { font-size: 16px; }
}
