/* ========================================
   SAL Login Page — Theme & Design System
   ======================================== */

/* Fonts */
@font-face {
    font-family: 'Graphik Arabic';
    src: url('fonts/GraphikArabic-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Graphik Arabic';
    src: url('fonts/GraphikArabic-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Graphik Arabic';
    src: url('fonts/GraphikArabic-Semibold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Graphik Arabic';
    src: url('fonts/GraphikArabic-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ---- Light Theme ---- */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f8fa;
    --bg-form: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-focus: #EA0029;
    --input-bg: #f9fafb;
    --input-bg-focus: #ffffff;
    --shadow-soft: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-medium: 0 4px 25px rgba(0,0,0,0.08);
    --shadow-strong: 0 20px 60px rgba(0,0,0,0.12);
    --primary: #EA0029;
    --primary-hover: #c80023;
    --primary-glow: rgba(234, 0, 41, 0.15);
    --primary-soft: rgba(234, 0, 41, 0.08);
    --brand-bg: linear-gradient(135deg, #192444 0%, #0f172a 50%, #1e293b 100%);
    --brand-overlay: linear-gradient(180deg, rgba(25, 36, 68, 0.4) 0%, rgba(15, 23, 42, 0.85) 100%);
    --toggle-bg: #e5e7eb;
    --toggle-thumb: #ffffff;
    --social-bg: #ffffff;
    --social-border: #e5e7eb;
    --social-hover: #f3f4f6;
    --divider-color: #e5e7eb;
    --checkbox-bg: #ffffff;
    --error-color: #EA0029;
    --success-color: #10b981;
    --particle-color: rgba(234, 0, 41, 0.06);
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-form: #14141e;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --border-focus: #EA0029;
    --input-bg: #1a1a28;
    --input-bg-focus: #1e1e2e;
    --shadow-soft: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-medium: 0 4px 25px rgba(0,0,0,0.3);
    --shadow-strong: 0 20px 60px rgba(0,0,0,0.5);
    --primary: #EA0029;
    --primary-hover: #ff1a3d;
    --primary-glow: rgba(234, 0, 41, 0.25);
    --primary-soft: rgba(234, 0, 41, 0.12);
    --brand-bg: linear-gradient(135deg, #0f172a 0%, #020617 50%, #0c1222 100%);
    --brand-overlay: linear-gradient(180deg, rgba(10, 10, 15, 0.3) 0%, rgba(2, 6, 23, 0.9) 100%);
    --toggle-bg: #334155;
    --toggle-thumb: #f1f5f9;
    --social-bg: #1a1a28;
    --social-border: #1e293b;
    --social-hover: #252538;
    --divider-color: #1e293b;
    --checkbox-bg: #1a1a28;
    --error-color: #f87171;
    --success-color: #34d399;
    --particle-color: rgba(234, 0, 41, 0.08);
}


/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Graphik Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    height: 100%;
    overflow: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-hover);
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input {
    font-family: inherit;
}


/* ========================================
   Background Particles
   ======================================== */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particles span {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--particle-color);
    border-radius: 50%;
    animation: particleFloat 20s infinite ease-in-out;
}

.bg-particles span:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 22s; width: 8px; height: 8px; }
.bg-particles span:nth-child(2) { left: 25%; top: 60%; animation-delay: 2s; animation-duration: 18s; }
.bg-particles span:nth-child(3) { left: 50%; top: 10%; animation-delay: 4s; animation-duration: 25s; width: 10px; height: 10px; }
.bg-particles span:nth-child(4) { left: 70%; top: 80%; animation-delay: 1s; animation-duration: 20s; }
.bg-particles span:nth-child(5) { left: 85%; top: 30%; animation-delay: 3s; animation-duration: 24s; width: 5px; height: 5px; }
.bg-particles span:nth-child(6) { left: 15%; top: 85%; animation-delay: 5s; animation-duration: 19s; width: 7px; height: 7px; }
.bg-particles span:nth-child(7) { left: 40%; top: 45%; animation-delay: 7s; animation-duration: 23s; }
.bg-particles span:nth-child(8) { left: 60%; top: 5%; animation-delay: 6s; animation-duration: 21s; width: 9px; height: 9px; }
.bg-particles span:nth-child(9) { left: 90%; top: 55%; animation-delay: 8s; animation-duration: 17s; }
.bg-particles span:nth-child(10) { left: 5%; top: 40%; animation-delay: 9s; animation-duration: 26s; width: 4px; height: 4px; }

@keyframes particleFloat {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.4; }
    25% { transform: translate(30px, -50px) scale(1.3); opacity: 0.7; }
    50% { transform: translate(-20px, -100px) scale(0.8); opacity: 0.3; }
    75% { transform: translate(40px, -30px) scale(1.1); opacity: 0.6; }
}


/* ========================================
   Login Wrapper — Split layout
   ======================================== */
.login-wrapper {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}


/* ========================================
   Brand Panel (Left)
   ======================================== */
.brand-panel {
    flex: 0 0 45%;
    position: relative;
    background: var(--brand-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('images/homepage-bg.jpg') center/cover no-repeat;
    opacity: 0.2;
    transition: opacity 0.5s ease;
}

[data-theme="dark"] .brand-panel::before {
    background-image: url('images/homepage-bg-dark.jpg');
    opacity: 0.15;
}

.brand-overlay {
    position: absolute;
    inset: 0;
    background: var(--brand-overlay);
    z-index: 1;
}

.brand-content {
    position: relative;
    z-index: 2;
    padding: 60px;
    max-width: 520px;
    animation: fadeInUp 0.8s ease-out;
}

.brand-logo {
    margin-bottom: 40px;
}

.brand-logo svg {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.brand-title {
    font-size: 40px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.brand-tagline {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
    margin-bottom: 50px;
}

/* Stats bar */
.brand-stats {
    display: flex;
    gap: 40px;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #EA0029;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

/* Animated accent line on brand panel */
.brand-panel::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, transparent, #EA0029, transparent);
    z-index: 3;
    animation: accentPulse 3s ease-in-out infinite;
}

@keyframes accentPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}


/* ========================================
   Form Panel (Right)
   ======================================== */
.form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg-primary);
    position: relative;
    transition: background 0.4s ease;
    overflow: hidden;
}

/* Background image on form panel */
.form-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('images/homepage-bg.jpg') center/cover no-repeat;
    opacity: 0.04;
    transition: opacity 0.5s ease;
    z-index: 0;
}

[data-theme="dark"] .form-panel::before {
    background-image: url('images/homepage-bg-dark.jpg');
    opacity: 0.08;
}

/* Gradient overlay so form stays readable */
.form-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, var(--bg-primary) 40%, transparent 100%);
    z-index: 0;
}

.form-container {
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
    position: relative;
    z-index: 1;
}


/* ========================================
   Theme Toggle
   ======================================== */
.theme-toggle {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 10;
    padding: 0;
}

.toggle-track {
    width: 52px;
    height: 28px;
    background: var(--toggle-bg);
    border-radius: 14px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    transition: background 0.3s ease;
}

.toggle-thumb {
    position: absolute;
    left: 3px;
    width: 22px;
    height: 22px;
    background: var(--toggle-thumb);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    z-index: 1;
}

[data-theme="dark"] .toggle-thumb {
    transform: translateX(24px);
}

.icon-sun, .icon-moon {
    position: relative;
    z-index: 0;
    transition: opacity 0.3s ease;
}

.icon-sun { color: #f59e0b; }
.icon-moon { color: #94a3b8; }

[data-theme="light"] .icon-moon { opacity: 0.4; }
[data-theme="dark"] .icon-sun { opacity: 0.4; }


/* ========================================
   Form Logo (Red SAL Logo above form)
   ======================================== */
.form-logo {
    display: block;
    margin-bottom: 36px;
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    z-index: 5;
}

.form-logo svg {
    display: block;
    width: 140px;
    height: auto;
    max-width: 100%;
    filter: drop-shadow(0 4px 16px rgba(234, 0, 41, 0.25));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.form-logo svg:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 24px rgba(234, 0, 41, 0.35));
}

/* Decorative accent line under logo */
.form-logo::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #EA0029, rgba(234, 0, 41, 0.2));
    border-radius: 3px;
    margin-top: 20px;
}


/* ========================================
   Form Header
   ======================================== */
.form-header {
    margin-bottom: 36px;
}

.form-header h2 {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    transition: color 0.4s ease;
}

.form-header p {
    font-size: 15px;
    color: var(--text-secondary);
    transition: color 0.4s ease;
}


/* ========================================
   Form Groups
   ======================================== */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: color 0.4s ease;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    transition: color 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    height: 50px;
    padding: 0 48px 0 44px;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--input-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
    color: var(--primary);
}

/* When input is focused, color the sibling icon */
.form-group:focus-within .input-icon {
    color: var(--primary);
}

/* Error state */
.form-group.error .input-wrapper input {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(234, 0, 41, 0.1);
}

.form-group.error .input-icon {
    color: var(--error-color);
}

.error-text {
    display: block;
    font-size: 12px;
    color: var(--error-color);
    margin-top: 6px;
    min-height: 16px;
    transition: all 0.3s ease;
}


/* ========================================
   Password Toggle
   ======================================== */
.password-toggle {
    position: absolute;
    right: 14px;
    padding: 4px;
    color: var(--text-muted);
    transition: color 0.3s ease;
    z-index: 1;
}

.password-toggle:hover {
    color: var(--text-primary);
}


/* ========================================
   Form Options (Remember + Forgot)
   ======================================== */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

/* Custom checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    user-select: none;
    transition: color 0.3s ease;
}

.checkbox-wrapper input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 5px;
    background: var(--checkbox-bg);
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.checkbox-wrapper input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-wrapper input:checked + .checkmark::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
}

.forgot-link:hover {
    text-decoration: underline;
}


/* ========================================
   Login Button
   ======================================== */
.btn-login {
    width: 100%;
    height: 52px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.6s ease;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(234, 0, 41, 0.35);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(234, 0, 41, 0.25);
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-arrow {
    transition: transform 0.3s ease;
}

.btn-login:hover .btn-arrow {
    transform: translateX(4px);
}

/* Loader dots */
.btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-loader span {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    animation: loaderBounce 1.2s infinite ease-in-out;
}

.btn-loader span:nth-child(2) { animation-delay: 0.15s; }
.btn-loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes loaderBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}


/* ========================================
   Divider
   ======================================== */
.divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--divider-color);
    transition: background 0.4s ease;
}

.divider span {
    padding: 0 16px;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: color 0.4s ease;
}


/* ========================================
   Social Login
   ======================================== */
.social-login {
    display: flex;
    gap: 14px;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    background: var(--social-bg);
    border: 1.5px solid var(--social-border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.social-btn:hover {
    background: var(--social-hover);
    border-color: var(--text-muted);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}


/* ========================================
   Sign-up Text
   ======================================== */
.signup-text {
    text-align: center;
    margin-top: 28px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.4s ease;
}

.signup-text a {
    font-weight: 600;
}


/* ========================================
   Footer Links
   ======================================== */
.footer-links {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--divider-color);
    transition: border-color 0.4s ease;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-links .separator {
    color: var(--text-muted);
    margin: 0 10px;
    font-size: 12px;
}


/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.form-group.shake {
    animation: shake 0.5s ease-in-out;
}


/* ========================================
   Responsive Design
   ======================================== */

/* Tablets and below */
@media (max-width: 1024px) {
    .brand-panel {
        flex: 0 0 40%;
    }

    .brand-content {
        padding: 40px;
    }

    .brand-title {
        font-size: 32px;
    }

    .stat-number {
        font-size: 26px;
    }
}

/* Mobile — hide brand panel */
@media (max-width: 768px) {
    .login-wrapper {
        flex-direction: column;
    }

    .brand-panel {
        display: none;
    }

    .form-panel {
        padding: 30px 24px;
        align-items: flex-start;
        padding-top: 60px;
        overflow-y: auto;
    }

    .form-container {
        max-width: 100%;
    }

    .form-logo {
        display: block;
    }

    .theme-toggle {
        top: 20px;
        right: 20px;
    }

    .form-header h2 {
        font-size: 26px;
    }

    .brand-stats {
        display: none;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .form-panel {
        padding: 20px 16px;
        padding-top: 50px;
    }

    .social-login {
        flex-direction: column;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
