/**
 * realsales Authentication Modal Styles
 * Login and Registration modal styling - Updated Design
 * 
 * @package realsales
 */

/* ===== Authentication Modals Container ===== */
.auth-modals-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    background: rgba(15, 15, 35, 0.85);
    backdrop-filter: blur(12px);
}

.auth-modals-container.active {
    opacity: 1;
    visibility: visible;
}

/* ===== Auth Modal Base ===== */
.auth-modal {
    position: absolute;
    width: 100%;
    max-width: 480px;
    margin: 0 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-50px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* ===== Modal Content ===== */
.auth-modal .modal-content {
    position: relative;
    padding: 48px 48px 48px 48px;
    background: white;
    border-radius: 24px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

/* Custom Scrollbar for Modal Content */
.auth-modal .modal-content::-webkit-scrollbar {
    width: 8px;
}

.auth-modal .modal-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
    margin: 18px 0;
}

.auth-modal .modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border-radius: 10px;
    border: 2px solid white;
}

.auth-modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
}

/* Register modal specific - more compact */
#registerModal .modal-content {
    padding: 40px;
}

/* Hide scrollbar in register modal */
#registerModal .modal-content::-webkit-scrollbar {
    display: none;
}

#registerModal .modal-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#registerModal .modal-subtitle {
    margin-bottom: 24px;
}

#registerModal .form-group {
    margin-bottom: 14px;
}

/* ===== Close Button ===== */
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    color: #64748b;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #334155;
    transform: rotate(90deg);
}

/* ===== Modal Title ===== */
.auth-modal h2 {
    color: #1e293b;
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 8px 0;
    text-align: center;
}

.auth-modal .modal-subtitle {
    color: #64748b;
    font-size: 16px;
    margin: 0 0 32px 0;
    text-align: center;
}

/* ===== Auth Message ===== */
.auth-message {
    margin-bottom: 20px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    display: none;
}

.auth-message.success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.auth-message.error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.auth-message:has(p) {
    display: block;
}

/* ===== Form Groups ===== */
.auth-modal .form-group {
    margin-bottom: 16px;
}

.auth-modal .form-group:last-of-type {
    margin-bottom: 20px;
}

.auth-modal .form-group-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

/* Register modal specific - more compact */
#registerModal .form-group {
    margin-bottom: 14px;
}

#registerModal .modal-content {
    padding: 40px;
}

#registerModal .modal-subtitle {
    margin-bottom: 24px;
}

/* ===== Form Labels ===== */
.auth-modal label {
    display: block;
    margin-bottom: 8px;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
}

/* ===== Form Inputs ===== */
.auth-modal input[type="text"],
.auth-modal input[type="email"],
.auth-modal input[type="password"],
.auth-modal select {
    width: 100%;
    padding: 14px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #1e293b;
    font-size: 16px;
    transition: all 0.2s ease;
}

.auth-modal input[type="text"]:focus,
.auth-modal input[type="email"]:focus,
.auth-modal input[type="password"]:focus,
.auth-modal select:focus {
    outline: none;
    border-color: #7c3aed;
    background: #faf5ff;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.auth-modal input::placeholder {
    color: #94a3b8;
}

/* ===== Custom Select Dropdown ===== */
.custom-select {
    position: relative;
    width: 100%;
    user-select: none;
}

.select-trigger {
    width: 100%;
    padding: 14px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #1e293b;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.select-trigger:hover {
    border-color: #c4b5fd;
}

.custom-select.open .select-trigger {
    border-color: #7c3aed;
    background: #faf5ff;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.select-value {
    flex: 1;
    color: #1e293b;
}

.select-value.placeholder {
    color: #94a3b8;
}

.select-arrow {
    width: 20px;
    height: 20px;
    color: #64748b;
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.custom-select.open .select-arrow {
    transform: rotate(180deg);
    color: #7c3aed;
}

.select-options {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #7c3aed;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(124, 58, 237, 0.15);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    
    /* Hide scrollbar */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.select-options::-webkit-scrollbar {
    display: none;
}

.custom-select.open .select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #1e293b;
    font-size: 16px;
}

.select-option:hover {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    color: #7c3aed;
}

.select-option.selected {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    color: #7c3aed;
    font-weight: 600;
}

/* ===== Checkbox Group ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #475569;
    margin: 0 !important;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: #7c3aed;
}

.forgot-password {
    color: #7c3aed;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.forgot-password:hover {
    color: #6d28d9;
    text-decoration: underline;
}

/* ===== Newsletter Checkbox ===== */
.checkbox-group {
    margin: 20px 0;
}

.checkbox-label {
    display: flex;
    gap: 12px;
    cursor: pointer;
    align-items: flex-start;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin-top: 3px;
    cursor: pointer;
    accent-color: #7c3aed;
}

.checkbox-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.5;
    color: #334155;
}

.checkbox-text a {
    color: #7c3aed;
}

.checkbox-text a:hover {
    color: #6d28d9;
}

/* ===== Submit Button ===== */
.auth-modal .btn-submit {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 50%, #7c3aed 100%);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.auth-modal .btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

.auth-modal .btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.auth-modal .btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

/* ===== Form Divider ===== */
.form-divider {
    position: relative;
    text-align: center;
    margin: 24px 0;
    color: #94a3b8;
    font-size: 14px;
}

.form-divider::before,
.form-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 30px);
    height: 1px;
    background: #e2e8f0;
}

.form-divider::before {
    left: 0;
}

.form-divider::after {
    right: 0;
}

/* ===== Switch Form Link ===== */
.switch-form {
    text-align: center;
    margin: 0;
    padding: 0;
    color: #64748b;
    font-size: 15px;
}

.switch-form a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
}

.switch-form a:hover {
    color: #6d28d9;
    text-decoration: underline;
}

/* ===== Responsive Design ===== */
@media (max-width: 480px) {
    .auth-modal .modal-content {
        padding: 36px 24px;
        margin: 20px;
        border-radius: 20px;
    }
    
    .auth-modal h2 {
        font-size: 28px;
        margin-bottom: 6px;
    }
    
    .auth-modal .modal-subtitle {
        font-size: 15px;
        margin-bottom: 28px;
    }
    
    .auth-modal .form-group {
        margin-bottom: 16px;
    }
    
    .auth-modal input[type="text"],
    .auth-modal input[type="email"],
    .auth-modal input[type="password"],
    .auth-modal select {
        padding: 12px 14px;
        font-size: 16px;
    }
    
    .auth-modal .btn-submit {
        padding: 14px;
        font-size: 16px;
    }
}

/* ===== Animation Enhancement ===== */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-modal.active {
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Loading State ===== */
.auth-modal .btn-submit:disabled::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    margin: auto;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}