/* ======================================
   AUTH PAGES - UNIFIED DESIGN SYSTEM
   Professional, Consistent, RTL-Ready
====================================== */

/* ======================================
   CSS VARIABLES FOR AUTH
====================================== */
:root {
    /* Auth Specific Colors */
    --auth-primary: #6366f1;
    --auth-primary-hover: #4f46e5;
    --auth-primary-light: rgba(99, 102, 241, 0.1);
    --auth-primary-glow: rgba(99, 102, 241, 0.3);
    
    --auth-secondary: #8b5cf6;
    --auth-accent: #06b6d4;
    
    --auth-success: #10b981;
    --auth-success-light: rgba(16, 185, 129, 0.1);
    
    --auth-error: #ef4444;
    --auth-error-light: rgba(239, 68, 68, 0.1);
    
    --auth-warning: #f59e0b;
    --auth-warning-light: rgba(245, 158, 11, 0.1);
}

/* ======================================
   AUTH CONTAINER
====================================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    position: relative;
    overflow: hidden;
}

/* Background Pattern */
.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(6, 182, 212, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

/* Light Theme Background */
[data-theme="light"] .auth-container {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 50%, #ddd6fe 100%);
}

[data-theme="light"] .auth-container::before {
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.2) 0%, transparent 50%);
}

/* ======================================
   AUTH CARD
====================================== */
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card, #ffffff);
    border-radius: 1.5rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    position: relative;
    z-index: 1;
    animation: cardSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .auth-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ======================================
   AUTH HEADER
====================================== */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    border-radius: 1.25rem;
    color: white;
    box-shadow: 0 10px 30px var(--auth-primary-glow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px var(--auth-primary-glow);
}

.auth-icon.success {
    background: linear-gradient(135deg, var(--auth-success), #059669);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.auth-icon.error {
    background: linear-gradient(135deg, var(--auth-error), #dc2626);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

.auth-icon.loading {
    background: transparent;
    box-shadow: none;
}

.auth-icon svg {
    width: 36px;
    height: 36px;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.auth-subtitle {
    color: var(--text-muted, #64748b);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

/* ======================================
   FORM STYLES
====================================== */
.auth-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    font-size: 0.875rem;
}

/* Input Group */
.input-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #94a3b8);
    z-index: 4;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: color 0.2s ease;
}

[dir="rtl"] .input-icon {
    left: auto;
    right: 1rem;
}

/* Form Control */
.input-group .form-control {
    width: 100%;
    padding: 0.875rem 3rem;
    height: 52px;
    border-radius: 0.75rem;
    border: 2px solid var(--border-color, #e2e8f0);
    background: var(--bg-primary, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

[data-theme="dark"] .input-group .form-control {
    background: rgba(15, 23, 42, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

.input-group .form-control:hover {
    border-color: #a5b4fc;
}

.input-group .form-control:focus {
    border-color: var(--auth-primary);
    background: var(--bg-card, #ffffff);
    box-shadow: 0 0 0 4px var(--auth-primary-light);
    outline: none;
}

[data-theme="dark"] .input-group .form-control:focus {
    background: rgba(30, 41, 59, 0.8);
}

.input-group .form-control:focus ~ .input-icon,
.input-group:focus-within .input-icon {
    color: var(--auth-primary);
}

.input-group .form-control::placeholder {
    color: var(--text-muted, #94a3b8);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.5rem;
    margin: -0.5rem;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

[dir="rtl"] .password-toggle {
    right: auto;
    left: 1rem;
}

.password-toggle:hover {
    color: var(--auth-primary);
    background: var(--auth-primary-light);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* ======================================
   FORM CHECK (Remember Me)
====================================== */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    cursor: pointer;
    accent-color: var(--auth-primary);
    border-radius: 0.25rem;
}

.form-check-label {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary, #475569);
    user-select: none;
}

/* ======================================
   VALIDATION MESSAGES
====================================== */
.validation-message {
    color: var(--auth-error);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 0.5rem;
}

/* ======================================
   BUTTONS
====================================== */
.btn-block {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    height: 52px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-secondary));
    color: white;
    box-shadow: 0 4px 15px var(--auth-primary-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--auth-primary-glow);
    filter: brightness(1.05);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-outline-primary {
    background: transparent;
    color: var(--auth-primary);
    border: 2px solid var(--auth-primary);
}

.btn-outline-primary:hover {
    background: var(--auth-primary);
    color: white;
    box-shadow: 0 4px 15px var(--auth-primary-glow);
}

/* ======================================
   ALERTS
====================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    border: none;
}

.alert svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-danger {
    background: var(--auth-error-light);
    color: var(--auth-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: var(--auth-success-light);
    color: var(--auth-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-warning {
    background: var(--auth-warning-light);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .alert-warning {
    color: var(--auth-warning);
}

/* ======================================
   AUTH LINKS
====================================== */
.auth-links {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    padding: 0.25rem 0;
    display: inline-block;
    position: relative;
}

.auth-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--auth-primary);
    transition: width 0.2s ease;
}

.auth-link:hover {
    color: var(--auth-primary-hover);
    text-decoration: none;
}

.auth-link:hover::after {
    width: 100%;
}

/* ======================================
   AUTH FOOTER
====================================== */
.auth-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .auth-footer {
    border-color: rgba(255, 255, 255, 0.1);
}

.auth-footer p {
    margin: 0;
    color: var(--text-muted, #94a3b8);
    font-size: 0.9rem;
}

/* ======================================
   SUCCESS CONTENT
====================================== */
.auth-success-content {
    text-align: center;
    padding: 1rem 0;
}

.auth-success-content p {
    color: var(--text-secondary, #475569);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ======================================
   AUTH ACTIONS
====================================== */
.auth-actions {
    margin-top: 2rem;
}

.auth-error-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ======================================
   SPINNER
====================================== */
.spinner-border-sm {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 0.2rem;
}

/* ======================================
   DIVIDER
====================================== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, #e2e8f0);
}

/* ======================================
   RESPONSIVE
====================================== */
@media (max-width: 480px) {
    .auth-container {
        padding: 1rem 0.75rem;
    }
    
    .auth-card {
        padding: 1.75rem 1.25rem;
        border-radius: 1rem;
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
    
    .auth-icon {
        width: 64px;
        height: 64px;
        border-radius: 1rem;
    }
    
    .auth-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .input-group .form-control {
        height: 48px;
        font-size: 0.95rem;
    }
    
    .btn-block {
        height: 48px;
    }
}

/* ======================================
   RTL SUPPORT
====================================== */
[dir="rtl"] .auth-form {
    text-align: right;
}

[dir="rtl"] .form-check {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

[dir="rtl"] .alert {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .auth-link::after {
    left: auto;
    right: 0;
}

[dir="rtl"] .me-2 {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

/* ======================================
   FOCUS VISIBLE
====================================== */
.btn:focus-visible,
.auth-link:focus-visible,
.form-check-input:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}
