/**
 * Auth Modal Styles
 * Login/Register modal with tabbed interface
 *
 * @package Qatarshoes
 * @since 2.1.0
 */

/* Modal Container */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-modal.open {
    display: flex;
}

/* Backdrop */
.auth-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

/* Content */
.auth-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    max-width: 440px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close Button */
.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.auth-modal-close:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

/* Tabs */
.auth-modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0;
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.auth-tab:hover {
    color: #1a1a1a;
}

.auth-tab.active {
    color: #1a1a1a;
    border-bottom-color: #1a1a1a;
}

/* Panels */
.auth-panel {
    display: none;
}

.auth-panel.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Title & Subtitle */
.auth-title {
    font-family: 'Canela Text', Georgia, serif;
    font-size: 28px;
    font-weight: 400;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}

.auth-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0 0 28px 0;
    line-height: 1.5;
}

/* Form Groups */
.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.auth-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.auth-form-group label .required {
    color: #e53935;
}

.auth-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 15px;
    color: #1a1a1a;
    background: #fff;
    transition: all 0.2s;
    box-sizing: border-box;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

.auth-form-group input.error {
    border-color: #e53935;
    background-color: #fff5f5;
}

.auth-form-group input.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.auth-form-group input::placeholder {
    color: #999;
}

/* Password Toggle */
.auth-password-wrapper {
    position: relative;
}

.auth-password-wrapper input {
    padding-right: 44px;
}

.auth-password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s;
}

.auth-password-toggle:hover {
    color: #1a1a1a;
}

/* Password Strength */
.auth-password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: #e5e5e5;
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    transition: all 0.3s;
    border-radius: 2px;
}

.strength-bar.weak span {
    width: 33%;
    background: #e53935;
}

.strength-bar.medium span {
    width: 66%;
    background: #fb8c00;
}

.strength-bar.strong span {
    width: 100%;
    background: #43a047;
}

.strength-text {
    font-size: 12px;
    color: #666;
    min-width: 60px;
}

.strength-text.weak { color: #e53935; }
.strength-text.medium { color: #fb8c00; }
.strength-text.strong { color: #43a047; }

/* Hints */
.auth-hint {
    font-size: 12px;
    color: #666;
    margin: 8px 0 0 0;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    line-height: 1.4;
}

/* Error Messages */
.auth-error-message {
    display: none;
    font-size: 13px;
    color: #e53935;
    margin-top: 6px;
    padding: 6px 10px;
    background: #ffebee;
    border-radius: 4px;
    border-left: 3px solid #e53935;
}

.auth-error-message.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.auth-form-error {
    display: none;
    background: #ffebee;
    color: #c62828;
    padding: 14px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 4px solid #e53935;
    font-weight: 500;
}

.auth-form-error.show {
    display: block;
    animation: fadeIn 0.2s ease, shake 0.5s ease;
}

/* Success Message */
.auth-form-success {
    display: none;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-form-success.show {
    display: block;
}

/* Form Options (Remember me, Forgot password) */
.auth-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.auth-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: #1a1a1a;
}

.auth-link {
    background: none;
    border: none;
    color: #1a1a1a;
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.auth-link:hover {
    text-decoration: none;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-submit-btn:hover:not(:disabled) {
    background: #333;
}

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

.auth-submit-btn .spinner {
    animation: spin 1s linear infinite;
}

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

/* Back Button */
.auth-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 24px;
}

.auth-back-btn:hover {
    color: #1a1a1a;
}

/* Terms */
.auth-terms {
    font-size: 12px;
    color: #888;
    text-align: center;
    margin: 16px 0 0 0;
    line-height: 1.5;
}

.auth-terms a {
    color: #1a1a1a;
    text-decoration: underline;
}

.auth-terms a:hover {
    text-decoration: none;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .auth-modal-content {
        padding: 28px 20px;
        border-radius: 12px 12px 0 0;
        max-height: 90vh;              /* Fallback for older browsers */
        max-height: 90dvh;             /* Dynamic viewport - respects browser chrome */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        max-width: -moz-available;
        max-width: -webkit-fill-available;
        max-width: stretch;
        animation: slideUpMobile 0.3s ease;
    }

    @keyframes slideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .auth-modal-close {
        top: 12px;
        right: 12px;
    }

    .auth-title {
        font-size: 24px;
    }

    .auth-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* User Icon Styles (for header) */
.user-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    position: relative;
}

.user-icon-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.5;
    fill: none;
    stroke: currentColor;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* User Dropdown (when logged in) */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 8px 0;
    display: none;
    z-index: 1000;
}

.user-dropdown.open {
    display: block;
}

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.user-dropdown-name {
    font-weight: 500;
    color: #1a1a1a;
    font-size: 14px;
}

.user-dropdown-email {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.user-dropdown a,
.user-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: #f5f5f5;
}

.user-dropdown a svg,
.user-dropdown button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

.user-dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 8px 0;
}

/* Phone Input with Country Code */
.auth-phone-wrapper {
    display: flex;
    gap: 8px;
}

.auth-country-select {
    width: 90px;
    padding: 12px 8px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
}

.auth-country-select:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

.auth-phone-wrapper input[type="tel"] {
    flex: 1;
    min-width: 0;
}

.auth-country-select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    color: #666;
}
