
/* Calculator Popup Styles */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup-enter {
    animation: slideUp 0.3s ease-out;
}

.popup-backdrop {
    animation: fadeIn 0.3s ease-out;
}

.popup-exit {
    animation: slideUp 0.3s ease-out reverse;
}

/* Prevent body scroll when popup is open */
body.popup-open {
    overflow: hidden;
}

/* Custom scrollbar for popup content */
.popup-content::-webkit-scrollbar {
    width: 8px;
}

.popup-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.popup-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Calculator popup specific styles */
#calculatorPopup {
    backdrop-filter: blur(8px);
}

#calculatorPopup .popup-backdrop {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

#calculatorPopup .bg-white {
    background: white !important;
    box-shadow: 0 25px 50px -12px rgba(132, 100, 221, 0.25);
    border: 1px solid #e5e7eb;
}

/* Calculator iframe container with scroll */
#calculatorPopup .flex-1 {
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    background: white;
}

#calculatorFrame {
    min-height: 600px;
    height: auto !important;
    background: white !important;
    /* Force white background and dark text in iframe */
    color-scheme: light;
}

/* Force all iframe content to use light theme */
#calculatorFrame::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    pointer-events: none;
    z-index: -1;
}

/* Loading animation improvements */
#calculatorLoading {
    background: white;
    color: #374151;
}

#calculatorLoading .animate-spin {
    animation-duration: 1s;
    border-color: #8b5cf6 transparent transparent transparent;
}

/* Error state styles */
.calculator-error {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* Success state styles */
.calculator-success {
    background: linear-gradient(135deg, #f0fdf4, #bbf7d0);
    border: 1px solid #86efac;
    color: #166534;
}

/* Remove black/dark elements */
#calculatorPopup * {
    color: inherit !important;
}

#calculatorPopup input,
#calculatorPopup select,
#calculatorPopup textarea,
#calculatorPopup button {
    background: white !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}

#calculatorPopup button {
    background: #8b5cf6 !important;
    color: white !important;
}

#calculatorPopup button:hover {
    background: #7c3aed !important;
}

/* Mobile responsiveness with scroll support */
@media (max-width: 768px) {
    #calculatorPopup .popup-enter > div {
        margin: 0.5rem;
        max-height: 95vh;
        display: flex;
        flex-direction: column;
    }
    
    #calculatorPopup .flex-1 {
        max-height: calc(95vh - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #calculatorPopup h2 {
        font-size: 1.25rem;
    }
    
    #calculatorFrame {
        min-height: 500px;
    }
}

/* Tablet responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
    #calculatorPopup .popup-enter > div {
        margin: 1rem;
        max-height: 92vh;
    }
    
    #calculatorPopup .flex-1 {
        max-height: calc(92vh - 100px);
    }
}

/* Ensure scrolling works on all devices */
#calculatorPopup .flex-1 {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* High contrast mode support - remove black backgrounds */
@media (prefers-contrast: high) {
    #calculatorPopup .popup-backdrop {
        background: rgba(255, 255, 255, 0.9);
    }
    
    #calculatorPopup .bg-white {
        border: 2px solid #8b5cf6;
        background: white !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .popup-enter,
    .popup-backdrop,
    .popup-exit {
        animation: none;
    }
    
    #calculatorLoading .animate-spin {
        animation: none;
    }
    
    #calculatorPopup .flex-1 {
        scroll-behavior: auto;
    }
}

/* Custom scrollbar for the calculator content area */
#calculatorPopup .flex-1::-webkit-scrollbar {
    width: 12px;
}

#calculatorPopup .flex-1::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 6px;
}

#calculatorPopup .flex-1::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
    border: 2px solid #f8fafc;
}

#calculatorPopup .flex-1::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Firefox scrollbar */
#calculatorPopup .flex-1 {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}
