﻿/* Complete Authentication Styles with Beautiful Loading Spinners */
/* Save this as: wwwroot/css/auth.css */

/* ===== Base Container Styles ===== */
.auth-container {
    background-color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    margin: 3rem auto;
    max-width: 450px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

    .auth-container:hover {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    }

/* ===== Logo Styles ===== */
.auth-logo-container {
    width: 70px;
    height: 70px;
    background-color: #1f2937;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin: 0 auto 1rem;
    position: relative;
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.15);
    transition: all 0.3s ease;
}

    .auth-logo-container:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(31, 41, 55, 0.25);
    }

.auth-logo {
    animation: fly 3s ease-in-out infinite;
}

@keyframes fly {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-5px) rotate(5deg);
    }
}

/* ===== Typography ===== */
.auth-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 1.75rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 0.95rem;
}

/* ===== Form Styles ===== */
.auth-form {
    width: 100%;
}

.form-floating {
    position: relative;
    margin-bottom: 1.25rem;
}

.auth-input {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 1rem;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    height: calc(3.5rem + 2px);
}

    /* Fix for browser autofill yellow background */
    .auth-input:-webkit-autofill,
    .auth-input:-webkit-autofill:hover,
    .auth-input:-webkit-autofill:focus,
    .auth-input:-webkit-autofill:active {
        -webkit-box-shadow: 0 0 0 30px white inset !important;
        box-shadow: 0 0 0 30px white inset !important;
        -webkit-text-fill-color: #1f2937 !important;
    }

    .auth-input:focus {
        outline: none;
        background-color: #ffffff;
        border-color: #1f2937;
        box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.1);
        transform: translateY(-1px);
    }

/* Work with Bootstrap's floating label system */
.form-floating label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1rem;
    color: #6b7280;
    pointer-events: none;
    transition: all 0.2s ease;
    padding: 0 0.25rem;
}

.form-floating .auth-input:focus ~ label,
.form-floating .auth-input:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Override Bootstrap's ::after pseudo-element for proper background */
.form-floating > .auth-input:focus ~ label::after,
.form-floating > .auth-input:not(:placeholder-shown) ~ label::after {
    position: absolute;
    inset: 1rem 0.375rem;
    z-index: -1;
    height: 1.5em;
    content: "";
    background-color: transparent;
    border-radius: 0.75rem;
}

/* Work with Bootstrap's floating label system */
.form-floating label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1rem;
    color: #6b7280;
    pointer-events: none;
    transition: all 0.2s ease;
    padding: 0 0.25rem;
}

.form-floating .auth-input:focus ~ label,
.form-floating .auth-input:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Override Bootstrap's ::after pseudo-element for proper background */
.form-floating > .auth-input:focus ~ label::after,
.form-floating > .auth-input:not(:placeholder-shown) ~ label::after {
    position: absolute;
    inset: 1rem 0.375rem;
    z-index: -1;
    height: 1.5em;
    content: "";
    background-color: #fff0;
    border-radius: 0.75rem;
}

/* ===== Button Styles ===== */
.auth-submit-btn {
    width: 100%;
    padding: 0.875rem 2rem;
    background-color: #1f2937;
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(31, 41, 55, 0.15);
}

    .auth-submit-btn:hover:not(:disabled) {
        background-color: #111827;
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(31, 41, 55, 0.2);
    }

    .auth-submit-btn:active:not(:disabled) {
        transform: translateY(0);
    }

    .auth-submit-btn:disabled {
        opacity: 0.65;
        cursor: not-allowed;
    }

/* ===== Loading States ===== */
.btn-content,
.btn-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-spinner {
    display: none;
}

.auth-submit-btn.loading .btn-content {
    display: none !important;
}

.auth-submit-btn.loading .btn-spinner {
    display: flex !important;
}

.auth-submit-btn.loading {
    background-color: #374151;
    pointer-events: none;
}

/* ===== Spinner Animation ===== */
.spinner-border {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    vertical-align: text-bottom;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-right-color: white;
    border-radius: 50%;
    animation: spinner-rotate 0.75s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

@keyframes spinner-rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== Social Login Buttons ===== */
.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem;
    background-color: white;
    color: #212529;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

    .social-btn:hover {
        background-color: #f9fafb;
        border-color: #d1d5db;
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        color: #212529;
        text-decoration: none;
    }

    .social-btn img {
        width: 20px;
        height: 20px;
        margin-right: 0.5rem;
    }

    .social-btn.loading .btn-content {
        display: none !important;
    }

    .social-btn.loading .btn-spinner {
        display: flex !important;
    }

/* ===== Divider ===== */
.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
}

    .divider::before,
    .divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background-color: #e5e7eb;
    }

    .divider span {
        padding: 0 1rem;
        color: #6b7280;
        font-size: 0.875rem;
        font-weight: 500;
    }

/* ===== Validation Styles ===== */
.is-invalid {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

.invalid-feedback {
    display: none;
    font-size: 0.875rem;
    color: #dc3545;
    margin-top: 0.25rem;
    font-weight: 500;
    animation: slideDown 0.2s ease;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Alert Styles ===== */
.alert {
    border-radius: 0.75rem;
    border: none;
    padding: 0.875rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.925rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    position: relative;
    animation: alertSlideIn 0.3s ease;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.alert i {
    font-size: 1.1rem;
    margin-right: 0.75rem;
}

/* Alert close button */
.alert .btn-close {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.25rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    width: auto;
    height: auto;
    background-size: 0.75rem;
}

    .alert .btn-close:hover {
        opacity: 0.8;
    }

/* Success alert with icon */
.alert-success i {
    color: #10b981;
}

.alert-danger i {
    color: #ef4444;
}

.alert-info i {
    color: #3b82f6;
}

/* ===== Password Strength Indicator ===== */
.password-strength {
    margin-top: 0.5rem;
}

    .password-strength small {
        font-size: 0.875rem;
    }

.password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background-color: #e5e7eb;
    overflow: hidden;
    margin-top: 0.25rem;
}

.progress-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    background-color: #dc3545;
}

    .progress-bar.bg-danger {
        background-color: #dc3545;
    }

    .progress-bar.bg-warning {
        background-color: #ffc107;
    }

    .progress-bar.bg-info {
        background-color: #0dcaf0;
    }

    .progress-bar.bg-success {
        background-color: #198754;
    }

/* ===== Form Check Styles ===== */
.form-check {
    display: flex;
    align-items: center;
}

.form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin-right: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: #fff;
    transition: all 0.15s ease;
}

    .form-check-input:checked {
        background-color: #1f2937;
        border-color: #1f2937;
    }

.form-check-label {
    font-size: 0.95rem;
    color: #4b5563;
    cursor: pointer;
}

/* ===== Links ===== */
.auth-link {
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

    .auth-link:hover {
        color: #374151;
        text-decoration: underline;
    }

.forgot-password {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

    .forgot-password:hover {
        color: #1f2937;
        text-decoration: underline;
    }

/* ===== Full Page Loading Overlay ===== */
.auth-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

    .auth-loading-overlay.show {
        opacity: 1;
        visibility: visible;
    }

.loading-content {
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-spinner-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 2rem;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border-radius: 50%;
    border: 3px solid #e5e7eb;
    border-top-color: #1f2937;
    animation: spin 1s linear infinite;
}

    .loading-spinner::before {
        content: '';
        position: absolute;
        top: 5px;
        left: 5px;
        right: 5px;
        bottom: 5px;
        border-radius: 50%;
        border: 3px solid transparent;
        border-top-color: #6b7280;
        animation: spin 0.8s linear infinite reverse;
    }

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.loading-subtext {
    color: #6b7280;
    font-size: 0.875rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .auth-container {
        padding: 2rem;
        margin: 1.5rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-logo-container {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .row.g-3 > * {
        padding-right: calc(var(--bs-gutter-x) * .5);
        padding-left: calc(var(--bs-gutter-x) * .5);
    }
}

/* ===== Utility Classes ===== */
.d-none {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.me-2 {
    margin-right: 0.5rem;
}

.d-grid {
    display: grid;
}

.text-muted {
    color: #6b7280;
}

.fw-medium {
    font-weight: 500;
}

.fw-bold {
    font-weight: 700;
}
