/**
 * Enhanced Authentication Styles - ULTRA OPTIMIZED VERSION
 * Designed for low CPU/GPU usage, reduced repaints and minimal reflows.
 * Location: assets/css/auth.css
 */

/* ========================================
   BASE & RESET
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    background-color: #f9fafb;
}

/* ========================================
   STATIC BACKGROUND (No Animation)
   ======================================== */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    background-attachment: fixed; /* avoids reflow during scroll */
}

/* ========================================
   CONTAINER
   ======================================== */
.auth-container {
    width: 100%;
    max-width: 480px;
    animation: fadeIn 0.3s ease-out both;
    contain: content; /* isolate layout & paint */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-card {
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    border: 1px solid #f3f4f6;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    contain: layout paint style;
}

/* ========================================
   HEADER
   ======================================== */
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-icon {
    font-size: 64px;
    margin-bottom: 12px;
}

.auth-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: #059669;
}

.auth-header p {
    font-size: 15px;
    color: #6b7280;
}

/* ========================================
   ROLE SELECTOR
   ======================================== */
.role-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding: 6px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 14px;
    contain: layout;
}

.role-btn {
    flex: 1 1 45%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    will-change: transform;
}

.role-btn:hover {
    background-color: rgba(16, 185, 129, 0.12);
    color: #059669;
    transform: translateY(-1px);
}

.role-btn.active {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: #fff;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.2);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #1f2937;
    transition: border-color 0.2s ease;
    outline: none;
}

.form-group input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-primary,
.btn-login,
.btn-register {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #34d399);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    will-change: transform;
}

.btn-primary:hover,
.btn-login:hover,
.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-primary:disabled,
.btn-login:disabled,
.btn-register:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   SPINNERS (GPU accelerated)
   ======================================== */
.loading,
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   ALERT MESSAGES
   ======================================== */
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    margin-bottom: 16px;
    display: none;
    contain: paint;
}

.alert-success { background: #d1fae5; color: #065f46; border-color: #10b981; }
.alert-error   { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #3b82f6; }

/* ========================================
   FEATURES
   ======================================== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    contain: layout;
}

.feature {
    text-align: center;
    padding: 12px;
    background: rgba(16, 185, 129, 0.06);
    border-radius: 10px;
    transition: background-color 0.15s ease;
    will-change: background-color;
}

.feature:hover {
    background: rgba(16, 185, 129, 0.12);
}

.feature-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 640px) {
    .auth-card { padding: 28px 22px; }
    .auth-header h1 { font-size: 22px; }
    .form-group { margin-bottom: 16px; }
}

/* ========================================
   PERFORMANCE
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* 
🔋 PERFORMANCE STRATEGIES USED:
--------------------------------
1. Removed expensive filters & gradients.
2. Used `contain` property to isolate layout & paint areas.
3. Avoided all continuous animations except spinner.
4. Limited transitions to transform/background only.
5. Used will-change hints sparingly.
6. Added `background-attachment: fixed` for static gradient.
7. Reduced box-shadow spread radius.
8. Simplified layout for better rendering pipeline.
9. Optimized @media rules to avoid deep recalculations.
*/
