:root {
    --popup-text-primary: #f8fafc;
    --popup-text-secondary: #e2e8f0;
    --popup-text-tertiary: #94a3b8;
    --popup-bg-card: #1e293b;
    --popup-border-color: rgba(71, 85, 105, 0.2);
    --popup-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
/* High contrast mode support */
@media (prefers-contrast: high) {
    .popup-content {
        border: 2px solid;
        box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
    }
    
    .highlight-text {
        border: 2px solid #dc2626;
        background: rgba(220, 38, 38, 0.2);
    }
    
    .severe-warning-text {
        border: 2px solid #b91c1c;
        background: rgba(185, 28, 28, 0.15);
    }
    
    .popup-btn.warning-btn {
        border: 2px solid #991b1b;
    }
    
    .checkmark {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .popup-modal,
    .popup-content,
    .popup-icon.warning,
    .highlight-text,
    .severe-warning-text,
    .warning-badge {
        animation: none !important;
        transition: none !important;
    }
}
}

[data-theme="light"] {
    --popup-text-primary: #1e293b;
    --popup-text-secondary: #475569;
    --popup-text-tertiary: #64748b;
    --popup-bg-card: rgba(248, 250, 252, 0.98);
    --popup-border-color: rgba(203, 213, 225, 0.3);
    --popup-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

:root {
    --text-primary: var(--popup-text-primary);
    --text-secondary: var(--popup-text-secondary);
    --text-tertiary: var(--popup-text-tertiary);
    --bg-card: var(--popup-bg-card);
    --border-color: var(--popup-border-color);
}

.popup-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-modal.active {
    opacity: 1;
    visibility: visible;
}

.popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 10, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.popup-content {
    position: relative;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, rgba(71, 85, 105, 0.2));
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 380px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-modal.active .popup-content {
    transform: scale(1);
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color, rgba(45, 212, 192, 0.14));
}

.popup-header h3 {
    font-family: 'Noto Serif SC', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
    margin: 0;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.popup-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #94a3b8);
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.popup-close:hover {
    background: rgba(45, 212, 192, 0.08);
    color: var(--teal, #2DD4C0);
}

.popup-close:active {
    transform: scale(0.95);
}

.popup-body {
    padding: 24px;
    text-align: center;
}

.popup-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--teal-mist, #0D8F80), var(--teal-deep, #1AAD9A));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 24px;
    box-shadow: 0 8px 24px rgba(26, 173, 154, 0.3);
}

.popup-icon.warning {
    background: linear-gradient(135deg, #DC2626, #EF4444);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.4);
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.popup-message {
    font-family: 'Lato', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary, #e2e8f0);
    margin: 0;
    letter-spacing: 0.02em;
    font-weight: 500;
}

.warning-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--teal-mist, #0D8F80), var(--teal-deep, #1AAD9A));
    border-radius: 9999px;
    font-family: 'Lato', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin-bottom: 16px;
    letter-spacing: 0.05em;
    animation: badge-glow 2s infinite alternate;
}

@keyframes badge-glow {
    0% { box-shadow: 0 0 0 rgba(45, 212, 192, 0.3); }
    100% { box-shadow: 0 0 20px rgba(45, 212, 192, 0.5); }
}

.warning-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 18px;
    font-weight: 700;
    color: #F87171;
    margin: 0 0 12px 0;
    letter-spacing: 0.03em;
    text-shadow: 0 2px 4px rgba(248, 113, 113, 0.2);
}

.warning-text {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary, #cbd5e1);
    margin: 0;
    font-weight: 500;
}

.highlight-text {
    color: #F87171;
    font-weight: 700;
    background: rgba(248, 113, 113, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin: 4px 0;
    border-left: 3px solid #F87171;
    animation: highlight-pulse 3s infinite;
}

@keyframes highlight-pulse {
    0%, 100% { background: rgba(248, 113, 113, 0.1); }
    50% { background: rgba(248, 113, 113, 0.2); }
}

.severe-warning-text {
    color: #DC2626;
    font-weight: 800;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(239, 68, 68, 0.1));
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-block;
    margin: 8px 0;
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-left: 4px solid #DC2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
    animation: severe-pulse 1.5s infinite;
    font-size: 14px;
}

@keyframes severe-pulse {
    0%, 100% { 
        background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(239, 68, 68, 0.1));
        transform: scale(1);
    }
    50% { 
        background: linear-gradient(135deg, rgba(220, 38, 38, 0.25), rgba(239, 68, 68, 0.15));
        transform: scale(1.02);
    }
}

.popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color, rgba(45, 212, 192, 0.14));
    background: rgba(255, 255, 255, 0.02);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color, rgba(45, 212, 192, 0.14));
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: var(--teal, #2DD4C0);
    border-color: var(--teal, #2DD4C0);
}

.checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    opacity: 1;
}

.checkbox-text {
    font-family: 'Lato', sans-serif;
    font-size: 13px;
    color: var(--text-secondary, #cbd5e1);
    letter-spacing: 0.02em;
    font-weight: 500;
}

.popup-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--teal-mist, #0D8F80), var(--teal-deep, #1AAD9A));
    border: none;
    border-radius: 8px;
    color: white;
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(26, 173, 154, 0.3);
}

.popup-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(26, 173, 154, 0.4);
}

.popup-btn:active {
    transform: translateY(0);
}

.popup-btn.warning-btn {
    background: linear-gradient(135deg, #DC2626, #EF4444);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.popup-btn.warning-btn:hover {
    background: linear-gradient(135deg, #B91C1C, #DC2626);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.5);
}

/* Light theme adjustments */
[data-theme="light"] .popup-content {
    background: rgba(248, 250, 252, 0.98);
    border: 1px solid rgba(203, 213, 225, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .popup-header h3 {
    color: #1e293b;
    font-weight: 700;
}

[data-theme="light"] .popup-message {
    color: #475569;
}

[data-theme="light"] .warning-title {
    color: #dc2626;
    text-shadow: 0 1px 2px rgba(220, 38, 38, 0.1);
}

[data-theme="light"] .warning-text {
    color: #334155;
    line-height: 1.7;
}

[data-theme="light"] .highlight-text {
    color: #b91c1c;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), rgba(239, 68, 68, 0.05));
    border-left: 3px solid #dc2626;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

[data-theme="light"] .severe-warning-text {
    color: #991b1b;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.12), rgba(239, 68, 68, 0.08));
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-left: 4px solid #b91c1c;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
    font-weight: 700;
}

[data-theme="light"] .popup-footer {
    background: rgba(241, 245, 249, 0.6);
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

[data-theme="light"] .checkmark {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #cbd5e1;
}

[data-theme="light"] .checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: #0f172a;
    border-color: #0f172a;
}

[data-theme="light"] .checkbox-text {
    color: #475569;
    font-weight: 500;
}

[data-theme="light"] .popup-close {
    background: rgba(241, 245, 249, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.3);
    color: #64748b;
}

[data-theme="light"] .popup-close:hover {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.2);
}

[data-theme="light"] .warning-badge {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .popup-btn.warning-btn {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.3);
}

[data-theme="light"] .popup-btn.warning-btn:hover {
    background: linear-gradient(135deg, #991b1b, #b91c1c);
    box-shadow: 0 6px 16px rgba(185, 28, 28, 0.4);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .popup-content {
        max-width: 320px;
        width: 92%;
    }
    
    .popup-header {
        padding: 16px 20px 12px;
    }
    
    .popup-header h3 {
        font-size: 16px;
    }
    
    .popup-body {
        padding: 20px;
    }
    
    .popup-icon {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }
    
    .popup-icon.warning {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .warning-title {
        font-size: 16px;
    }
    
    .warning-text {
        font-size: 13px;
        color: #475569;
        line-height: 1.6;
    }
    
    .highlight-text {
        font-size: 13px;
        padding: 3px 6px;
        color: #b91c1c;
        background: linear-gradient(135deg, rgba(220, 38, 38, 0.06), rgba(239, 68, 68, 0.04));
        border-left: 3px solid #dc2626;
    }
    
    .severe-warning-text {
        font-size: 13px;
        padding: 5px 8px;
        margin: 6px 0;
        color: #991b1b;
        background: linear-gradient(135deg, rgba(220, 38, 38, 0.1), rgba(239, 68, 68, 0.08));
        border: 1px solid rgba(220, 38, 38, 0.2);
        border-left: 4px solid #b91c1c;
    }
    
    .warning-badge {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .popup-footer {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .checkbox-container {
        justify-content: center;
    }
    
    .popup-btn.warning-btn {
        justify-content: center;
        font-size: 13px;
    }
}