/*
 * ============================================
 * Authentication Pages Unified Styles
 * ============================================
 * 
 * Purpose: Provides consistent design and animations for all authentication pages
 * Applies to: Login, Register, ForgotPassword, ResendEmailConfirmation, Logout, etc.
 * 
 * Usage: Include this stylesheet in @section Styles { } of any auth page:
 *   <link rel="stylesheet" href="~/css/auth-pages.css" asp-append-version="true" />
 * 
 * Key Classes:
 *   - .login-container: Main container with background gradients and animations
 *   - .login-form-section: Card/form container with shadow and hover effects
 *   - .form-group-animated: Animated form groups with staggered entrance
 *   - .MainButton: Primary action buttons with hover effects and loading states
 *   - .login-links: Links section with hover animations
 * 
 * Architecture: Separate from site.css for:
 *   - Performance (only loaded on auth pages)
 *   - Maintainability (dedicated auth styles)
 *   - Modularity (easy to update all auth pages at once)
 * ============================================
 */

/* Container & Layout */
.login-container {
    animation: fadeInUp 0.6s ease-out;
    min-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    padding-top: 8rem; /* Extra padding to account for navbar */
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 50%, #f8f9fa 100%);
    position: relative;
    margin-top: 0;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(83, 9, 102, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(198, 168, 119, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.login-container > .row {
    position: relative;
    z-index: 1;
}

/* Logo */
.login-logo {
    display: inline-block;
    animation: fadeInDown 0.6s ease-out 0.1s both;
    position: relative;
}

.login-logo::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(83, 9, 102, 0.08) 0%, transparent 70%);
    z-index: -1;
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

.login-logo-image {
    max-width: 120px;
    height: auto;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgba(83, 9, 102, 0.15));
}

.login-logo:hover .login-logo-image {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 12px rgba(83, 9, 102, 0.25));
}

/* Override site.css row flex-direction for login page */
.login-container .row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    margin-right: -15px !important;
    margin-left: -15px !important;
    width: 100% !important;
}

.login-container .row > [class*="col-"] {
    padding-right: 15px;
    padding-left: 15px;
    flex: 0 0 auto;
}

.login-form-section {
    animation: fadeInUp 0.8s ease-out 0.2s both;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    box-shadow: 0 10px 40px rgba(83, 9, 102, 0.08), 
                0 2px 8px rgba(83, 9, 102, 0.04);
    border: 1px solid rgba(83, 9, 102, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.login-form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #530966 0%, #C6A877 50%, #530966 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-form-section:hover {
    box-shadow: 0 20px 60px rgba(83, 9, 102, 0.12), 
                0 4px 12px rgba(83, 9, 102, 0.06);
    transform: translateY(-2px);
}

.login-form-section:hover::before {
    opacity: 1;
}

/* Header Styles */
.login-header {
    position: relative;
    padding-bottom: 1.5rem;
}

.login-header-content {
    position: relative;
}

/* Typography & Title */
.login-title-main {
    animation: fadeInDown 0.6s ease-out;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

.login-title-text {
    display: inline-block;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, #530966 0%, #7a1fa3 50%, #530966 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
}


/* Legacy support */
.login-title {
    animation: fadeInDown 0.6s ease-out;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #530966 0%, #7a1fa3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem !important;
}

.login-form-section h2 {
    font-weight: 600;
    color: #530966;
    margin-bottom: 1.5rem;
    letter-spacing: -0.3px;
}

.login-form-section hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #C6A877 50%, transparent 100%);
    margin: 1.5rem 0 2rem 0;
    opacity: 0.6;
}

/* Form Groups */
.form-group-animated {
    animation: fadeInUp 0.5s ease-out both;
}

.form-group-animated.mb-3 {
    margin-bottom: 1.25rem !important;
}

.form-group-animated.mb-4 {
    margin-bottom: 1.5rem !important;
}

.form-group-animated:nth-child(1) { animation-delay: 0.3s; }
.form-group-animated:nth-child(2) { animation-delay: 0.4s; }
.form-group-animated:nth-child(3) { animation-delay: 0.5s; }
.form-group-animated:nth-child(4) { animation-delay: 0.6s; }

/* Helper Text - Instructional paragraphs */
.auth-helper-text {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.auth-helper-text:last-child {
    margin-bottom: 0;
}

/* Form Controls - Enterprise Level */
.form-control {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem; /* Space for password toggle */
    font-size: 0.95rem;
    background-color: #ffffff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    line-height: 1.5;
}

.password-input {
    padding-right: 3rem;
}

.form-control:not(.password-input) {
    padding-right: 1rem;
}

.form-control:hover {
    border-color: #C6A877;
    box-shadow: 0 2px 6px rgba(198, 168, 119, 0.15);
}

.form-control:focus {
    border-color: #530966;
    box-shadow: 0 0 0 4px rgba(83, 9, 102, 0.1),
                0 4px 12px rgba(83, 9, 102, 0.15);
    transform: translateY(-1px);
    outline: none;
    background-color: #ffffff;
}

.form-control::placeholder {
    color: #999;
    opacity: 0.7;
}

/* Password Toggle Button */
.password-toggle {
    transition: all 0.2s ease;
    z-index: 10;
}

.password-toggle:hover {
    opacity: 0.7;
    transform: translateY(-50%) scale(1.1);
}

.password-toggle:focus {
    outline: 2px solid rgba(83, 9, 102, 0.3);
    outline-offset: 2px;
    border-radius: 4px;
}

.password-toggle svg {
    transition: transform 0.2s ease;
}

.password-toggle:hover svg {
    transform: scale(1.1);
}

/* Form Labels */
.form-label {
    font-weight: 600;
    color: #530966;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
}

.form-label.d-flex {
    display: flex !important;
}

.form-label svg {
    flex-shrink: 0;
}

/* Checkbox label alignment - match form labels */
.checkbox .form-check-label {
    font-weight: 500;
    color: #530966;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
}

/* Validation States */
.form-control.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 .4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' 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");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.text-danger {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: block;
    animation: slideInDown 0.3s ease-out;
}

/* Enterprise Button Styles */
.MainButton {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    text-transform: uppercase;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(83, 9, 102, 0.15);
}

.MainButton.w-100 {
    width: 100%;
}

.MainButton::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.MainButton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.MainButton:hover::before {
    width: 400px;
    height: 400px;
}

.MainButton:hover::after {
    left: 100%;
}

.MainButton:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(83, 9, 102, 0.25),
                0 4px 8px rgba(83, 9, 102, 0.15);
    border-width: 3px;
}

.MainButton:active {
    transform: translateY(-1px);
    transition: all 0.1s;
    box-shadow: 0 4px 12px rgba(83, 9, 102, 0.2);
}

.MainButton:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(83, 9, 102, 0.2),
                0 8px 24px rgba(83, 9, 102, 0.25);
}

/* Enterprise Alert Styles */
.alert {
    animation: slideInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    border: none;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-danger {
    animation: shake 0.5s ease-out, slideInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-link {
    font-weight: 600;
    text-decoration: underline;
    transition: all 0.2s ease;
}

.alert-link:hover {
    text-decoration: none;
    transform: translateX(2px);
}

/* Enterprise Link Styles */
.login-links {
    margin-top: 0;
}

.login-links a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-weight: 500;
    text-decoration: none;
    display: block;
    padding: 0.5rem 0;
    text-align: center;
    font-size: 0.9rem;
    color: #530966 !important;
}

.login-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0.25rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #530966 0%, #C6A877 100%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-links a:hover {
    color: #530966 !important;
    transform: translateY(-2px);
}

.login-links a:hover::after {
    width: 60%;
}

/* Enterprise Checkbox Styles */
.checkbox {
    margin: 1.5rem 0;
}

.checkbox .form-check {
    display: flex;
    align-items: center;
    padding: 0;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 0;
}

.checkbox .form-check:hover {
    background-color: rgba(83, 9, 102, 0.05);
    padding: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.checkbox label {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-bottom: 0;
    user-select: none;
    color: #530966;
    font-weight: 500;
}

.checkbox .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d9d0d0;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-top: 0;
    margin-right: 0.75rem;
    flex-shrink: 0;
    vertical-align: middle;
}

.checkbox .form-check-input:checked {
    background-color: #530966;
    border-color: #530966;
    box-shadow: 0 0 0 4px rgba(83, 9, 102, 0.1);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.checkbox .form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(83, 9, 102, 0.15);
    outline: none;
}

.checkbox .form-check-input:hover {
    border-color: #530966;
}

/* Keyframe Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Staggered animation for form elements */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.form-label {
    animation: slideInLeft 0.4s ease-out both;
}

.form-label:nth-of-type(1) { animation-delay: 0.3s; }
.form-label:nth-of-type(2) { animation-delay: 0.4s; }

/* Loading & Disabled States */
.MainButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 2px 6px rgba(83, 9, 102, 0.1) !important;
}

.MainButton:not(:disabled) {
    animation: pulse-subtle 3s ease-in-out infinite;
}

.MainButton.loading {
    position: relative;
    color: transparent;
}

.MainButton.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse-subtle {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(83, 9, 102, 0.15),
                    0 0 0 0 rgba(83, 9, 102, 0.2);
    }
    50% {
        box-shadow: 0 4px 12px rgba(83, 9, 102, 0.2),
                    0 0 0 4px rgba(83, 9, 102, 0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .login-container {
        padding: 1rem;
        min-height: calc(100vh - 150px);
    }
    
    .login-container .row {
        margin: 0;
        width: 100%;
    }
    
    .login-container .col-12 {
        padding: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .login-form-section {
        padding: 1.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .MainButton {
        min-width: 100%;
        padding: 1rem 2rem;
    }
    
    .login-title {
        font-size: 2rem;
        margin-bottom: 1.5rem !important;
    }
}

@media (max-width: 576px) {
    .login-form-section {
        padding: 1.25rem !important;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Visible for Keyboard Navigation */
.form-control:focus-visible,
.MainButton:focus-visible,
.login-links a:focus-visible {
    outline: 3px solid rgba(83, 9, 102, 0.5);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .login-form-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .MainButton {
        display: none;
    }
}

