/**
 * INFINITY E-commerce - Auth Modal
 * Login/Register popup styles
 *
 * @package Infinity_Ecommerce
 * @version 3.4.0
 */

/* ==========================================================================
   OVERLAY & PANEL
   ========================================================================== */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: var(--infinity-z-modal, 10000);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-modal.active {
    opacity: 1;
    visibility: visible;
}

.auth-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.auth-modal__panel {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    max-height: 90vh;
    overflow-y: auto;
}

.auth-modal.active .auth-modal__panel {
    transform: translateY(0) scale(1);
}

body.auth-modal-open {
    overflow: hidden;
}

/* Close button */
.auth-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    padding: 0;
}

.auth-modal__close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* ==========================================================================
   TABS
   ========================================================================== */
.auth-modal__tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 1.5rem;
}

.auth-modal__tab {
    flex: 1;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-modal__tab.active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-modal__tab:hover:not(.active) {
    color: #1e293b;
}

/* ==========================================================================
   ERROR MESSAGE
   ========================================================================== */
.auth-modal__error {
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

/* ==========================================================================
   FORMS
   ========================================================================== */
.auth-modal__form {
    display: none;
}

.auth-modal__form.active {
    display: block;
}

.auth-modal__field {
    margin-bottom: 1rem;
}

.auth-modal__field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.auth-modal__field input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #1e293b;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.auth-modal__field input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: #fff;
}

/* Actions row */
.auth-modal__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    font-size: 0.8125rem;
}

.auth-modal__remember {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #64748b;
    cursor: pointer;
}

.auth-modal__remember input {
    accent-color: #6366f1;
}

.auth-modal__forgot {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.auth-modal__forgot:hover {
    text-decoration: underline;
}

/* Submit button */
.auth-modal__submit {
    width: 100%;
    padding: 0.875rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fff;
    background: #6366f1;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.auth-modal__submit:hover {
    background: #4f46e5;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.auth-modal__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-modal__submit.loading {
    position: relative;
    color: transparent;
}

.auth-modal__submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.6s linear infinite;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

/* Terms */
.auth-modal__terms {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.5;
}

.auth-modal__terms a {
    color: #6366f1;
    text-decoration: none;
}

.auth-modal__terms a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   MOBILE — Bottom Sheet
   ========================================================================== */
@media (max-width: 575px) {
    .auth-modal {
        align-items: flex-end;
    }

    .auth-modal__panel {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 1.5rem 1.5rem 2rem;
        max-height: 85vh;
        transform: translateY(100%);
    }

    .auth-modal.active .auth-modal__panel {
        transform: translateY(0);
    }
}
