/**
 * Maximum Club Authentication Popup Styles
 * Modern, Minimal, Clean Design - Popup Version
 */

/* Popup Overlay */
.wwb-auth-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    animation: fadeInOverlay 0.3s ease-out forwards;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.wwb-auth-popup-overlay.hiding {
    animation: fadeOutOverlay 0.3s ease-out forwards;
}

@keyframes fadeOutOverlay {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Popup Container */
.wwb-auth-popup-wrapper {
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    animation: slideUpPopup 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e5e7eb;
    position: relative;
    transform: scale(0.95);
    opacity: 0;
    animation: popupAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes popupAppear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.wwb-auth-popup-wrapper.hiding {
    animation: popupDisappear 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes popupDisappear {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
}

/* Close Button */
.wwb-auth-popup-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    color: #6b7280;
}

.wwb-auth-popup-close:hover {
    background: #e5e7eb;
    color: #111827;
    transform: rotate(90deg);
}

.wwb-auth-popup-close svg {
    width: 20px;
    height: 20px;
}

/* Container */
.wwb-auth-popup-container {
    overflow-y: auto;
    max-height: 90vh;
}

/* Header */
.wwb-auth-popup-header {
    text-align: center;
    padding: 40px 32px 32px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.wwb-auth-popup-logo {
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wwb-auth-popup-logo img {
    max-width: 210px;
    height: auto;
    display: block;
}

.wwb-auth-popup-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #111827;
    letter-spacing: -0.02em;
}

.wwb-auth-popup-subtitle {
    font-size: 14px;
    margin: 0;
    color: #6b7280;
    font-weight: 400;
}

/* Steps */
.wwb-auth-popup-steps {
    position: relative;
}

.wwb-auth-popup-step {
    padding: 32px;
    display: none;
}

.wwb-auth-popup-step.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wwb-auth-popup-step-content {
    max-width: 100%;
}

.wwb-popup-step-title {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

.wwb-popup-step-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 32px;
    line-height: 1.6;
}

/* Forms */
.wwb-auth-popup-form {
    width: 100%;
}

.wwb-popup-form-group {
    margin-bottom: 24px;
}

.wwb-popup-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.wwb-popup-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.wwb-popup-form-label-optional::after {
    content: ' (اختیاری)';
    font-weight: 400;
    color: #9ca3af;
}

.wwb-popup-form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    color: #111827;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.wwb-popup-form-input:focus {
    outline: none;
    border-color: #fb923c;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.1);
    background: #fff7ed;
}

.wwb-popup-form-input::placeholder {
    color: #9ca3af;
}

/* OTP Container */
.wwb-popup-otp-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 8px;
    direction: ltr;
}

.wwb-popup-otp-box {
    width: 56px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    background: #fef3f2;
    border: 1.5px solid #fecaca;
    border-radius: 12px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    direction: ltr;
}

.wwb-popup-otp-box:focus {
    outline: none;
    border-color: #fb923c;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.15);
    background: #fff7ed;
}

.wwb-popup-otp-box:not(:placeholder-shown) {
    border-color: #fb923c;
    background: #fff7ed;
}

@media (max-width: 640px) {
    .wwb-popup-otp-container {
        gap: 10px;
    }
    
    .wwb-popup-otp-box {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
}

/* Buttons */
.wwb-popup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 52px;
}

.wwb-popup-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wwb-popup-btn-primary {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(251, 146, 60, 0.3);
    position: relative;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.wwb-popup-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s;
}

.wwb-popup-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 6px 18px rgba(251, 146, 60, 0.4);
    transform: translateY(-1px);
}

.wwb-popup-btn-primary:hover:not(:disabled)::before {
    left: 100%;
}

.wwb-popup-btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(251, 146, 60, 0.3);
}

.wwb-popup-btn-block {
    width: 100%;
}

.wwb-popup-btn-text {
    background: transparent;
    color: #6b7280;
    padding: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
    font-size: 15px;
}

.wwb-popup-btn-text:hover {
    background: #f3f4f6;
    color: #111827;
}

.wwb-popup-btn.is-loading {
    pointer-events: none;
}

.wwb-popup-btn-loader {
    display: none;
}

.wwb-popup-btn.is-loading .wwb-popup-btn-loader {
    display: block;
}

.wwb-popup-btn.is-loading .wwb-popup-btn-text {
    display: none;
}

/* Spinner */
.wwb-popup-spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

.wwb-popup-spinner-circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 200;
        stroke-dashoffset: -35px;
    }
    100% {
        stroke-dasharray: 90, 200;
        stroke-dashoffset: -124px;
    }
}

/* Messages */
.wwb-popup-message {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    display: none;
    line-height: 1.5;
}

.wwb-popup-message.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wwb-popup-message.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    font-weight: 500;
}

.wwb-popup-message.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.wwb-popup-message.info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.wwb-popup-message.warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Success Box */
.wwb-popup-success-box {
    text-align: center;
    padding: 24px 0;
}

.wwb-popup-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: #166534;
    background: #f0fdf4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wwb-popup-success-icon svg {
    width: 36px;
    height: 36px;
}

/* Credit code check result */
.wwb-popup-code-check-result {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
}

.wwb-popup-code-check-result.success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.wwb-popup-code-check-result.error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.wwb-popup-code-check-result .wwb-checking {
    color: #374151;
}

.wwb-popup-code-check-result .wwb-success {
    color: #166534;
}

.wwb-popup-code-check-result .wwb-error {
    color: #991b1b;
}

/* Responsive */
@media (max-width: 640px) {
    .wwb-auth-popup-overlay {
        padding: 16px;
    }

    .wwb-auth-popup-wrapper {
        max-width: 100%;
        border-radius: 12px;
    }

    .wwb-auth-popup-header {
        padding: 32px 24px 24px;
    }

    .wwb-auth-popup-title {
        font-size: 22px;
    }

    .wwb-auth-popup-step {
        padding: 24px;
    }

    .wwb-popup-step-title {
        font-size: 18px;
    }

    .wwb-popup-form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Prevent body scroll when popup is open */
body.wwb-popup-open {
    overflow: hidden;
}

