/**
 * ============================================================================
 * LOGIN PAGE - PREMIUM DARK THEME
 * ============================================================================
 * 
 * Matches the logout.php premium experience with dark background,
 * glowing orbs, and floating particles
 * 
 * ============================================================================
 */

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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html {
    height: -webkit-fill-available;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   FULL-SCREEN CONTAINER
   ============================================================================ */

.login-page {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* Animated background gradient overlay */
.login-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(13, 148, 136, 0.15) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(13, 148, 136, 0.1) 0%, transparent 50%);
    animation: gradientShift 8s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes gradientShift {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Geometric background pattern - subtle V shapes echoing logo */
.login-page::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(30deg, transparent 48%, rgba(255,255,255,0.01) 49%, rgba(255,255,255,0.01) 51%, transparent 52%),
        linear-gradient(-30deg, transparent 48%, rgba(255,255,255,0.01) 49%, rgba(255,255,255,0.01) 51%, transparent 52%);
    background-size: 120px 120px;
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================================================
   MAIN CONTENT AREA
   ============================================================================ */

.login-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    position: relative;
    z-index: 10;
}

/* ============================================================================
   LOGO
   ============================================================================ */

.login-logo {
    position: absolute;
    top: 32px;
    left: 32px;
    z-index: 10;
}

.login-logo a {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #ffffff;
}

.login-logo .logo-full { height: 54px; width: auto; }


/* ============================================================================
   LOGIN CARD
   ============================================================================ */

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.login-card::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, #0d9488 0%, #14b8a6 50%, #0d9488 100%);
}

.login-card-inner {
    padding: 40px 36px 36px;
}

.login-card-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-card-title {
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.login-card-subtitle {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
}

.login-card-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #f3f4f6;
}

.login-card-footer p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #6b7280;
}

.login-card-footer p:last-child {
    margin-bottom: 0;
}

.login-card-footer a {
    color: #0d9488;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.login-card-footer a:hover {
    color: #0f766e;
    text-decoration: underline;
}

/* ============================================================================
   FORM STYLES
   ============================================================================ */

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    color: #111827;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

/* Password field */
.password-field {
    position: relative;
}

.password-field .form-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px;
    color: #9ca3af;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.password-toggle:hover {
    color: #6b7280;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-link {
    background: none;
    color: #0d9488;
    padding: 12px 12px;
    font-weight: 500;
}

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

.btn-full {
    width: 100%;
}

.auth-form-actions {
    margin-top: 24px;
}

/* ============================================================================
   ALERTS
   ============================================================================ */

.alert {
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 20px;
}

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

.alert-success {
    background: #f0fdfa;
    color: #0f766e;
    border: 1px solid #99f6e4;
    display: flex;
    align-items: center;
}

/* ============================================================================
   TRUST BROWSER OPTION
   ============================================================================ */

.trust-browser-option {
    margin: 20px 0;
    text-align: left;
}

.trust-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.trust-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0d9488;
    cursor: pointer;
    flex-shrink: 0;
}

.trust-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
}

.trust-warning svg {
    flex-shrink: 0;
    color: #d97706;
}

/* ============================================================================
   OTP / 2FA SECTION
   ============================================================================ */

.otp-section {
    text-align: center;
}

.otp-mobile-display {
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    background: #f9fafb;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    letter-spacing: 0.05em;
}

.otp-input {
    width: 100%;
    padding: 16px;
    font-size: 28px;
    font-weight: 600;
    font-family: 'Monaco', 'Consolas', monospace;
    text-align: center;
    letter-spacing: 0.3em;
    color: #111827;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    margin-bottom: 20px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.otp-input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.otp-input::placeholder {
    color: #d1d5db;
    letter-spacing: 0.2em;
}

.resend-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.resend-section p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px 0;
}

/* ============================================================================
   DECORATIVE ELEMENTS
   ============================================================================ */

/* Floating particles */
.particle {
    position: fixed;
    width: 4px;
    height: 4px;
    background: rgba(13, 148, 136, 0.4);
    border-radius: 50%;
    animation: float 15s infinite ease-in-out;
    pointer-events: none;
    z-index: 1;
}

.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 12s; }
.particle:nth-child(2) { left: 20%; top: 80%; animation-delay: 2s; animation-duration: 14s; }
.particle:nth-child(3) { left: 80%; top: 30%; animation-delay: 4s; animation-duration: 16s; }
.particle:nth-child(4) { left: 70%; top: 70%; animation-delay: 1s; animation-duration: 13s; }
.particle:nth-child(5) { left: 90%; top: 50%; animation-delay: 3s; animation-duration: 15s; }
.particle:nth-child(6) { left: 5%; top: 60%; animation-delay: 5s; animation-duration: 11s; }

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translateY(-30px) translateX(10px) scale(1.2);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-10px) translateX(-10px) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translateY(-40px) translateX(5px) scale(1.1);
        opacity: 0.5;
    }
}

/* Glowing orbs in corners */
.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: orbPulse 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

.glow-orb.top-left {
    top: -100px;
    left: -100px;
    width: 300px;
    height: 300px;
    background: #0d9488;
    animation-delay: 0s;
}

.glow-orb.bottom-right {
    bottom: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: #0d9488;
    animation-delay: 3s;
}

@keyframes orbPulse {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.1);
    }
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.login-footer {
    padding: 24px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.login-footer p {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    margin: 0;
    line-height: 1.6;
}

.login-footer p + p {
    margin-top: 12px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .particle,
    .glow-orb,
    .login-page::before,
    .spinner {
        animation: none !important;
    }
    
    .btn-primary:hover {
        transform: none;
    }
}

@media (max-width: 640px) {
    .login-main {
        padding: 24px 16px;
        justify-content: flex-start;
        padding-top: 80px;
    }
    
    .login-logo {
        top: 20px;
        left: 20px;
    }
    
    .login-logo .logo-full { height: 28px; }
    
    .login-card {
        max-width: 100%;
        border-radius: 16px;
    }
    
    .login-card-inner {
        padding: 28px 20px 24px;
    }
    
    .login-card-title {
        font-size: 22px;
    }
    
    .login-card-header {
        margin-bottom: 24px;
    }
    
    .otp-input {
        font-size: 24px;
        padding: 14px;
        letter-spacing: 0.2em;
    }
    
    .glow-orb.top-left {
        width: 200px;
        height: 200px;
    }
    
    .glow-orb.bottom-right {
        width: 250px;
        height: 250px;
    }
    
    .login-footer {
        padding: 20px 16px;
    }
    
    /* Ensure buttons have comfortable tap targets */
    .btn {
        min-height: 48px;
    }
}

/* Landscape mobile - prevent logo overlap */
@media (max-height: 600px) {
    .login-main {
        justify-content: flex-start;
        padding-top: 72px;
    }
    
    .login-card-header {
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .auth-form-actions {
        margin-top: 16px;
    }
}

/* ============================================================================
   SPINNER ANIMATION
   ============================================================================ */

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    animation: spin 1s linear infinite;
    vertical-align: middle;
}