/**
 * 3D Gift Bag Customizer - Product Page Floating Button & Modal Styles
 */

/* 1. Floating Trigger Button (Right Center - Desktop Only) */
.giftbag-floating-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
    background: #181b20;
    color: #ffffff;
    padding: 10px 14px 10px 12px;
    border-radius: 16px 0 0 16px;
    border: 1px solid rgba(226, 195, 108, 0.4);
    border-right: none;
    box-shadow: -4px 6px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    backdrop-filter: blur(8px);
}

.giftbag-floating-btn:hover {
    background: #000000;
    border-color: #e2c36c;
    box-shadow: -6px 8px 25px rgba(0, 0, 0, 0.5), 0 0 14px rgba(226, 195, 108, 0.35);
}

body.giftbag-modal-open .giftbag-floating-btn {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-50%) translateX(30px) !important;
}

.giftbag-btn-icon-wrapper {
    background: rgba(226, 195, 108, 0.18);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e2c36c;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.giftbag-btn-label {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.giftbag-btn-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-transform: uppercase;
    color: #ffffff;
}

.giftbag-btn-subtitle {
    font-size: 10px;
    color: #e2c36c;
    font-weight: 600;
}

/* 1b. In-Page Action Button (Inside Product Purchase Area) */
.giftbag-inpage-cta-wrapper {
    margin: 12px 0 16px 0;
    width: 100%;
}

.giftbag-inpage-trigger-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
    background: #181b20 !important;
    color: #ffffff !important;
    border: 1px solid rgba(226, 195, 108, 0.5) !important;
    border-radius: 8px !important;
    padding: 13px 20px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
}

.giftbag-inpage-trigger-btn:hover {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #e2c36c !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 0 12px rgba(226, 195, 108, 0.3) !important;
    transform: translateY(-1px) !important;
}

.giftbag-inpage-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e2c36c;
    flex-shrink: 0;
}

.giftbag-inpage-btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    line-height: 1.25;
}

.giftbag-inpage-btn-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffffff;
}

.giftbag-inpage-btn-sub {
    font-size: 11px;
    color: #e2c36c;
    font-weight: 500;
    opacity: 0.95;
}

/* 2. Modal Overlay & Container */
.giftbag-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

body.giftbag-modal-open {
    overflow: hidden !important;
}

.giftbag-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.giftbag-modal-wrapper {
    position: relative;
    width: 95vw;
    max-width: 1400px;
    height: 92vh;
    max-height: 900px;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    animation: giftbagModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes giftbagModalPop {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.giftbag-modal-header {
    height: 48px;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    user-select: none;
}

.giftbag-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.giftbag-live-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.giftbag-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.giftbag-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.giftbag-modal-close:hover {
    background: rgba(239, 68, 68, 0.85);
    color: #ffffff;
}

.giftbag-iframe-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    background: #f8fafc;
}

.giftbag-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.giftbag-loader-overlay {
    position: absolute;
    inset: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.giftbag-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: giftbagSpin 0.8s linear infinite;
}

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

/* 3. Applied 3D Design Banner on Product Page */
.giftbag-applied-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 10px 14px;
    margin: 14px 0 18px 0;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.08);
}

.giftbag-applied-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.giftbag-applied-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid #dcfce7;
    padding: 2px;
}

.giftbag-applied-title {
    font-size: 13px;
    font-weight: 700;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 6px;
}

.giftbag-applied-badge {
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-family: monospace;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #86efac;
}

.giftbag-applied-desc {
    font-size: 11px;
    color: #15803d;
    margin-top: 2px;
}

.giftbag-applied-reedit-btn {
    background: #ffffff;
    border: 1px solid #86efac;
    color: #166534;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.giftbag-applied-reedit-btn:hover {
    background: #166534;
    color: #ffffff;
    border-color: #166534;
}

/* 4. Responsive Rules */
@media (max-width: 768px) {
    /* Hide the floating side button on mobile: users use the in-page button next to Add to Cart */
    .giftbag-floating-btn {
        display: none !important;
    }
    .giftbag-modal-overlay {
        padding: 0;
    }
    .giftbag-modal-wrapper {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .giftbag-inpage-cta-wrapper {
        margin: 10px 0 14px 0;
    }
    .giftbag-inpage-trigger-btn {
        padding: 12px 16px !important;
    }
}
