/* Tax Deduction Popup System for Mobile */
/* Solves viewport focus issues on Chrome/Opera mobile */

@media (max-width: 768px) {
    /* Popup Overlay */
    .deduction-popup-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99999;
        display: none;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(2px);
        opacity: 0;
        transition: opacity 0.25s ease;
    }

    .deduction-popup-overlay.active {
        display: flex;
        opacity: 1;
    }

    /* Popup Container */
    .deduction-popup {
        background: white;
        border-radius: 8px;
        width: clamp(300px, 88vw, 400px);
        max-height: 70vh;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
        transform: translateY(30px) scale(0.95);
        transition: all 0.25s ease-out;
        overflow: hidden;
        position: relative;
        border: 1px solid #e1e8ed;
    }

    .deduction-popup-overlay.active .deduction-popup {
        transform: translateY(0) scale(1);
    }

    /* Popup Header */
    .deduction-popup-header {
        padding: 18px 20px 16px 20px;
        background: #f8f9fa;
        border-bottom: 1px solid #e1e8ed;
        text-align: center;
        position: relative;
    }

    .deduction-popup-title {
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        color: #333;
    }

    .deduction-popup-subtitle {
        font-size: 13px;
        color: #666;
        margin: 2px 0 0 0;
        font-weight: 400;
    }

    /* Popup Content */
    .deduction-popup-content {
        padding: 20px;
        text-align: center;
    }

    /* Input Container */
    .deduction-popup-input-container {
        position: relative;
        margin: 16px 0 20px 0;
    }

    .deduction-popup-input {
        width: 100%;
        height: 48px;
        font-size: 18px;
        font-weight: 500;
        text-align: center;
        border: 2px solid #ddd;
        border-radius: 6px;
        background: white;
        color: #333;
        outline: none;
        transition: all 0.2s ease;
        box-sizing: border-box;
        -webkit-appearance: none;
        -moz-appearance: textfield;
    }

    .deduction-popup-input::-webkit-outer-spin-button,
    .deduction-popup-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .deduction-popup-input:focus {
        border-color: #4A90E2;
        background: white;
        box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    }

    .deduction-popup-currency {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px;
        color: #666;
        pointer-events: none;
    }

    /* Limit Info */
    .deduction-popup-limit {
        font-size: 12px;
        color: #666;
        margin-top: 6px;
        font-weight: 400;
    }

    /* Action Buttons */
    .deduction-popup-actions {
        display: flex;
        gap: 12px;
        justify-content: center;
        margin-top: 20px;
    }

    .deduction-popup-btn {
        width: 100px;
        height: 40px;
        border-radius: 6px;
        border: 1px solid #ddd;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        background: white;
    }

    .deduction-popup-btn:active {
        transform: translateY(1px);
    }

    /* Confirm Button */
    .deduction-popup-confirm {
        background: #4A90E2;
        color: white;
        border-color: #4A90E2;
    }

    .deduction-popup-confirm:hover {
        background: #357ABD;
        border-color: #357ABD;
    }

    /* Cancel Button */
    .deduction-popup-cancel {
        background: white;
        color: #666;
        border-color: #ddd;
    }

    .deduction-popup-cancel:hover {
        background: #f8f9fa;
        border-color: #999;
        color: #333;
    }

    /* Button Text */
    .deduction-popup-confirm::before {
        content: 'Save';
    }

    .deduction-popup-cancel::before {
        content: 'Cancel';
    }

    /* Hide the overlay when scrolling to prevent viewport issues */
    .deduction-popup-overlay.hide-on-scroll {
        display: none !important;
    }

    /* Prevent body scroll when popup is active */
    body.deduction-popup-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    /* Enhanced accessibility */
    .deduction-popup-btn:focus {
        outline: none;
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.3);
    }

    /* Animation for closing */
    .deduction-popup-overlay.closing {
        opacity: 0;
    }

    .deduction-popup-overlay.closing .deduction-popup {
        transform: translateY(50px) scale(0.9);
    }
}

/* Desktop and larger screens - hide popup system */
@media (min-width: 769px) {
    .deduction-popup-overlay {
        display: none !important;
    }
}