/**
 * Popup Manager Modal Styles
 * For Hyva theme
 */

/* Modal container */
.popup-manager-modal {
    position: relative;
    max-width: 28rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: visible; /* Allow close button to be visible outside if needed */
}

@media (min-width: 768px) {
    .popup-manager-modal {
        max-width: 36rem;
    }
}

/* Wheel popup: responsive, contenuto dentro il banner */
.popup-wheel-of-fortune.popup-manager-modal {
    max-width: min(30rem, 94vw);
    overflow: hidden;
}
@media (min-width: 768px) {
    .popup-wheel-of-fortune.popup-manager-modal {
        max-width: 38rem;
    }
}
@media (min-width: 1024px) {
    .popup-wheel-of-fortune.popup-manager-modal {
        max-width: 44rem;
    }
}

/* Transparent overlay for wheel: no gray background, integrated in banner */
.fixed.inset-0.z-50:has(.popup-wheel-of-fortune) {
    background: transparent !important;
}
.fixed.inset-0.z-50:has(.popup-wheel-of-fortune) > div {
    padding: 0.5rem;
}

/* Close button */
.popup-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.95);
    z-index: 10;
    transition: opacity 0.2s ease, color 0.2s ease;
}
.popup-close-btn:hover {
    color: #fff;
    opacity: 1;
}
.popup-close-btn svg {
    width: 22px;
    height: 22px;
}
/* Ruota: pulsante chiudi dentro l’header, stile coerente */
.popup-wheel-of-fortune .popup-close-btn {
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.9);
}
.popup-wheel-of-fortune .popup-close-btn:hover {
    color: #fff;
}

/* Header with gradient */
.popup-header {
    background: linear-gradient(135deg, #ec4899 0%, #ef4444 50%, #f59e0b 100%);
    padding: 24px 20px;
    text-align: center;
}

/* Free gifts popup header (green) */
.popup-free-gifts .popup-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
}

/* Milestone icons grid: 1–6 columns via class */
.milestone-icons-grid .grid {
    display: grid;
    gap: 0.5rem;
}
.milestone-icons-grid .grid.milestone-cols-1 { grid-template-columns: repeat(1, 1fr); }
.milestone-icons-grid .grid.milestone-cols-2 { grid-template-columns: repeat(2, 1fr); }
.milestone-icons-grid .grid.milestone-cols-3 { grid-template-columns: repeat(3, 1fr); }
.milestone-icons-grid .grid.milestone-cols-4 { grid-template-columns: repeat(4, 1fr); }
.milestone-icons-grid .grid.milestone-cols-5 { grid-template-columns: repeat(5, 1fr); }
.milestone-icons-grid .grid.milestone-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Wheel result actions: hidden by default, shown by JS */
.wheel-result-actions.popup-actions {
    display: none;
}
.wheel-result-actions.popup-actions.is-visible {
    display: block;
}
.wheel-friend-form {
    display: none;
}
.wheel-friend-form.is-visible {
    display: block;
}
.wheel-result-feedback {
    display: none;
}
.wheel-result-feedback.is-visible {
    display: block;
}
.popup-wheel-actions.wheel-spin-actions-hidden {
    display: none !important;
}

.popup-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.popup-header-emoji {
    font-size: 32px;
}

.popup-header-title {
    font-size: 24px;
    font-weight: bold;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Content area */
.popup-body {
    padding: 24px;
    background: white;
}

.popup-content {
    text-align: center;
    color: #374151;
    font-size: 16px;
    line-height: 1.6;
}

/* Coupon box */
.popup-coupon-box {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    border: 2px dashed #fbbf24;
    border-radius: 12px;
    text-align: center;
}

.popup-coupon-label {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.popup-coupon-display {
    display: inline-flex;
    align-items: center;
    background: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #fcd34d;
}

.popup-coupon-code {
    font-size: 24px;
    font-family: monospace;
    font-weight: bold;
    color: #dc2626;
    letter-spacing: 2px;
}

.popup-copy-btn {
    margin-left: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    line-height: 1;
}

/* Action buttons */
.popup-actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.popup-btn-primary {
    padding: 14px 32px;
    background: linear-gradient(135deg, #ec4899 0%, #ef4444 100%);
    color: white;
    font-weight: 600;
    font-size: 16px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
    transition: all 0.2s ease;
}

.popup-btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(236, 72, 153, 0.5);
}

/* Green button variant for apply coupon action */
.popup-btn-green {
    padding: 14px 32px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-weight: 600;
    font-size: 16px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
}

.popup-btn-green:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

.popup-btn-green:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.popup-btn-secondary {
    padding: 10px 20px;
    background: none;
    color: #9ca3af;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.popup-btn-secondary:hover {
    color: #6b7280;
}

/* ========================================
   Newsletter Popup Styles
   ======================================== */

/* Newsletter header gradient - blue/purple */
.popup-header-newsletter {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
}

/* Newsletter form styles */
.popup-newsletter-form {
    width: 100%;
}

.popup-newsletter-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popup-newsletter-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.2s ease;
    outline: none;
}

.popup-newsletter-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.popup-newsletter-input::placeholder {
    color: #9ca3af;
}

/* Newsletter subscribe button - purple gradient */
.popup-btn-newsletter {
    width: 100%;
    padding: 14px 32px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-weight: 600;
    font-size: 16px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.popup-btn-newsletter:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

.popup-btn-newsletter:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Newsletter message area */
.popup-newsletter-message {
    min-height: 20px;
    text-align: center;
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Wheel of Fortune - WOW effect
   ======================================== */

.popup-wheel-of-fortune .popup-header-wheel {
    position: relative;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 30%, #b45309 60%, #92400e 100%);
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.4);
}

.popup-wheel-body {
    text-align: center;
}

.popup-wheel-intro {
    font-size: 15px;
    color: #4b5563;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.wheel-container {
    position: relative;
    width: min(320px, 78vw);
    height: min(320px, 78vw);
    max-width: 320px;
    max-height: 320px;
    margin: 0 auto 1.5rem;
}

.wheel-pointer {
    position: absolute;
    top: -4%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: min(16px, 5vw) solid transparent;
    border-right: min(16px, 5vw) solid transparent;
    border-top: min(24px, 7vw) solid #dc2626;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    z-index: 20;
    animation: wheel-pointer-pulse 1.2s ease-in-out infinite;
}

@keyframes wheel-pointer-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
    50% { transform: translateX(-50%) scale(1.08); opacity: 0.9; }
}

.wheel-outer {
    position: absolute;
    inset: 12%;
    border-radius: 50%;
    background: linear-gradient(145deg, #1f2937 0%, #111827 100%);
    box-shadow: 0 0 0 8px #fbbf24, 0 0 24px rgba(251, 191, 36, 0.5), inset 0 0 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wheel-inner {
    position: absolute;
    width: 81.25%;
    height: 81.25%;
    top: 50%;
    left: 50%;
    margin-top: -40.625%;
    margin-left: -40.625%;
    border-radius: 50%;
    overflow: hidden;
    transform: rotate(0deg);
    transition: transform 6s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.4);
}

.wheel-inner.spinning {
    transition: transform 6s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    left: 50%;
    top: 0;
    transform-origin: 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: clamp(12px, 4vw, 16px);
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.2);
}

/* All labels horizontal, same orientation (radial from center → text baseline horizontal) */
.wheel-segment-text {
    display: inline-block;
    white-space: nowrap;
    padding: 0 4px;
    text-align: center;
}
.wheel-segment-text-two-lines {
    white-space: normal;
    line-height: 1.15;
}
/* Segment centers at 45°, 135°, 225°, 315° → counter-rotate so text is horizontal */
.wheel-seg-0 .wheel-segment-text { transform: rotate(-45deg); }
.wheel-seg-1 .wheel-segment-text { transform: rotate(-135deg); }
.wheel-seg-2 .wheel-segment-text { transform: rotate(-225deg); }
.wheel-seg-3 .wheel-segment-text { transform: rotate(-315deg); }

.wheel-seg-0 { transform: rotate(0deg);   background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.wheel-seg-1 { transform: rotate(90deg); background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); }
.wheel-seg-2 { transform: rotate(180deg); background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); }
.wheel-seg-3 { transform: rotate(270deg); background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }

.wheel-result {
    display: none;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
}

.wheel-result.show {
    display: block;
    animation: wheel-result-pop 0.5s ease-out;
}

@keyframes wheel-result-pop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.wheel-result-emoji {
    font-size: 48px;
    margin-bottom: 0.5rem;
    animation: wheel-bounce 0.6s ease-out;
}

@keyframes wheel-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.wheel-result-message {
    font-size: 18px;
    font-weight: 700;
    color: #92400e;
    margin: 0 0 0.25rem;
}

.wheel-result-email {
    font-size: 14px;
    color: #b45309;
    margin: 0;
}

/* Wheel result: azioni e form con spaziatura chiara e responsive */
.wheel-result-actions {
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
    margin-top: 20px;
}

.wheel-result-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wheel-result-actions .popup-btn-wheel,
.wheel-result-actions .popup-btn-wheel-friend,
.wheel-result-actions .popup-btn-wheel-self {
    width: 100%;
    max-width: 100%;
    text-align: center;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wheel-result-actions .popup-btn-wheel:hover:not(:disabled),
.wheel-result-actions .popup-btn-wheel-friend:hover:not(:disabled),
.wheel-result-actions .popup-btn-wheel-self:hover:not(:disabled) {
    transform: scale(1.02);
}

/* "Send to a friend" button – green as in banner, same style as "Send to my email" */
.popup-btn-wheel-friend {
    color: #fff;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.popup-btn-wheel-friend:hover:not(:disabled) {
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.5);
}

/* "Non ho amici, lo voglio io" – grigio */
.popup-btn-wheel-self {
    color: #374151;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.popup-btn-wheel-self:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.wheel-friend-form {
    width: 100%;
    margin-top: 24px;
    padding: 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-align: left;
}

.wheel-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.wheel-form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 18px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wheel-form-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* Blocco privacy: checkbox + link "Accetto privacy" */
.wheel-privacy-block {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.wheel-privacy-check {
    margin-top: 5px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wheel-privacy-label-wrap {
    flex: 1;
}

.wheel-privacy-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 14px;
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
    text-align: left;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
}

.wheel-privacy-link:hover {
    color: #1d4ed8;
}

/* Modal privacy – testo legale, sopra tutto (anche Hyva) */
.wheel-privacy-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.wheel-privacy-modal[hidden] {
    display: none !important;
}

.wheel-privacy-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.wheel-privacy-modal-box {
    position: relative;
    max-width: 28rem;
    width: 100%;
    max-height: 85vh;
    overflow: auto;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 24px;
}

.wheel-privacy-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 16px;
}

.wheel-privacy-modal-body {
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 20px;
}

.wheel-privacy-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

/* Responsive: ruota e form */
@media (max-width: 480px) {
    .wheel-result-actions {
        gap: 16px;
        margin-top: 16px;
    }
    .wheel-result-actions-buttons {
        gap: 12px;
    }
    .wheel-result-actions .popup-btn-wheel,
    .wheel-result-actions .popup-btn-wheel-friend,
    .wheel-result-actions .popup-btn-wheel-self {
        padding: 14px 20px;
        font-size: 15px;
    }
    .wheel-friend-form {
        margin-top: 20px;
        padding: 18px;
    }
    .wheel-form-label {
        margin-bottom: 8px;
    }
    .wheel-form-input {
        padding: 12px 14px;
        margin-bottom: 14px;
        font-size: 16px;
    }
    .wheel-privacy-block {
        margin-bottom: 16px;
    }
    .wheel-privacy-modal {
        padding: 12px;
    }
    .wheel-privacy-modal-box {
        padding: 20px;
        max-height: 90vh;
    }
    .wheel-privacy-modal-title {
        font-size: 17px;
        margin-bottom: 12px;
    }
    .wheel-privacy-modal-body {
        font-size: 13px;
        margin-bottom: 16px;
    }
}

.wheel-result-feedback {
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0 0;
    text-align: center;
}

.popup-btn-wheel {
    padding: 16px 40px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
}

.popup-btn-wheel:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 28px rgba(245, 158, 11, 0.55);
}

.popup-btn-wheel:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.popup-wheel-of-fortune .wheel-container.hide-after-spin {
    opacity: 0.6;
    pointer-events: none;
}

.popup-wheel-of-fortune .popup-wheel-actions.hide-after-spin {
    display: none;
}

/* Confetti burst - WOW effect */
.wheel-confetti-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.wheel-confetti {
    position: absolute;
    top: -20px;
    border-radius: 2px;
    animation: wheel-confetti-fall 4s ease-out forwards;
    opacity: 0.95;
}

@keyframes wheel-confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0.95;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

/* Gift Wheel popup - slot machine */
.popup-gift-wheel.popup-manager-modal {
    max-width: min(22rem, 92vw);
    overflow: hidden;
}
@media (min-width: 768px) {
    .popup-gift-wheel.popup-manager-modal {
        max-width: 26rem;
    }
}

.popup-header-gift-wheel {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 50%, #4c1d95 100%);
}

.popup-gift-wheel-body {
    padding: 1rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.gift-wheel-intro {
    text-align: center;
    font-size: 0.95rem;
    color: #374151;
    margin-bottom: 1rem;
    width: 100%;
}

/* Gift Wheel Slot */
.gift-wheel-slot {
    margin: 1rem 0;
    padding: 1.5rem;
    border-radius: 12px;
    background: linear-gradient(180deg, #e9d5ff 0%, #c4b5fd 50%, #a78bfa 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    text-align: center;
    transition: all 0.3s ease;
}

.gift-wheel-slot.spinning {
    animation: slot-pulse 0.5s ease-in-out infinite;
}

@keyframes slot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.8; }
}

.gift-wheel-placeholder-emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.gift-wheel-placeholder-text {
    font-size: 0.95rem;
    color: #1f2937;
}

/* Winner card inside slot */
.gift-wheel-winner {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: winner-pop 0.4s ease-out;
}

@keyframes winner-pop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.gift-wheel-winner img {
    max-height: 80px;
    max-width: 100px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.gift-wheel-winner .name {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.gift-wheel-winner .price {
    font-size: 0.9rem;
    color: #6b7280;
    text-decoration: line-through;
}

.gift-wheel-actions {
    display: none;
    gap: 0.75rem;
    justify-content: center;
}

.gift-wheel-actions.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gift-wheel-spin-actions {
    width: 100%;
}

.gift-wheel-spin-actions.hidden {
    display: none !important;
}
