/**
 * Login Page Styles
 * Design: "Welcoming Gateway" - Professional, trustworthy first impression
 *
 * Features:
 * - Elegant gradient background with subtle animation
 * - Refined card with depth and polish
 * - Smooth input focus states
 * - Professional typography
 */

/* =============================================================================
   Base Reset & Setup
   ============================================================================= */

:root {
    --login-primary: #2563eb;
    --login-primary-dark: #1d4ed8;
    --login-accent: #7c3aed;
    --login-surface: #ffffff;
    --login-text: #1e293b;
    --login-text-muted: #64748b;
    --login-border: #e2e8f0;
}

html {
    height: 100%;
    min-height: 100%;
}

body {
    /* Animated gradient background */
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 50%, #1e40af 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 1.5rem;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Subtle floating particles effect via pseudo-element */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.02) 0%, transparent 30%);
    pointer-events: none;
    z-index: 0;
}

/* =============================================================================
   Login Card
   ============================================================================= */

.login-card {
    background: var(--login-surface);
    border-radius: 20px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 420px;
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: cardEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* =============================================================================
   Login Header
   ============================================================================= */

.login-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 50%, #172554 100%);
    color: #ffffff;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle pattern overlay */
.login-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.login-header h3 {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
    position: relative;
}

.login-header p {
    font-size: 0.875rem;
    opacity: 0.85;
    margin: 0.5rem 0 0;
    font-weight: 400;
    position: relative;
}

.login-logo {
    width: 100px;
    max-width: 100px;
    height: auto;
    display: block;
    margin: 0 auto 1rem;
    position: relative;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

/* =============================================================================
   Login Body / Form
   ============================================================================= */

.login-body {
    padding: 2rem;
    color: var(--login-text);
}

/* Form Labels */
.login-body .form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--login-text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-body .form-label i {
    color: var(--login-primary);
    font-size: 0.9375rem;
}

/* Form Inputs */
.login-body .form-control {
    border: 2px solid var(--login-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8fafc;
}

.login-body .form-control:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.login-body .form-control:focus {
    border-color: var(--login-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.login-body .form-control::placeholder {
    color: #94a3b8;
}

/* Remember Me Checkbox */
.login-body .form-check {
    padding-left: 1.75rem;
}

.login-body .form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    border: 2px solid var(--login-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.login-body .form-check-input:checked {
    background-color: var(--login-primary);
    border-color: var(--login-primary);
}

.login-body .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-body .form-check-label {
    color: var(--login-text-muted);
    font-size: 0.875rem;
    cursor: pointer;
}

/* =============================================================================
   Login Button
   ============================================================================= */

.btn-login {
    background: linear-gradient(135deg, var(--login-primary) 0%, var(--login-accent) 100%);
    border: none;
    color: #ffffff;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--login-primary-dark) 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
    color: #ffffff;
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-login i {
    font-size: 1rem;
}

/* Grid fallback for older browsers */
.d-grid {
    display: block;
}

.d-grid .btn {
    width: 100%;
    display: flex;
}

/* =============================================================================
   Alerts
   ============================================================================= */

.login-body .alert {
    border-radius: 10px;
    border: none;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.login-body .alert-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #b91c1c;
}

.login-body .alert-danger .btn-close {
    filter: brightness(0.5);
}

.login-body .alert-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
}

.login-body .alert-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
}

/* =============================================================================
   Dark Mode Support
   ============================================================================= */

:is([data-theme="dark"], .dark-mode) {
    --login-surface: #1e293b;
    --login-text: #f1f5f9;
    --login-text-muted: #94a3b8;
    --login-border: #334155;
}

:is([data-theme="dark"], .dark-mode) body {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    background-size: 400% 400%;
}

:is([data-theme="dark"], .dark-mode) .login-card {
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

:is([data-theme="dark"], .dark-mode) .login-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

:is([data-theme="dark"], .dark-mode) .login-body .form-control {
    background: #0f172a;
    border-color: var(--login-border);
    color: var(--login-text);
}

:is([data-theme="dark"], .dark-mode) .login-body .form-control:hover {
    border-color: #475569;
    background: #1e293b;
}

:is([data-theme="dark"], .dark-mode) .login-body .form-control:focus {
    background: #1e293b;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

:is([data-theme="dark"], .dark-mode) .login-body .form-control::placeholder {
    color: #64748b;
}

:is([data-theme="dark"], .dark-mode) .login-body .form-check-input {
    background-color: #0f172a;
    border-color: var(--login-border);
}

:is([data-theme="dark"], .dark-mode) .login-body .form-check-input:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

:is([data-theme="dark"], .dark-mode) .btn-login {
    background: linear-gradient(135deg, #3b82f6 0%, #7c3aed 100%);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

:is([data-theme="dark"], .dark-mode) .btn-login:hover {
    background: linear-gradient(135deg, #2563eb 0%, #6d28d9 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

:is([data-theme="dark"], .dark-mode) .login-body .alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: #fca5a5;
}

:is([data-theme="dark"], .dark-mode) .login-body .alert-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.1) 100%);
    color: #86efac;
}

:is([data-theme="dark"], .dark-mode) .login-body .alert-warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(251, 191, 36, 0.1) 100%);
    color: #fcd34d;
}

:is([data-theme="dark"], .dark-mode) .login-body .form-label {
    color: var(--login-text);
}

:is([data-theme="dark"], .dark-mode) .login-body .form-label i {
    color: #60a5fa;
}

:is([data-theme="dark"], .dark-mode) .login-body .form-check-label {
    color: var(--login-text-muted);
}

:is([data-theme="dark"], .dark-mode) .login-body .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* =============================================================================
   Responsive Adjustments
   ============================================================================= */

@media (max-width: 480px) {
    body {
        padding: 1rem;
    }

    .login-card {
        border-radius: 16px;
    }

    .login-header {
        padding: 2rem 1.5rem 1.5rem;
    }

    .login-header h3 {
        font-size: 1.25rem;
    }

    .login-logo {
        width: 80px;
    }

    .login-body {
        padding: 1.5rem;
    }

    .btn-login {
        padding: 0.75rem 1rem;
    }
}

/* =============================================================================
   Reduced Motion Support
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
        background-size: 100% 100%;
    }

    .login-card {
        animation: none;
    }

    .btn-login {
        transition: none;
    }
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
    body {
        background: #ffffff;
    }

    .login-card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
