/* ============================================
   Blysn Klarna v2 — Official Klarna-style UI
   ============================================ */

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Scroll lock --- */
.ai-scroll-disable {
    overflow: hidden;
}

/* --- A. Payment method label --- */
.wc_payment_method.payment_method_blysn_payment_klarna input + label[for="payment_method_blysn_payment_klarna"] {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: calc(100% - 32px);
    font-weight: 600;
    color: #000;
}

.wc_payment_method.payment_method_blysn_payment_klarna input + label[for="payment_method_blysn_payment_klarna"] img {
    height: 32px !important;
}

.wc_payment_method.payment_method_blysn_payment_klarna input[style] + label[for="payment_method_blysn_payment_klarna"] {
    width: 100%;
}

/* --- B. Payment info box --- */
.klarna-payment-info {
    background: #FFF0F5;
    border: 1px solid #FFD6E8;
    border-radius: 8px;
    padding: 16px;
}

.klarna-info-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #000;
    font-size: 14px;
}

.klarna-shield-icon {
    color: #FFA8CD;
    flex-shrink: 0;
}

.klarna-info-desc {
    font-size: 13px;
    color: #555;
    margin: 8px 0 0;
    line-height: 1.5;
}

.klarna-features {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.klarna-feature {
    font-size: 12px;
    color: #333;
    display: flex;
    align-items: center;
}

.klarna-check {
    color: #FFA8CD;
    font-weight: bold;
    margin-right: 4px;
}

/* --- B2. Klarna-branded Place Order button --- */
.woocommerce-checkout .place-order #place_order.klarna-button-style {
    background-color: #FFA8CD !important;
    color: transparent !important;
    background-image: url(../img/klarna.svg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 72px auto;
    border: none !important;
    border-radius: 25px !important;
    min-height: 48px;
    cursor: pointer;
    transition: filter 0.2s;
}
.woocommerce-checkout .place-order #place_order.klarna-button-style:hover {
    filter: brightness(0.93);
}

/* --- C. Modal overlay --- */
div.ai-fish-container {
    overflow: hidden;
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    background-color: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

/* --- D. Modal wrapper --- */
div.ai-fish-container .ai-wrapper {
    overflow: hidden;
    position: relative;
    margin: auto;
    width: 100%;
    height: 100%;
    background-color: #fff;
    box-sizing: border-box;
}

div.ai-fish-container .ai-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* --- E. Loading state --- */
.ai-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    z-index: 2;
}

.ai-loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

/* --- F. Close button --- */
.ai-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s ease;
}

.ai-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.ai-close-btn::before,
.ai-close-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 2px;
    background: #333;
    border-radius: 1px;
}

.ai-close-btn::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.ai-close-btn::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* --- Desktop modal --- */
@media (min-width: 768px) {
    div.ai-fish-container .ai-wrapper.blysn_payment_klarna {
        max-width: 480px;
        max-height: 700px;
        border-radius: 16px;
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
        animation: slideUp 0.35s ease-out;
    }
}

/* --- G. Mobile responsive --- */
@media (max-width: 767px) {
    div.ai-fish-container .ai-wrapper.blysn_payment_klarna {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .ai-close-btn {
        top: 8px;
        right: 8px;
    }
}