* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(10, 51, 235, 0.15);
    width: 100%;
    max-width: 450px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.login-header {
    background: linear-gradient(135deg, #f8f8f8 0%, #e9e4ee 100%);
    color: black;
    padding: 40px 30px 30px;
    text-align: center;
    position: relative;
}

/* Logo Container */
.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.logo-icon i {
    font-size: 36px;
    color: white;
}

.logo-text-group {
    text-align: center;
}

.logo-main {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.logo-subtitle {
    font-size: 20px;
    opacity: 0.9;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.welcome-text {
    font-size: 18px;
    font-weight: 500;
    margin-top: 15px;
    opacity: 0.95;
}

.login-form {
    padding: 40px 35px 35px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px; /* Increased for mobile readability */
    transition: all 0.3s;
    outline: none;
    background: #fafafa;
    -webkit-appearance: none; /* Remove default iOS styling */
    appearance: none;
}

.form-group input:focus {
    border-color: #0a33eb;
    background: white;
    box-shadow: 0 0 0 4px rgba(10, 51, 235, 0.1);
}

.error-message {
    background: linear-gradient(135deg, #ffeded 0%, #ffeaea 100%);
    color: #d32f2f;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-size: 14px;
    border-left: 4px solid #d32f2f;
    display: <?php echo !empty($error) ? 'block' : 'none'; ?>;
}

.success-message {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-size: 14px;
    border-left: 4px solid #2e7d32;
}

.login-btn {
    background: linear-gradient(135deg, #2000B1 0%, #0a33eb 100%);
    color: white;
    border: none;
    padding: 17px;
    width: 100%;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    box-shadow: 0 6px 20px rgba(10, 51, 235, 0.3);
    letter-spacing: 0.5px;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.login-btn:hover {
    box-shadow: 0 10px 25px rgba(10, 51, 235, 0.4);
}

.login-btn:active {
    transform: translateY(-1px);
}

.login-btn:disabled {
    background: linear-gradient(135deg, #cccccc 0%, #999999 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-footer {
    text-align: center;
    padding: 25px 30px;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #666;
    background: #f9f9f9;
}

.login-footer a {
    color: #0a33eb;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.login-footer a:hover {
    color: #5102a0;
    text-decoration: underline;
}

.attempts-warning {
    background: #fff3e0;
    color: #e65100;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 10px;
    display: <?php echo ($loginAttempts > 0) ? 'flex' : 'none'; ?>;
    align-items: center;
    gap: 8px;
    border-left: 3px solid #e65100;
}

.attempts-warning i {
    font-size: 14px;
}

.password-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    z-index: 2;
}

.password-toggle:hover {
    color: #0a33eb;
}

.forgot-password {
    text-align: right;
    margin-top: 10px;
}

.forgot-password a {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s;
}

.forgot-password a:hover {
    color: #0a33eb;
}

/* ========== RESPONSIVE DESIGN - ENHANCED ========== */

/* Tablet Styles (768px and below) */
@media (max-width: 768px) {
    .login-container {
        max-width: 85%;
    }
    
    .login-header {
        padding: 35px 25px 25px;
    }
    
    .login-form {
        padding: 35px 30px 30px;
    }
    
    .logo-main {
        font-size: 26px;
    }
}

/* Mobile Large Styles (576px and below) */
@media (max-width: 576px) {
    .login-container {
        max-width: 95%;
        border-radius: 15px;
    }
    
    .login-header {
        padding: 30px 20px 25px;
    }
    
    .login-form {
        padding: 30px 20px 25px;
    }
    
    .logo-icon {
        width: 70px;
        height: 70px;
    }
    
    .logo-icon i {
        font-size: 32px;
    }
    
    .logo-main {
        font-size: 24px;
    }
    
    .logo-subtitle {
        font-size: 18px;
    }
    
    .welcome-text {
        font-size: 16px;
    }
    
    .form-group input {
        padding: 14px;
        font-size: 16px;
    }
    
    .login-btn {
        padding: 15px;
        font-size: 15px;
    }
}

/* Mobile Small Styles (480px and below) */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .login-container {
        max-width: 100%;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(10, 51, 235, 0.12);
    }
    
    .login-header {
        padding: 25px 15px 20px;
    }
    
    .logo-container {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .logo-icon {
        width: 60px;
        height: 60px;
        border-width: 2px;
    }
    
    .logo-icon i {
        font-size: 28px;
    }
    
    .logo-main {
        font-size: 22px;
    }
    
    .logo-subtitle {
        font-size: 16px;
    }
    
    .welcome-text {
        font-size: 15px;
        margin-top: 10px;
    }
    
    .login-form {
        padding: 25px 15px 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .form-group input {
        padding: 12px;
        font-size: 15px;
        border-radius: 8px;
    }
    
    .error-message,
    .success-message {
        padding: 12px;
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    .login-btn {
        padding: 14px;
        font-size: 15px;
        border-radius: 8px;
        margin-top: 5px;
    }
    
    .login-footer {
        padding: 20px 15px;
        font-size: 13px;
    }
    
    .password-toggle {
        font-size: 16px;
        right: 12px;
    }
    
    .attempts-warning {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Extra Small Mobile (375px and below) */
@media (max-width: 375px) {
    .login-header {
        padding: 20px 12px 18px;
    }
    
    .logo-icon {
        width: 50px;
        height: 50px;
    }
    
    .logo-icon i {
        font-size: 24px;
    }
    
    .logo-main {
        font-size: 20px;
    }
    
    .logo-subtitle {
        font-size: 14px;
    }
    
    .welcome-text {
        font-size: 14px;
    }
    
    .login-form {
        padding: 20px 12px 18px;
    }
    
    .form-group input {
        padding: 11px;
        font-size: 14px;
    }
    
    .login-btn {
        padding: 12px;
        font-size: 14px;
    }
    
    .login-footer {
        padding: 18px 12px;
        font-size: 12px;
    }
}

/* Landscape Mode Optimization */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        padding: 15px;
    }
    
    .login-container {
        max-width: 80%;
    }
    
    .login-header {
        padding: 20px 20px 15px;
    }
    
    .logo-container {
        flex-direction: row;
        justify-content: center;
        margin-bottom: 15px;
    }
    
    .logo-icon {
        width: 50px;
        height: 50px;
    }
    
    .logo-icon i {
        font-size: 24px;
    }
    
    .logo-main {
        font-size: 22px;
    }
    
    .logo-subtitle {
        font-size: 14px;
    }
    
    .login-form {
        padding: 20px 25px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
}

/* High DPI / Retina Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .login-container {
        border-width: 0.5px;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    /* Add if you want to support dark mode */
    body.dark-mode {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .form-group input,
    .login-btn,
    .password-toggle,
    .login-footer a {
        cursor: default;
        -webkit-tap-highlight-color: transparent;
    }
    
    .login-btn:hover {
        transform: none;
        box-shadow: 0 6px 20px rgba(10, 51, 235, 0.3);
    }
    
    .form-group input:focus {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .login-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .login-btn {
        background: #f0f0f0;
        color: black;
        box-shadow: none;
    }
}

/* Loading State for Button */
.login-btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.login-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}