/**
 * Auth Components - Login Page Styling
 * Modern, animated login forms for DomusAurea Web and Admin
 */

/* ========================================
   CSS Custom Properties
   ======================================== */

:root {
    --auth-primary: #0d6efd;
    --auth-primary-dark: #0a58ca;
    --auth-gradient-start: #0d6efd;
    --auth-gradient-end: #667eea;
    --auth-card-shadow: 0 20px 60px rgba(13, 110, 253, 0.15);
    --auth-card-shadow-hover: 0 25px 80px rgba(13, 110, 253, 0.25);
    --auth-transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --auth-transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Auth Page Background
   ======================================== */

.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--auth-gradient-start) 0%, var(--auth-gradient-end) 50%, #f5f6fa 100%);
    background-size: 200% 200%;
    animation: auth-gradient-shift 15s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

@keyframes auth-gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Decorative floating shapes */
.auth-page::before,
.auth-page::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: auth-float 20s ease-in-out infinite;
    pointer-events: none;
}

.auth-page::before {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
}

.auth-page::after {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: -50px;
    animation-delay: -10s;
}

@keyframes auth-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(20px, -20px) scale(1.05); }
    50% { transform: translate(-10px, 20px) scale(0.95); }
    75% { transform: translate(-20px, -10px) scale(1.02); }
}

/* ========================================
   Auth Card Container
   ======================================== */

.auth-card-wrapper {
    width: 100%;
    max-width: 420px;
    animation: auth-card-entrance 0.6s var(--auth-transition-base) forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes auth-card-entrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--auth-card-shadow);
    overflow: hidden;
    transition: box-shadow var(--auth-transition-base), transform var(--auth-transition-base);
}

.auth-card:hover {
    box-shadow: var(--auth-card-shadow-hover);
    transform: translateY(-5px);
}

.auth-card-body {
    padding: 2.5rem;
}

/* ========================================
   Auth Header / Branding
   ======================================== */

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 30px rgba(13, 110, 253, 0.3);
    transition: transform var(--auth-transition-base), box-shadow var(--auth-transition-base);
}

.auth-logo:hover {
    transform: scale(1.05) rotate(5deg);
    box-shadow: 0 15px 40px rgba(13, 110, 253, 0.4);
}

.auth-logo i {
    font-size: 2.5rem;
    color: white;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0;
}

/* ========================================
   Auth Form Styling
   ======================================== */

.auth-form .form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.auth-form .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--auth-transition-base);
}

.auth-form .form-control {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    background-color: #f8f9fa;
    transition: all var(--auth-transition-base);
}

.auth-form .form-control:focus {
    border-color: var(--auth-primary);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1);
    transform: translateY(-2px);
}

/* Input with icon support */
.auth-input-group {
    position: relative;
}

.auth-input-group .auth-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    font-size: 1.25rem;
    transition: color var(--auth-transition-base);
    z-index: 10;
}

.auth-input-group .form-control {
    padding-left: 3rem;
}

.auth-input-group .form-control:focus ~ .auth-input-icon {
    color: var(--auth-primary);
}

/* ========================================
   Remember Me Checkbox
   ======================================== */

.auth-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.auth-checkbox .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    transition: all var(--auth-transition-base);
    cursor: pointer;
}

.auth-checkbox .form-check-input:checked {
    background-color: var(--auth-primary);
    border-color: var(--auth-primary);
}

.auth-checkbox .form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.15);
}

.auth-checkbox .form-check-label {
    margin-left: 0.5rem;
    color: #6c757d;
    cursor: pointer;
    user-select: none;
    transition: color var(--auth-transition-base);
}

.auth-checkbox:hover .form-check-label {
    color: #495057;
}

/* ========================================
   Submit Button
   ======================================== */

.auth-submit-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    color: white;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--auth-transition-base);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

.auth-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.auth-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.4);
}

.auth-submit-btn:hover::before {
    left: 100%;
}

.auth-submit-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Button loading state */
.auth-submit-btn.loading {
    pointer-events: none;
}

.auth-submit-btn.loading .btn-text {
    opacity: 0;
}

.auth-submit-btn .btn-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: none;
}

.auth-submit-btn.loading .btn-spinner {
    opacity: 1;
    animation: auth-spinner 0.8s linear infinite;
}

@keyframes auth-spinner {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========================================
   Alert Styling
   ======================================== */

.auth-alert {
    border: none;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: auth-alert-entrance 0.4s ease-out;
}

@keyframes auth-alert-entrance {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.auth-alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.auth-alert i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ========================================
   Validation Feedback
   ======================================== */

.auth-form .text-danger {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: block;
    animation: auth-validation-shake 0.4s ease;
}

@keyframes auth-validation-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.auth-form .form-control.is-invalid,
.auth-form .form-control.input-validation-error {
    border-color: #dc3545;
    animation: auth-input-shake 0.4s ease;
}

@keyframes auth-input-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-3px); }
    40%, 80% { transform: translateX(3px); }
}

/* ========================================
   Admin Console Variant
   ======================================== */

.auth-admin .auth-logo {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.auth-admin .auth-submit-btn {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 4px 15px rgba(26, 26, 46, 0.3);
}

.auth-admin .auth-submit-btn:hover {
    box-shadow: 0 8px 25px rgba(26, 26, 46, 0.4);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 576px) {
    .auth-page {
        padding: 1rem;
    }

    .auth-card-wrapper {
        max-width: 100%;
    }

    .auth-card-body {
        padding: 1.5rem;
    }

    .auth-logo {
        width: 70px;
        height: 70px;
    }

    .auth-logo i {
        font-size: 2rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-submit-btn {
        padding: 0.875rem 1.25rem;
    }

    /* Disable floating shapes on mobile for performance */
    .auth-page::before,
    .auth-page::after {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
