/* ========================================
   ENHANCED FORMS STYLING v3.0.0
   Light-first — matches presentation design system
   Dark override via [data-bs-theme="dark"]
   ======================================== */

/* ── Background: light-first (matches sk-hero gradient in index) ── */
body.auth-page {
    background: linear-gradient(160deg, #f0f4ff 0%, #f9f0ff 55%, #f0fdf4 100%) !important;
    min-height: 100vh;
}

/* ── Auth Card: clean white card (matches sk-sec-card / sk-step in index) ── */
.auth-card {
    background: var(--bs-body-bg, #fff) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid var(--bs-border-color, #e5e7eb) !important;
    border-radius: 20px !important;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important;
}

.auth-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.16), 0 4px 12px rgba(0, 0, 0, 0.07) !important;
    border-color: rgba(102, 126, 234, 0.3) !important;
}

/* Feature Icon Enhanced */
.feature-icon {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    width: 64px !important;
    height: 64px !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(102, 126, 234, 0.45) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.feature-icon:hover {
    transform: scale(1.05) rotate(3deg) !important;
    box-shadow: 0 6px 32px rgba(102, 126, 234, 0.55) !important;
}

.feature-icon i,
.feature-icon svg {
    color: white !important;
    width: 28px !important;
    height: 28px !important;
}

/* Section Headers */
.section-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.06)) !important;
    border-left: 4px solid #667eea !important;
    padding: 12px 16px !important;
    margin: 24px -20px 20px -20px !important;
    border-radius: 0 8px 8px 0 !important;
}

.section-header h5 {
    margin-bottom: 0 !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
}

.section-header i,
.section-header svg {
    width: 20px !important;
    height: 20px !important;
    vertical-align: middle !important;
}

/* ── Form Controls: light-first ── */
.form-control,
.form-select {
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    color: #1f2937 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-size: 15px !important;
    padding: 10px 14px !important;
}

.form-control:focus,
.form-select:focus {
    background: #fff !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15) !important;
    outline: none !important;
    color: #1f2937 !important;
}

.form-control::placeholder {
    color: #9ca3af !important;
}

/* ── Input Groups: light-first ── */
.input-group-text {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.04)) !important;
    border: 1px solid #e5e7eb !important;
    border-right: none !important;
    color: #667eea !important;
    border-radius: 8px 0 0 8px !important;
}

.input-group .form-control {
    border-left: none !important;
    border-radius: 0 8px 8px 0 !important;
}

/* Buttons Enhanced */
.btn {
    border-radius: 12px !important;
    font-weight: 500 !important;
    letter-spacing: 0.3px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4) !important;
}

.btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5) !important;
    background: linear-gradient(135deg, #764ba2, #5a3d8a) !important;
}

.btn-primary:active {
    transform: translateY(0) !important;
}

.btn-outline-success {
    border: 2px solid #10b981 !important;
    color: #10b981 !important;
}

.btn-outline-success:hover {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: #10b981 !important;
    color: #fff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3) !important;
}

/* Button Ripple Effect */
.btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* Password Strength Meter Enhanced */
.password-strength .progress {
    height: 8px !important;
    background: #f3f4f6 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    margin-top: 8px !important;
}
[data-bs-theme="dark"] .password-strength .progress {
    background: rgba(255, 255, 255, 0.1) !important;
}

.password-strength .progress-bar {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 4px !important;
}

.password-strength .progress-bar.strength-weak {
    background: linear-gradient(90deg, #dc3545, #c82333) !important;
    width: 20% !important;
}

.password-strength .progress-bar.strength-fair {
    background: linear-gradient(90deg, #ffc107, #e0a800) !important;
    width: 40% !important;
}

.password-strength .progress-bar.strength-good {
    background: linear-gradient(90deg, #28a745, #1e7e34) !important;
    width: 60% !important;
}

.password-strength .progress-bar.strength-strong {
    background: linear-gradient(90deg, #198754, #157347) !important;
    width: 80% !important;
}

.password-strength .progress-bar.strength-very-strong {
    background: linear-gradient(90deg, #667eea, #764ba2) !important;
    width: 100% !important;
}

/* ── Alerts: light-first ── */
.alert {
    border-radius: 12px !important;
    border: none !important;
    border-left: 4px solid !important;
    transition: all 0.3s ease !important;
}

.alert-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.04)) !important;
    border-left-color: #667eea !important;
    color: #4338ca !important;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.06)) !important;
    border-left-color: #f59e0b !important;
    color: #92400e !important;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.04)) !important;
    border-left-color: #ef4444 !important;
    color: #991b1b !important;
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.04)) !important;
    border-left-color: #10b981 !important;
    color: #065f46 !important;
}

/* ── Form Text: light-first ── */
.form-text {
    color: #6b7280 !important;
    font-size: 13px !important;
    margin-top: 4px !important;
}

/* ── Invalid Feedback ── */
.invalid-feedback {
    color: #dc2626 !important;
    font-size: 13px !important;
    margin-top: 4px !important;
    display: none;
}

.form-control.is-invalid ~ .invalid-feedback {
    display: block !important;
    animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both !important;
}

/* Valid State */
.form-control.is-valid {
    border-color: #198754 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right calc(0.375em + 0.1875rem) center !important;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
}

/* ── Checkbox: light-first ── */
.form-check-input {
    width: 20px !important;
    height: 20px !important;
    background-color: #fff !important;
    border: 2px solid #d1d5db !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

.form-check-input:checked {
    background-color: #667eea !important;
    border-color: #667eea !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4) !important;
}

.form-check-label {
    margin-left: 8px !important;
    color: #374151 !important;
    cursor: pointer !important;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus Visible for Accessibility */
*:focus-visible {
    outline: 2px solid #667eea !important;
    outline-offset: 2px !important;
}

/* Mobile Responsive Improvements */
@media (max-width: 768px) {
    .auth-card {
        margin: 1rem !important;
        padding: 1.5rem !important;
    }
    
    .section-header {
        margin: 16px -15px 16px -15px !important;
    }
    
    .btn {
        min-height: 48px !important;
        font-size: 16px !important;
    }
    
    .form-control,
    .form-select {
        min-height: 44px !important;
        font-size: 16px !important;
    }
    
    .form-check-input {
        width: 24px !important;
        height: 24px !important;
    }
}

/* ========================================
   DARK THEME OVERRIDES
   ======================================== */

[data-bs-theme="dark"] body.auth-page {
    background: linear-gradient(160deg, #0f0c29 0%, #302b63 55%, #24243e 100%) !important;
}

[data-bs-theme="dark"] .auth-card {
    background: rgba(30, 27, 60, 0.97) !important;
    border-color: rgba(102, 126, 234, 0.2) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(102, 126, 234, 0.08) !important;
}

[data-bs-theme="dark"] .auth-card:hover {
    border-color: rgba(102, 126, 234, 0.4) !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(102, 126, 234, 0.15) !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: rgba(255, 255, 255, 0.95) !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25) !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

[data-bs-theme="dark"] .input-group-text {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.18), rgba(118, 75, 162, 0.1)) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #a78bfa !important;
}

[data-bs-theme="dark"] .section-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.08)) !important;
}

[data-bs-theme="dark"] .form-text {
    color: rgba(255, 255, 255, 0.55) !important;
}

[data-bs-theme="dark"] .form-check-input {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

[data-bs-theme="dark"] .form-check-label {
    color: rgba(255, 255, 255, 0.88) !important;
}

[data-bs-theme="dark"] .password-strength .progress {
    background: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .alert-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.18), rgba(118, 75, 162, 0.1)) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-bs-theme="dark"] .alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.08)) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-bs-theme="dark"] .alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08)) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-bs-theme="dark"] .alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.08)) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

[data-bs-theme="dark"] .invalid-feedback {
    color: #f87171 !important;
}

/* Print Styles */
@media print {
    body.auth-page {
        background: white !important;
    }
    
    .auth-card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}