/**
 * ธีมหน้า Login — โทนสีเดียวกับ index.php (#fff0f6 + pink blobs + glass card)
 * ใส่ class บน body: login-portal login-student | login-admin | login-teacher | login-passport
 */
.login-portal {
    min-height: 100vh;
    background: #fff0f6;
    position: relative;
    overflow-x: hidden;
}

.login-portal::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 20% 10%, rgba(244,114,182,0.14) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(236,72,153,0.10) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 60% 20%, rgba(251,191,212,0.12) 0%, transparent 50%);
}

.login-portal::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #fbcfe8 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.45;
}

.login-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
}
.login-blob-1 {
    width: 400px; height: 400px; top: -100px; left: -100px;
    background: radial-gradient(circle, rgba(244,114,182,0.22), transparent 70%);
    animation: loginBlobFloat 12s ease-in-out infinite;
}
.login-blob-2 {
    width: 350px; height: 350px; bottom: -80px; right: -80px;
    background: radial-gradient(circle, rgba(236,72,153,0.18), transparent 70%);
    animation: loginBlobFloat 15s ease-in-out infinite reverse;
}
.login-blob-3 {
    width: 280px; height: 280px; top: 40%; left: 55%;
    background: radial-gradient(circle, rgba(251,207,232,0.20), transparent 70%);
    animation: loginBlobFloat 18s ease-in-out infinite 3s;
}
@keyframes loginBlobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -20px) scale(1.05); }
    66% { transform: translate(-15px, 15px) scale(0.97); }
}

/* Role accent variables */
.login-student {
    --login-stripe: linear-gradient(90deg, #6366f1, #818cf8);
    --login-accent: #4f46e5;
    --login-accent-dark: #4338ca;
    --login-accent-soft: #eff6ff;
    --login-accent-border: #c7d2fe;
    --login-btn: linear-gradient(135deg, #6366f1, #4f46e5);
    --login-btn-shadow: rgba(99,102,241,0.28);
    --login-panel: linear-gradient(145deg, #6366f1 0%, #4f46e5 45%, #4338ca 100%);
    --login-topbar: linear-gradient(135deg, #6366f1, #4f46e5);
}
.login-admin {
    --login-stripe: linear-gradient(90deg, #0d9488, #2dd4bf);
    --login-accent: #0d9488;
    --login-accent-dark: #0f766e;
    --login-accent-soft: #f0fdfa;
    --login-accent-border: #99f6e4;
    --login-btn: linear-gradient(135deg, #0d9488, #0f766e);
    --login-btn-shadow: rgba(13,148,136,0.30);
    --login-panel: linear-gradient(145deg, #0d9488 0%, #0f766e 50%, #115e59 100%);
    --login-topbar: linear-gradient(135deg, #0d9488, #0f766e);
}
.login-teacher {
    --login-stripe: linear-gradient(90deg, #d97706, #fbbf24);
    --login-accent: #d97706;
    --login-accent-dark: #b45309;
    --login-accent-soft: #fffbeb;
    --login-accent-border: #fde68a;
    --login-btn: linear-gradient(135deg, #d97706, #b45309);
    --login-btn-shadow: rgba(245,158,11,0.30);
    --login-panel: linear-gradient(145deg, #d97706 0%, #b45309 50%, #92400e 100%);
    --login-topbar: linear-gradient(135deg, #d97706, #b45309);
}
.login-passport {
    --login-stripe: linear-gradient(90deg, #9b1c2a, #c8962a);
    --login-accent: #9b1c2a;
    --login-accent-dark: #6b1220;
    --login-accent-soft: #fff1f2;
    --login-accent-border: #fecdd3;
    --login-btn: linear-gradient(135deg, #9b1c2a, #6b1220);
    --login-btn-shadow: rgba(155,28,42,0.30);
    --login-panel: linear-gradient(135deg, #9b1c2a 0%, #6b1220 100%);
    --login-topbar: linear-gradient(135deg, #9b1c2a, #6b1220);
}

/* Centered layout (teacher login) */
.login-portal-center {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* Passport layout: topbar + main */
.login-portal-stack {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.login-topbar {
    position: relative;
    z-index: 2;
    background: var(--login-topbar);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.login-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.login-topbar-logo {
    width: 34px;
    height: 34px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    color: var(--login-accent);
}
.login-topbar-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.2px;
}
.login-topbar-name span {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.78;
    display: block;
}
.login-topbar-right {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
}
.login-main-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px 24px;
    position: relative;
    z-index: 1;
}

/* Glass card */
.login-glass-card {
    position: relative;
    z-index: 1;
    width: 100%;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(255,255,255,0.95);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
}
.login-glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--login-stripe);
    border-radius: 20px 20px 0 0;
    z-index: 2;
}

.login-card-head {
    background: var(--login-panel);
    padding: 28px 32px 22px;
    position: relative;
    overflow: hidden;
}
.login-card-head::before {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.login-card-head .head-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255,255,255,0.18);
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}
.login-card-head .head-title {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    position: relative;
    z-index: 1;
}
.login-card-head .head-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.72);
    margin-top: 3px;
    position: relative;
    z-index: 1;
}
.login-card-body {
    padding: 28px 32px 32px;
}

.login-info-box {
    background: var(--login-accent-soft);
    border: 1px solid var(--login-accent-border);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 12px;
    color: #475569;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 18px;
}
.login-info-box i {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--login-accent);
}

.login-btn-primary {
    width: 100%;
    height: 48px;
    background: var(--login-btn);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 4px 16px var(--login-btn-shadow);
    transition: opacity 0.2s;
}
.login-btn-primary:hover {
    opacity: 0.92;
    color: #fff;
}

.login-btn-back {
    width: 100%;
    height: 42px;
    background: rgba(255,255,255,0.7);
    color: #64748b;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    text-decoration: none;
    transition: background 0.2s;
}
.login-btn-back:hover {
    background: #fff;
    color: #374151;
}

.login-alert-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #b91c1c;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.login-footer-note {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    padding: 16px;
}

.login-index-logo {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}
.login-index-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(59,130,246,0.22);
    margin-bottom: 12px;
    color: #fff;
    font-size: 1.4rem;
}
.login-index-logo .logo-title {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
}
.login-index-logo .logo-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}
