/* ===================================
   LOGIN PAGE STYLES
   Modern, Secure & Beautiful Design
   =================================== */

/* ===== VARIABLES ===== */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --background-primary: #f8fafc;
    --background-secondary: #ffffff;
    --border-color: #e5e7eb;
    --border-focus: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.3s ease;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

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

.floating-element {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float var(--duration, 20s) infinite linear;
    opacity: 0.7;
}

.floating-element:nth-child(1) {
    top: 10%;
    left: 10%;
    width: 80px;
    height: 80px;
}

.floating-element:nth-child(2) {
    top: 70%;
    right: 10%;
    width: 100px;
    height: 100px;
}

.floating-element:nth-child(3) {
    bottom: 20%;
    left: 20%;
    width: 120px;
    height: 120px;
}

.floating-element:nth-child(4) {
    top: 30%;
    right: 30%;
    width: 90px;
    height: 90px;
}

@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.3;
    }
    100% {
        transform: translateY(0px) rotate(360deg);
        opacity: 0.7;
    }
}

/* ===== LOGIN CONTAINER ===== */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--background-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== LOGIN HEADER ===== */
.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    padding: 40px 30px;
    text-align: center;
    color: white;
    position: relative;
}

.login-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.logo i {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* ===== LOGIN FORM ===== */
.login-form-container {
    padding: 40px 30px;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

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

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label i {
    color: var(--primary-color);
    font-size: 0.875rem;
    width: 16px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px; /* 16px to prevent zoom on mobile */
    transition: var(--transition);
    background: var(--background-secondary);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Mobile App-Style Optimizations */
@media (max-width: 768px) {
    body {
        padding: 16px;
        background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    }
    
    .login-card {
        border-radius: 24px;
        padding: 32px 24px;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .form-control {
        font-size: 16px; /* Ensure 16px on mobile to prevent zoom */
        padding: 16px;
        border-radius: 12px;
        border: 2px solid rgba(255, 255, 255, 0.1);
        background: rgba(255, 255, 255, 0.95);
        -webkit-appearance: none;
        -webkit-border-radius: 12px;
    }
    
    .form-control:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        transform: none; /* Prevent any transform that might cause zoom */
    }
    
    .login-btn {
        padding: 16px;
        font-size: 16px;
        border-radius: 12px;
        -webkit-appearance: none;
    }
    
    /* Prevent zoom on input focus */
    input[type="email"],
    input[type="password"],
    input[type="text"],
    textarea,
    select {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
}

/* ===== PASSWORD INPUT ===== */
.password-input-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

/* ===== FORM OPTIONS ===== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 0.875rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    position: relative;
    transition: var(--transition);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

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

/* ===== LOGIN BUTTON ===== */
.login-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.login-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), #1e40af);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert i {
    font-size: 1rem;
}

/* ===== LOGIN FOOTER ===== */
.login-footer {
    background: var(--background-primary);
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .login-card {
        border-radius: var(--radius-lg);
    }
    
    .login-header {
        padding: 30px 20px;
    }
    
    .logo h1 {
        font-size: 1.75rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .login-form-container {
        padding: 30px 20px;
    }
    
    .login-footer {
        padding: 15px 20px;
    }
    
    .form-options {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

@media (max-width: 360px) {
    .login-header {
        padding: 25px 15px;
    }
    
    .login-form-container {
        padding: 25px 15px;
    }
    
    .form-control {
        padding: 12px 14px;
    }
    
    .login-btn {
        padding: 12px 18px;
    }
}

/* ===== LOADING ANIMATION ===== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* ===== FOCUS STYLES ===== */
.form-control:focus,
.login-btn:focus,
.password-toggle:focus,
.checkbox-container:focus-within,
.forgot-password:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-muted: #333333;
    }
    
    .form-control {
        border-width: 3px;
    }
    
    .login-btn {
        border: 2px solid var(--primary-dark);
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating-element {
        animation: none;
    }
}
