/* ===================================
   CSS VARIABLES & RESET
   =================================== */
:root {
    /* Brand Colors - Based on App Logo */
    --brand-primary: #1e3a8a;        /* Deep Blue */
    --brand-primary-dark: #1e293b;   /* Darker Blue */
    --brand-primary-light: #3b82f6;  /* Bright Blue */
    --brand-secondary: #0ea5e9;      /* Sky Blue */
    --brand-accent: #06b6d4;         /* Cyan */
    --brand-gold: #f59e0b;           /* Gold/Amber */
    
    /* Semantic Colors */
    --primary-color: var(--brand-primary);
    --primary-dark: var(--brand-primary-dark);
    --primary-light: var(--brand-primary-light);
    --secondary-color: var(--brand-secondary);
    --accent-color: var(--brand-accent);
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: var(--brand-gold);
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --text-on-primary: #ffffff;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-gradient-start: var(--brand-primary);
    --bg-gradient-end: var(--brand-secondary);
    
    /* Border & Shadow */
    --border-color: #e2e8f0;
    --border-focus: var(--brand-primary-light);
    --shadow-sm: 0 1px 2px 0 rgba(30, 58, 138, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(30, 58, 138, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(30, 58, 138, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(30, 58, 138, 0.15);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
    
    /* Layout */
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition-speed: 0.3s;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ===================================
   BACKGROUND ANIMATION
   =================================== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 300px;
    height: 300px;
    top: -150px;
    left: -150px;
    animation-delay: 0s;
}

.circle-2 {
    width: 400px;
    height: 400px;
    bottom: -200px;
    right: -200px;
    animation-delay: 5s;
}

.circle-3 {
    width: 250px;
    height: 250px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.1;
    }
    50% {
        transform: translate(50px, 50px) scale(1.1);
        opacity: 0.2;
    }
}

/* ===================================
   LOGIN CONTAINER
   =================================== */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   LOGIN CARD
   =================================== */
.login-card {
    background: var(--bg-primary);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: var(--shadow-xl), 0 0 60px rgba(30, 58, 138, 0.2);
    backdrop-filter: blur(10px);
    transition: transform var(--transition-speed) var(--transition-smooth), box-shadow var(--transition-speed) var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px -12px rgba(30, 58, 138, 0.3), var(--shadow-glow);
}

/* ===================================
   LOGO SECTION
   =================================== */
.logo-section {
    text-align: center;
    margin-bottom: 36px;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    width: 120px;
    height: 120px;
    margin-bottom: 16px;
    animation: logoEntrance 1s ease-out;
    transition: transform var(--transition-speed) var(--transition-smooth);
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(30, 58, 138, 0.15));
}

.logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 8px 20px rgba(59, 130, 246, 0.25));
}

@keyframes logoEntrance {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.company-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.welcome-text {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===================================
   ALERT BOX
   =================================== */
.alert-box {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    animation: slideInDown 0.4s ease-out;
}

.alert-box.show {
    display: flex;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-alert {
    background-color: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ===================================
   FORM STYLES
   =================================== */
.login-form {
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

.input-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--text-light);
    pointer-events: none;
    transition: color var(--transition-speed);
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-speed);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    background-color: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12), var(--shadow-glow);
}

.form-input:focus + .toggle-password,
.form-input:focus ~ .input-icon {
    color: var(--brand-primary-light);
}

.form-input.error {
    border-color: var(--error-color);
    background-color: #fef2f2;
}

.form-input.error:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: color var(--transition-speed);
}

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

.eye-icon {
    width: 20px;
    height: 20px;
}

.error-message {
    display: block;
    color: var(--error-color);
    font-size: 13px;
    margin-top: 6px;
    min-height: 18px;
    font-weight: 500;
}

/* ===================================
   FORM OPTIONS
   =================================== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    position: relative;
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    display: none;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom::after {
    display: block;
}

.checkbox-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.forgot-password {
    font-size: 14px;
    color: var(--brand-primary-light);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-speed);
}

.forgot-password:hover {
    color: var(--brand-primary-dark);
    text-decoration: underline;
}

/* ===================================
   LOGIN BUTTON
   =================================== */
.login-button {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-on-primary);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed) var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.4), var(--shadow-glow);
}

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

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.5), 0 0 30px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, var(--brand-primary-light), var(--brand-accent));
}

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

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.button-text {
    transition: opacity var(--transition-speed);
}

.login-button.loading .button-text {
    opacity: 0;
}

/* ===================================
   LOADING SPINNER
   =================================== */
.spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.login-button.loading .spinner {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ===================================
   FOOTER
   =================================== */
.login-footer {
    margin-top: 32px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    font-size: 13px;
    color: var(--text-light);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
    .login-container {
        max-width: 100%;
        padding: 16px;
    }
    
    .login-card {
        padding: 36px 24px;
        border-radius: 20px;
    }
    
    .logo {
        width: 100px;
        height: 100px;
    }
    
    .company-name {
        font-size: 24px;
    }
    
    .welcome-text {
        font-size: 14px;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px 20px;
    }
    
    .logo {
        width: 90px;
        height: 90px;
    }
    
    .company-name {
        font-size: 22px;
    }
    
    .form-input {
        padding: 12px 16px 12px 44px;
        font-size: 14px;
    }
    
    .login-button {
        padding: 14px;
        font-size: 15px;
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.login-button:focus-visible,
.form-input:focus-visible,
.toggle-password:focus-visible,
.forgot-password:focus-visible {
    outline: 2px solid var(--brand-primary-light);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════
   CINEMATIC LOGIN ENHANCEMENTS v2.0
   Premium visual upgrades matching the
   glassmorphism dashboard design system
   ═══════════════════════════════════════ */

/* ── Animated mesh-gradient background ── */
body {
    background:
        radial-gradient(ellipse at 15% 20%, rgba(59,130,246,0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 80%, rgba(14,165,233,0.15) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(99,102,241,0.08) 0%, transparent 70%),
        linear-gradient(135deg, #0f172a 0%, #1e3a8a 45%, #0c4a6e 100%);
    background-attachment: fixed;
}

/* ── Premium floating orbs (replaces old circles) ── */
.circle {
    background: none;
    border: none;
}
.circle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%,
        rgba(59, 130, 246, 0.25) 0%,
        rgba(30, 58, 138, 0.1) 50%,
        transparent 70%
    );
    animation: orbPulse 8s ease-in-out infinite;
}
.circle-1::before { animation-delay: 0s;  animation-duration: 12s; }
.circle-2::before { animation-delay: 4s;  animation-duration: 16s; background: radial-gradient(circle at 60% 60%, rgba(14,165,233,0.2) 0%, transparent 70%); }
.circle-3::before { animation-delay: 8s;  animation-duration: 10s; background: radial-gradient(circle at 50% 50%, rgba(99,102,241,0.15) 0%, transparent 70%); }

@keyframes orbPulse {
    0%, 100% { transform: scale(1) rotate(0deg);   opacity: 0.6; }
    33%       { transform: scale(1.15) rotate(8deg); opacity: 1;   }
    66%       { transform: scale(0.9) rotate(-5deg); opacity: 0.4; }
}

/* ── Glassmorphism login card upgrade ── */
.login-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 0 0 1px rgba(59,130,246,0.08),
        0 8px 32px rgba(30, 58, 138, 0.18),
        0 40px 80px rgba(30, 58, 138, 0.12),
        inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
    overflow: hidden;
}

/* Shimmer sweep on card load */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(
        105deg,
        transparent 35%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 65%
    );
    animation: cardShimmer 2.2s ease-out 0.4s forwards;
    pointer-events: none;
    z-index: 0;
}
@keyframes cardShimmer {
    from { left: -100%; }
    to   { left: 160%;  }
}

/* Gold accent top strip */
.login-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1e3a8a 0%, #3b82f6 40%, #f59e0b 70%, #0ea5e9 100%);
    background-size: 200% 100%;
    animation: gradientShift 4s linear infinite;
}
@keyframes gradientShift {
    0%   { background-position: 0%   50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0%   50%; }
}

/* Ensure child elements sit above shimmer */
.login-card > * { position: relative; z-index: 1; }

/* ── Glass input fields ── */
.form-input {
    background: rgba(248, 250, 252, 0.85);
    border: 1.5px solid rgba(203, 213, 225, 0.8);
    backdrop-filter: blur(4px);
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        background 0.25s ease;
}
.form-input:focus {
    border-color: var(--brand-primary-light);
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.12),
        0 2px 8px rgba(30, 58, 138, 0.08);
}
.form-input:hover:not(:focus) {
    border-color: rgba(148, 163, 184, 0.9);
    background: rgba(255,255,255,0.95);
}

/* ── Premium login button ── */
.login-button {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 40%, #0ea5e9 100%);
    background-size: 200% 200%;
    transition:
        background-position 0.4s ease,
        box-shadow 0.3s ease,
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light-beam scan on hover */
.login-button::before {
    content: '';
    position: absolute;
    top: 0; left: -75%;
    width: 50%; height: 100%;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255,255,255,0.3) 50%,
        transparent 70%
    );
    transform: skewX(-15deg);
    transition: left 0s;
    pointer-events: none;
}
.login-button:hover::before {
    left: 125%;
    transition: left 0.55s ease;
}
.login-button:hover {
    background-position: 100% 0;
    box-shadow: 0 8px 24px rgba(30,58,138,0.35), 0 0 0 4px rgba(59,130,246,0.15);
    transform: translateY(-2px);
}
.login-button:active {
    transform: scale(0.98) translateY(0);
    box-shadow: 0 4px 12px rgba(30,58,138,0.25);
}

/* ── Company name gradient text ── */
.company-name {
    background: linear-gradient(135deg, #1e3a8a 0%, #0ea5e9 60%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 2px rgba(30, 58, 138, 0.15));
}

/* ── Tagline subtle fade-in ── */
.tagline {
    animation: fadeInUp 1s ease-out 0.3s both;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Form groups appear sequentially ── */
.form-group:nth-child(1) { animation: fadeInUp 0.6s ease-out 0.5s both; }
.form-group:nth-child(2) { animation: fadeInUp 0.6s ease-out 0.65s both; }
.form-group:nth-child(3) { animation: fadeInUp 0.6s ease-out 0.8s both; }
.login-button            { animation: fadeInUp 0.6s ease-out 0.95s both; }
.login-footer            { animation: fadeInUp 0.6s ease-out 1.1s both; }

/* ── Error message pulse ── */
.error-message.visible {
    animation: errorShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes errorShake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px);  }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px);  }
}

/* ── Loading spinner inside button ── */
.login-button .spinner {
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
