/*
 * Mobile-Optimized Login Page (v526)
 * Matches mobile dashboard styling with purple gradient
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ==================== HEADER ==================== */
.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: max(env(safe-area-inset-top), 40px) 20px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo-container {
    text-align: center;
    animation: fadeInDown 0.6s ease-out;
}

.logo-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: bounceIn 0.8s ease-out;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

/* ==================== CONTENT ==================== */
.login-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    animation: fadeIn 0.8s ease-out;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.6s ease-out;
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 25px;
    text-align: center;
}

/* ==================== ERROR BANNER ==================== */
.error-banner {
    background: linear-gradient(135deg, #ff3b30 0%, #dc3545 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
    animation: shakeX 0.5s ease-out;
}

.error-icon {
    font-size: 20px;
}

/* ==================== FORM ==================== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 15px;
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 14px 14px 14px 45px;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #adb5bd;
}

/* ==================== LOGIN BUTTON ==================== */
.login-button {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    margin-top: 10px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.login-button:active {
    transform: scale(0.98);
}

/* ==================== FOOTER ==================== */
.login-footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: #86868b;
    font-size: 13px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes shakeX {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 500px) {
    .login-header {
        padding: max(env(safe-area-inset-top), 30px) 20px 30px;
    }

    .logo-icon {
        font-size: 50px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .login-card {
        padding: 30px 20px;
    }

    .login-title {
        font-size: 22px;
    }

    .form-group input[type="text"],
    .form-group input[type="password"] {
        font-size: 16px; /* Prevents auto-zoom on iOS */
        padding: 12px 12px 12px 42px;
    }

    .login-button {
        font-size: 16px;
        padding: 14px;
    }
}

@media (max-width: 375px) {
    .login-content {
        padding: 20px 15px;
    }

    .login-card {
        padding: 25px 18px;
    }
}

/* ==================== iOS SAFE AREAS ==================== */
@supports (padding: max(0px)) {
    body {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}
