/* ============================================
   LOGIN PAGE - Professional Refined Design
   Aesthetic: Corporate Elegance with Depth
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Deep Corporate Blues with Warm Accents */
    --primary-900: #0a1628;
    --primary-800: #1a2744;
    --primary-700: #243b5e;
    --primary-600: #2d4a73;
    --primary-500: #3d5a80;
    --accent-gold: #d4a853;
    --accent-gold-light: #e8c77b;
    --accent-copper: #c17f59;
    --surface-light: #f8fafc;
    --surface-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-subtle: rgba(148, 163, 184, 0.2);
    --shadow-color: rgba(10, 22, 40, 0.08);
    --success-green: #10b981;
    --error-red: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--primary-900);
    position: relative;
    overflow: hidden;
}

/* Animated Background with Mesh Gradient */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(61, 90, 128, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(212, 168, 83, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 100% 80% at 50% 100%, rgba(45, 74, 115, 0.5) 0%, transparent 60%);
    animation: meshFloat 20s ease-in-out infinite;
}

@keyframes meshFloat {
    0%, 100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.05) translateY(-20px);
        opacity: 0.9;
    }
}

/* Subtle geometric pattern overlay */
body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(45deg, transparent 48%, rgba(255,255,255,0.02) 49%, rgba(255,255,255,0.02) 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(255,255,255,0.02) 49%, rgba(255,255,255,0.02) 51%, transparent 52%);
    background-size: 60px 60px;
    pointer-events: none;
}

/* Login Container */
.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Card */
.login-card {
    background: var(--surface-card);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow:
        0 4px 6px -1px var(--shadow-color),
        0 10px 15px -3px var(--shadow-color),
        0 25px 50px -12px rgba(10, 22, 40, 0.25);
    position: relative;
    overflow: hidden;
}

/* Decorative accent line at top */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 40px;
    right: 40px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-copper), var(--accent-gold));
    border-radius: 0 0 4px 4px;
}

/* Logo Section */
.logo-section {
    text-align: center;
    margin-bottom: 36px;
}

.logo-main {
    max-width: 180px;
    height: auto;
    margin-bottom: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.logo-main:hover {
    transform: scale(1.02);
}

.logo-secondary {
    max-width: 140px;
    height: auto;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.logo-secondary:hover {
    opacity: 1;
}

/* Welcome Text */
.welcome-text {
    text-align: center;
    margin-bottom: 32px;
}

.welcome-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.welcome-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Alert Messages */
.alert-container {
    margin-bottom: 24px;
}

.alert-custom {
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    border: 1px solid #fbbf24;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: slideIn 0.4s ease-out;
}

.alert-custom.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: var(--error-red);
}

.alert-custom.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: var(--success-green);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-custom strong {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.alert-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-close:hover {
    background: rgba(0,0,0,0.1);
    color: var(--text-primary);
}

/* Form Styling */
.form-signin {
    width: 100%;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 16px 18px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface-light);
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    transition: all 0.3s ease;
    outline: none;
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-field:hover {
    border-color: rgba(61, 90, 128, 0.3);
}

.input-field:focus {
    border-color: var(--primary-500);
    background: white;
    box-shadow: 0 0 0 4px rgba(61, 90, 128, 0.1);
}

/* Password field with toggle */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper .input-field {
    width: 100%;
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: var(--text-secondary);
}

/* Remember Me & Forgot Password Row */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.checkbox-custom:checked {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.checkbox-custom:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    user-select: none;
}

.forgot-link {
    font-size: 0.875rem;
    color: var(--primary-500);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.forgot-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* Primary Submit Button */
.btn-submit {
    width: 100%;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(26, 39, 68, 0.3);
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 39, 68, 0.4);
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:active {
    transform: translateY(0);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    gap: 16px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.divider-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

/* Social Login Buttons */
.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-social {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-google {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-subtle);
}

.btn-google:hover {
    background: var(--surface-light);
    border-color: rgba(66, 133, 244, 0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.btn-google img {
    width: 20px;
    height: 20px;
}

.btn-microsoft {
    background: #2f2f2f;
    color: white;
    border: 2px solid #2f2f2f;
}

.btn-microsoft:hover {
    background: #404040;
    border-color: #404040;
    transform: translateY(-1px);
}

.btn-microsoft img {
    width: 20px;
    height: 20px;
}

/* Footer Text */
.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.footer-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-link {
    color: var(--primary-500);
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Floating decorative elements */
.decoration {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

.decoration-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.1) 0%, transparent 70%);
    top: -150px;
    right: -100px;
    animation: floatSlow 15s ease-in-out infinite;
}

.decoration-2 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(61, 90, 128, 0.15) 0%, transparent 70%);
    bottom: -100px;
    left: -50px;
    animation: floatSlow 12s ease-in-out infinite reverse;
}

@keyframes floatSlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, -20px); }
}

/* Responsive Design */
@media (max-width: 480px) {
    .login-container {
        padding: 16px;
    }

    .login-card {
        padding: 36px 24px;
        border-radius: 20px;
    }

    .login-card::before {
        left: 24px;
        right: 24px;
    }

    .welcome-title {
        font-size: 1.5rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .logo-main {
        max-width: 140px;
    }

    .logo-secondary {
        max-width: 120px;
    }
}

/* Page Icon (for recovery and 2FA pages) */
.page-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.page-icon svg {
    color: var(--primary-500);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

/* Back Link */
.back-link {
    text-align: center;
    margin-top: 24px;
}

.back-link .forgot-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Security badge */
.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 20px;
}

.security-badge svg {
    width: 14px;
    height: 14px;
}

/* Loading state for button */
.btn-submit.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-submit.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
