/* ============================================================
   KharuPhan v3.0 — Dreamy & Luxury Light Mode
   ============================================================ */

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

:root {
    /* โทนสีสว่างชวนฝัน (Dreamy Light Pastel) */
    --bg: #f8fafc; 
    --bg-panel: rgba(255, 255, 255, 0.65);
    --bg-card: rgba(255, 255, 255, 0.85);
    --glass: rgba(255, 255, 255, 0.7);
    --glass-hover: rgba(255, 255, 255, 0.95);
    --border: rgba(255, 255, 255, 0.8);
    --border-focus: rgba(139, 92, 246, 0.4);

    /* สี Gradient หรูหรา ชวนฝัน */
    --grad-brand: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --grad-btn: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --grad-aurora: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 30%, #ec4899 70%, #f43f5e 100%);

    /* ตัวอักษรสีน้ำเงินเข้มจัด */
    --text-1: #0f172a; 
    --text-2: #334155;
    --text-3: #475569;
    --text-4: #64748b;

    --radius: 1rem;
    --radius-lg: 1.5rem;
}

body {
    font-family: 'Inter', 'Noto Sans Thai', sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 12% 18%, rgba(139,92,246,0.08), transparent 45%),
        radial-gradient(circle at 88% 78%, rgba(236,72,153,0.08), transparent 45%),
        radial-gradient(circle at 50% 95%, rgba(6,182,212,0.08), transparent 50%);
    background-attachment: fixed;
    color: var(--text-1);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   SPLIT LAYOUT (Auto Scaling)
   ============================================================ */
.page-wrapper {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* --- LEFT PANEL --- */
.brand-panel {
    flex: 1 1 55%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #fdfbfb 0%, #f3f4f6 50%, #eef2ff 100%);
}

.brand-panel::before {
    content: ''; position: absolute; width: 45vw; height: 45vw; top: -10%; left: -10%;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.25), transparent 70%);
    border-radius: 50%; filter: blur(60px); animation: blobA 25s ease-in-out infinite alternate;
}
.brand-panel::after {
    content: ''; position: absolute; width: 35vw; height: 35vw; bottom: -5%; right: -5%;
    background: radial-gradient(circle, rgba(244, 114, 182, 0.2), transparent 70%);
    border-radius: 50%; filter: blur(60px); animation: blobB 20s ease-in-out infinite alternate;
}

@keyframes blobA { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(30px, 20px) scale(1.1); } }
@keyframes blobB { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(-20px, -15px) scale(1.05); } }

.brand-content { position: relative; z-index: 2; max-width: 580px; width: 100%; margin: 0 auto; }

.brand-logo-row { display: flex; align-items: center; gap: 1rem; margin-bottom: clamp(1.5rem, 3vh, 2.5rem); }
.brand-logo-img {
    width: clamp(60px, 6vw, 75px);
    height: clamp(60px, 6vw, 75px);
    border-radius: 1.2rem;
    object-fit: cover;
    background: #ffffff;
    padding: 4px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.15);
}

.brand-logo-text h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800; letter-spacing: -0.02em;
    background: var(--grad-aurora); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    line-height: 1.1;
}
.brand-logo-text span { font-size: clamp(0.75rem, 1.5vw, 0.9rem); color: var(--text-3); font-weight: 500; }

.brand-headline {
    font-size: clamp(1.8rem, 4vw, 2.8rem); 
    font-weight: 800; line-height: 1.2; margin-bottom: 1rem;
    color: var(--text-1);
}
.brand-headline em {
    font-style: normal; background: var(--grad-brand);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.brand-desc { font-size: clamp(0.9rem, 1.5vw, 1.05rem); line-height: 1.6; color: var(--text-3); margin-bottom: clamp(1.5rem, 4vh, 2.5rem); font-weight: 400;}

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.feature-pill {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(255, 255, 255, 1); border-radius: 1rem;
    backdrop-filter: blur(10px); transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.feature-pill:hover { background: #ffffff; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.08); }
.feature-pill-icon { width: 36px; height: 36px; border-radius: 0.6rem; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.feature-pill-text { font-size: 0.85rem; font-weight: 700; color: var(--text-1); }
.feature-pill-sub { font-size: 0.7rem; color: var(--text-3); margin-top: 2px; }

.brand-credit { position: absolute; bottom: 1.5rem; left: 0; right: 0; text-align: center; font-size: 0.75rem; color: var(--text-4); z-index: 2; }
.brand-credit strong { background: var(--grad-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 700; }

/* --- RIGHT PANEL (LOGIN) --- */
.login-panel {
    flex: 1 1 45%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: clamp(1.5rem, 3vw, 3rem);
    background: transparent;
    position: relative;
}
.login-box { width: 100%; max-width: 400px; }

.mobile-logo { display: none; text-align: center; margin-bottom: 1.5rem; }
.mobile-logo img { width: 70px; height: 70px; border-radius: 1.2rem; object-fit: cover; background: #fff; padding: 3px; box-shadow: 0 8px 20px rgba(139, 92, 246, 0.15); margin: 0 auto; }
.mobile-logo h2 { font-size: 1.4rem; font-weight: 800; margin-top: 0.75rem; background: var(--grad-aurora); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.login-heading { font-size: clamp(1.4rem, 2.5vw, 1.7rem); font-weight: 800; margin-bottom: 0.2rem; color: var(--text-1); }
.login-subheading { font-size: 0.9rem; color: var(--text-3); margin-bottom: 1.5rem; font-weight: 500;}

/* Glass Card ขาวขุ่นละมุนตา */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 3vw, 2rem);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 1);
}

.field { margin-bottom: 1rem; }
.field-label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--text-2); margin-bottom: 0.4rem; }
.field-input {
    width: 100%; padding: 0.8rem 1rem; border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.7); border: 1.5px solid rgba(226, 232, 240, 0.8);
    color: var(--text-1); font-size: 0.95rem; font-family: inherit; outline: none; transition: all 0.25s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    font-weight: 500;
}
.field-input:focus { border-color: #a855f7; background: #ffffff; box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15); }
.field-input::placeholder { color: #94a3b8; font-weight: 400; }

.password-field { position: relative; }
.password-toggle { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-4); transition: 0.2s; }
.password-toggle:hover { color: var(--text-1); }

.form-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--text-3); cursor: pointer; font-weight: 500;}
.checkbox-label input { accent-color: #8b5cf6; width: 1rem; height: 1rem; cursor: pointer; }

.btn-login {
    width: 100%; padding: 0.85rem; border-radius: 0.75rem;
    background: var(--grad-btn); border: none; color: #fff; font-weight: 700; font-size: 0.95rem;
    cursor: pointer; box-shadow: 0 6px 15px rgba(139, 92, 246, 0.3); transition: all 0.3s;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.45); }

.divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(0,0,0,0.08), transparent); margin: 1.25rem 0; }

.btn-actions { display: flex; gap: 0.5rem; }
.btn-action {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.75rem; border-radius: 0.75rem; background: rgba(255,255,255,0.5); border: 1px solid rgba(0,0,0,0.05);
    color: var(--text-2); font-weight: 700; font-size: 0.85rem; text-decoration: none; transition: 0.3s;
}
.btn-action:hover { background: #ffffff; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.04); }

.error-box { margin-bottom: 1rem; padding: 0.75rem; border-radius: 0.75rem; background: #fef2f2; border: 1px solid #fecdd3; color: #e11d48; font-size: 0.85rem; text-align: center; font-weight: 600;}

/* Showcase Mini-Slider */
.showcase-card { margin-bottom: 1rem; padding: 0; background: rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,1);}
.showcase-track { display: flex; transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1); }
.showcase-slide { flex: 0 0 100%; padding: 0.85rem 1rem; display: flex; align-items: center; gap: 0.75rem; }
.showcase-icon { width: 38px; height: 38px; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.04);}
.showcase-title { font-size: 0.85rem; font-weight: 700; color: var(--text-1); }
.showcase-desc { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; font-weight: 500;}
.showcase-dots { display: flex; justify-content: center; gap: 0.35rem; padding: 0.35rem 0; }
.showcase-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(0, 0, 0, 0.1); cursor: pointer; transition: 0.3s; }
.showcase-dot.active { width: 16px; border-radius: 3px; background: #8b5cf6; }

/* Responsive Breakpoints */
@media (max-width: 992px) {
    .brand-panel { padding: 2rem; }
    .login-panel { padding: 2rem; }
    .brand-logo-text h1 { font-size: 1.5rem; }
}

/* สำหรับจอมือถือ */
@media (max-width: 768px) {
    .page-wrapper { flex-direction: column; }
    .brand-panel { display: none; }
    
    .login-panel { 
        padding: 1rem; 
        justify-content: center; 
        min-height: 100dvh; 
    }
    .mobile-logo { display: block; }
    
    .glass-card { padding: 1.25rem; }
    .showcase-card { display: none; } 
}

/* รองรับมือถือแนวนอน */
@media (max-height: 650px) {
    .showcase-card { display: none; }
    .brand-logo-row { margin-bottom: 1rem; }
    .brand-headline { font-size: 1.5rem; margin-bottom: 0.5rem; }
    .brand-desc { margin-bottom: 1rem; }
    .field { margin-bottom: 0.6rem; }
}

/* Modals & Toasts */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); border-left: 4px solid #10b981; color: #0f172a; padding: 0.8rem 1.2rem; border-radius: 0.75rem; font-size: 0.85rem; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.08); display: flex; align-items: center; gap: 0.75rem; animation: slideIn 0.3s forwards; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.modal-overlay { position: fixed; inset: 0; background: rgba(255, 255, 255, 0.4); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 2000; }
.modal-box { background: rgba(255, 255, 255, 0.95); border: 1px solid rgba(255,255,255,1); border-radius: 1.25rem; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,0.1); position: relative; }
.modal-box::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad-brand); }
.premium-gold { background: linear-gradient(135deg, #f59e0b, #fbbf24); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 700; }
.hidden { display: none !important; }
