/**
 * Iyzico Checkout Modal/Popup Styles
 * Used for inline CheckoutForm integration
 */

/* Modal Overlay */
.iyzico-checkout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.iyzico-checkout-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.iyzico-checkout-modal {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.iyzico-checkout-overlay.active .iyzico-checkout-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.iyzico-checkout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e6e6e6;
    background: #f9f9f9;
}

.iyzico-checkout-title {
    font-size: 18px;
    font-weight: 600;
    color: #1A6355;
    margin: 0;
}

.iyzico-checkout-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.iyzico-checkout-close:hover {
    background: #eee;
    color: #333;
}

/* Modal Body */
.iyzico-checkout-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 400px;
}

/* Iyzico iframe container */
.iyzico-checkout-body #iyzipay-checkout-form {
    min-height: 400px;
}

/* Iyzico iframe wrapper (new isolation approach) */
#iyzico-frame-container {
    width: 100%;
    min-height: 500px;
    display: block;
}

#iyzico-frame {
    width: 100%;
    min-height: 500px;
    border: none;
    display: block;
}

/* Loading State */
.iyzico-checkout-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 300px;
}

.iyzico-checkout-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e6e6e6;
    border-top-color: #1A6355;
    border-radius: 50%;
    animation: iyzico-spin 0.8s linear infinite;
}

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

.iyzico-checkout-loading-text {
    margin-top: 16px;
    color: #666;
    font-size: 14px;
}

/* Success State */
.iyzico-checkout-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.iyzico-checkout-success-icon {
    width: 64px;
    height: 64px;
    background: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.iyzico-checkout-success-icon::after {
    content: '';
    width: 24px;
    height: 12px;
    border-left: 4px solid #fff;
    border-bottom: 4px solid #fff;
    transform: rotate(-45deg);
    margin-top: -4px;
}

.iyzico-checkout-success-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.iyzico-checkout-success-text {
    color: #666;
    font-size: 14px;
}

/* Error State */
.iyzico-checkout-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.iyzico-checkout-error-icon {
    width: 64px;
    height: 64px;
    background: #f44336;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 32px;
    color: #fff;
    font-weight: bold;
}

.iyzico-checkout-error-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.iyzico-checkout-error-text {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.iyzico-checkout-retry-btn {
    background: #b9475e;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.iyzico-checkout-retry-btn:hover {
    background: #a03d52;
}

/* Mobile Responsive - Slide Up Drawer */
@media (max-width: 670px) {
    .iyzico-checkout-overlay {
        align-items: flex-end;
    }

    .iyzico-checkout-modal {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .iyzico-checkout-overlay.active .iyzico-checkout-modal {
        transform: translateY(0);
    }

    .iyzico-checkout-header {
        padding: 20px;
        position: relative;
    }

    /* Drag handle for mobile */
    .iyzico-checkout-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
    }

    .iyzico-checkout-body {
        padding-bottom: 20px;
    }
}

/* Tablet */
@media (max-width: 1050px) and (min-width: 671px) {
    .iyzico-checkout-modal {
        max-width: 450px;
    }
}

/* Payment processing overlay */
.iyzico-processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.iyzico-processing-content {
    text-align: center;
}

.iyzico-processing-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e6e6e6;
    border-top-color: #1A6355;
    border-radius: 50%;
    animation: iyzico-spin 0.8s linear infinite;
    margin: 0 auto 24px;
}

.iyzico-processing-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.iyzico-processing-text {
    color: #666;
    font-size: 14px;
}

/* Unified checkout specific styles */
.unified-checkout-btn {
    position: relative;
}

.unified-checkout-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.unified-checkout-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: iyzico-spin 0.8s linear infinite;
}
