/* --- 1. VARIABLES & THEME --- */
    :root {
      --primary-color: #0B1F51;    /* Navy */
      --text-color: #2B3445;       /* Body Text */
      --hover-color: #AFC8FF;      /* Light Blue Hover */
      --bg-color: #F8FAFC;
      --white: #FFFFFF;
      --border-color: #E2E8F0;
      --danger-color: #EF4444;     /* Red */
      --danger-bg: #FEF2F2;
      --info-bg: #EFF6FF;
      --info-text: #1E40AF;
      --warning-text: #B45309;
      --success-color: #059669;
    }

    #elcentralx_calculator_wrapper * { box-sizing: border-box; margin: 0; padding: 0; }

    #elcentralx_calculator_wrapper {
      font-family: 'Inter', sans-serif;
      background-color: var(--bg-color);
      color: var(--text-color);
      line-height: 1.6;
      padding: 20px;
      -webkit-font-smoothing: antialiased;
      width: 100%;
      max-width: 100%;
      overflow-x: hidden; /* Prevents parent horizontal scroll */
    }

    /* --- 2. LAYOUT --- */
    #elcentralx_calculator_wrapper .elcentralx_calculator-container {
      width: 100%;
      max-width: 1100px;
      margin: 0 auto;
      background: var(--white);
      border-radius: 12px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
      border: 1px solid var(--border-color);
      overflow: hidden;
    }

    #elcentralx_calculator_wrapper .elcentralx_calculator-grid {
      display: grid;
      grid-template-columns: 1fr 1fr; /* Equal distribution on desktop */
      min-height: 600px;
      max-width: 100%; /* Prevents grid blowout */
    }

    #elcentralx_calculator_wrapper .elcentralx_input-section, 
    #elcentralx_calculator_wrapper .elcentralx_results-section { padding: 35px; }

    #elcentralx_calculator_wrapper .elcentralx_input-section {
      background-color: #ffffff;
      border-right: 1px solid var(--border-color);
      display: flex;
      flex-direction: column;
      min-width: 0; /* CRITICAL: Allows grid item to shrink on mobile */
    }

    #elcentralx_calculator_wrapper .elcentralx_results-section {
      background-color: #fafbfd;
      display: flex;
      flex-direction: column;
      min-width: 0; /* CRITICAL: Allows grid item to shrink on mobile */
      position: relative;
    }
    
    #elcentralx_calculator_wrapper .elcentralx_section-title {
      color: var(--primary-color);
      font-size: 18px;
      font-weight: 800;
      margin-bottom: 20px;
      padding-bottom: 10px;
      border-bottom: 2px solid var(--border-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    /* --- 3. INPUTS & CONTROLS --- */
    
    #elcentralx_calculator_wrapper .elcentralx_type-selector {
        display: flex;
        gap: 10px;
        margin-bottom: 25px;
        background: #F1F5F9;
        padding: 5px;
        border-radius: 8px;
    }
    
    #elcentralx_calculator_wrapper .elcentralx_type-btn {
        flex: 1;
        padding: 14px 10px;
        border: none;
        background: transparent;
        color: #64748B;
        font-weight: 600;
        font-size: 14px;
        cursor: pointer;
        border-radius: 6px;
        transition: all 0.2s;
        text-align: center;
    }
    
    #elcentralx_calculator_wrapper .elcentralx_type-btn.elcentralx_active {
        background: var(--white);
        color: var(--primary-color);
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        font-weight: 700;
        border: 1px solid var(--border-color);
    }

    #elcentralx_calculator_wrapper .elcentralx_input-group { margin-bottom: 20px; position: relative; }
    
    #elcentralx_calculator_wrapper .elcentralx_input-group label {
      display: block; 
      margin-bottom: 8px;
      font-weight: 700; 
      color: var(--primary-color);
      font-size: 13px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    #elcentralx_calculator_wrapper .elcentralx_input-helper {
        display: block;
        font-size: 11px;
        color: #64748B;
        margin-top: -4px;
        margin-bottom: 8px;
        font-style: italic;
    }

    #elcentralx_calculator_wrapper .elcentralx_input-wrapper { position: relative; width: 100%; }

    #elcentralx_calculator_wrapper .elcentralx_input-field {
        width: 100%;
        padding: 14px; 
        border: 1px solid var(--border-color);
        border-radius: 8px;
        font-size: 15px; 
        background-color: var(--white);
        font-family: 'Inter', sans-serif;
        color: var(--primary-color);
        font-weight: 500;
        transition: border-color 0.2s;
    }

    #elcentralx_calculator_wrapper .elcentralx_input-field:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(11, 31, 81, 0.1);
    }

    #elcentralx_calculator_wrapper .elcentralx_input-field:disabled {
        background-color: #F1F5F9;
        cursor: not-allowed;
    }

    #elcentralx_calculator_wrapper .elcentralx_info-tooltip {
        cursor: help; 
        color: var(--info-text); 
        margin-left: 4px;
        font-size: 14px;
        font-weight: bold;
    }

    /* Accordion Styling */
    #elcentralx_calculator_wrapper .elcentralx_custom-accordion {
        background: #FFFFFF;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 20px;
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }
    
    #elcentralx_calculator_wrapper .elcentralx_custom-accordion summary {
        padding: 16px 20px;
        font-weight: 700;
        color: var(--primary-color);
        background: #F8FAFC;
        cursor: pointer;
        user-select: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-bottom: 1px solid transparent;
        transition: background 0.2s;
    }

    #elcentralx_calculator_wrapper .elcentralx_custom-accordion summary:hover {
        background: #F1F5F9;
    }
    
    #elcentralx_calculator_wrapper .elcentralx_custom-accordion summary::-webkit-details-marker {
        display: none;
    }
    
    #elcentralx_calculator_wrapper .elcentralx_custom-accordion summary::after {
        content: '▼';
        font-size: 12px;
        transition: transform 0.2s;
        color: var(--primary-color);
    }
    
    #elcentralx_calculator_wrapper .elcentralx_custom-accordion[open] summary {
        border-bottom-color: var(--border-color);
    }

    #elcentralx_calculator_wrapper .elcentralx_custom-accordion[open] summary::after {
        transform: rotate(180deg);
    }
    
    #elcentralx_calculator_wrapper .elcentralx_custom-accordion-content {
        padding: 20px;
    }

    /* Responsive Flexbox Quick Fill Bar */
    #elcentralx_calculator_wrapper .elcentralx_quick-fill-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        align-items: flex-end;
        background: #EFF6FF;
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 20px;
        border: 1px solid #DBEAFE;
    }
    #elcentralx_calculator_wrapper .elcentralx_quick-fill-bar .elcentralx_input-wrapper {
        flex: 1 1 70px; /* Allows inputs to wrap and share space nicely */
        min-width: 70px;
    }
    #elcentralx_calculator_wrapper .elcentralx_quick-fill-bar label {
        font-size: 10px;
        margin-bottom: 6px;
        color: var(--info-text);
        font-weight: 600;
        text-transform: none;
        letter-spacing: normal;
        display: block;
        white-space: nowrap;
    }
    #elcentralx_calculator_wrapper .elcentralx_quick-fill-bar input {
        padding: 10px;
        font-size: 13px;
        text-align: center;
    }
    #elcentralx_calculator_wrapper .elcentralx_quick-fill-btn {
        flex: 1 1 100%; /* Forces button to full width on small mobile if wrapped */
        padding: 12px 15px;
        background: var(--info-text);
        color: white;
        border: none;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 700;
        cursor: pointer;
        height: 42px;
        transition: background-color 0.2s;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    #elcentralx_calculator_wrapper .elcentralx_quick-fill-btn:hover { background-color: #1E3A8A; }

    @media (min-width: 500px) {
        #elcentralx_calculator_wrapper .elcentralx_quick-fill-btn {
            flex: 0 0 auto; /* Button sits on the same line on wider screens */
        }
    }
    
    /* Scroll/Swipe Hint (Visible on all devices for clarity) */
    #elcentralx_calculator_wrapper .elcentralx_swipe-hint {
        display: block;
        font-size: 12px;
        color: var(--info-text);
        text-align: center;
        margin-bottom: 8px;
        font-style: italic;
        font-weight: 600;
        background: #EFF6FF;
        padding: 6px;
        border-radius: 6px;
        animation: elcentralx_pulse 2s infinite;
    }

    @keyframes elcentralx_pulse {
        0% { opacity: 0.7; }
        50% { opacity: 1; }
        100% { opacity: 0.7; }
    }

    /* Sleek Table Responsive Wrapper */
    #elcentralx_calculator_wrapper .elcentralx_table-responsive {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: white;
        margin-bottom: 10px;
        display: block; /* Ensures width constraint works */
    }

    /* Custom thin scrollbar for tables */
    #elcentralx_calculator_wrapper .elcentralx_table-responsive::-webkit-scrollbar {
        height: 8px;
    }
    #elcentralx_calculator_wrapper .elcentralx_table-responsive::-webkit-scrollbar-track {
        background: #F1F5F9;
        border-radius: 0 0 8px 8px;
    }
    #elcentralx_calculator_wrapper .elcentralx_table-responsive::-webkit-scrollbar-thumb {
        background: #CBD5E1;
        border-radius: 4px;
    }
    #elcentralx_calculator_wrapper .elcentralx_table-responsive::-webkit-scrollbar-thumb:hover {
        background: #94A3B8;
    }

    /* Tables */
    #elcentralx_calculator_wrapper .elcentralx_year-table, 
    #elcentralx_calculator_wrapper .elcentralx_ledger-table {
        width: 100%;
        border-collapse: collapse;
        min-width: 520px; /* Maintained for table integrity, wrapper handles scroll */
    }
    #elcentralx_calculator_wrapper .elcentralx_year-table th, 
    #elcentralx_calculator_wrapper .elcentralx_ledger-table th {
        background: #F1F5F9;
        padding: 12px 15px;
        font-size: 12px;
        text-align: left;
        color: var(--primary-color);
        border-bottom: 1px solid var(--border-color);
        white-space: nowrap;
    }
    #elcentralx_calculator_wrapper .elcentralx_year-table td, 
    #elcentralx_calculator_wrapper .elcentralx_ledger-table td {
        padding: 10px 15px;
        background: white;
        border-bottom: 1px solid #F1F5F9;
        vertical-align: middle;
        font-size: 13px;
    }
    #elcentralx_calculator_wrapper .elcentralx_year-table input[type="text"] {
        width: 100%;
        padding: 8px 10px;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        font-size: 13px;
        min-width: 65px;
        max-width: 100px;
        text-align: center;
    }
    
    #elcentralx_calculator_wrapper .elcentralx_ledger-table td { text-align: right; }
    #elcentralx_calculator_wrapper .elcentralx_ledger-table td:first-child, 
    #elcentralx_calculator_wrapper .elcentralx_ledger-table th:first-child { text-align: left; }
    #elcentralx_calculator_wrapper .elcentralx_ledger-table tr:last-child td { font-weight: 700; background-color: #F8FAFC; border-top: 2px solid var(--border-color); }
    #elcentralx_calculator_wrapper .elcentralx_ledger-table .elcentralx_deduction { color: var(--danger-color); }
    #elcentralx_calculator_wrapper .elcentralx_ledger-table .elcentralx_credit { color: var(--success-color); }

    /* Breakdown Text Styling */
    #elcentralx_calculator_wrapper .elcentralx_breakdown-text {
        font-size: 11px;
        line-height: 1.6;
        color: #334155;
    }
    #elcentralx_calculator_wrapper .elcentralx_breakdown-line {
        display: flex;
        justify-content: space-between;
        margin-bottom: 2px;
        align-items: baseline;
    }
    #elcentralx_calculator_wrapper .elcentralx_breakdown-line.total {
        border-top: 1px solid #eee;
        padding-top: 4px;
        margin-top: 4px;
        font-weight: 600;
    }
    #elcentralx_calculator_wrapper .elcentralx_breakdown-line strong {
        color: var(--primary-color);
    }
    #elcentralx_calculator_wrapper .elcentralx_cap-warning {
        color: var(--warning-text);
        font-weight: 700;
    }

    /* Error States */
    #elcentralx_calculator_wrapper .elcentralx_input-field.elcentralx_error, 
    #elcentralx_calculator_wrapper .elcentralx_year-table input.elcentralx_error {
        border-color: var(--danger-color);
        background-color: #FEF2F2;
        box-shadow: 0 0 0 1px var(--danger-color);
    }

    #elcentralx_calculator_wrapper .elcentralx_error-msg {
        color: var(--danger-color);
        font-size: 12px;
        margin-top: 6px;
        font-weight: 600;
        display: none; 
        animation: elcentralx_fadeIn 0.3s;
    }

    @keyframes elcentralx_fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    #elcentralx_calculator_wrapper .elcentralx_field-error-text {
        color: var(--danger-color);
        font-size: 11px;
        margin-top: 2px;
        display: none;
    }
    
    /* Action Buttons */
    #elcentralx_calculator_wrapper .elcentralx_action-buttons { 
        margin-top: auto; 
        padding-top: 20px; 
        display: grid; 
        gap: 12px; 
    }
    
    #elcentralx_calculator_wrapper button.elcentralx_primary-btn {
      background-color: var(--primary-color); 
      color: white; 
      border: none; 
      padding: 18px; 
      border-radius: 8px;
      font-weight: 700; 
      font-size: 16px; 
      cursor: pointer; 
      transition: transform 0.1s, background-color 0.2s, opacity 0.2s;
      width: 100%;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    
    #elcentralx_calculator_wrapper button.elcentralx_primary-btn:hover:not(:disabled) { background-color: #1a3a7a; }
    #elcentralx_calculator_wrapper button.elcentralx_primary-btn:disabled { cursor: not-allowed; opacity: 0.7; }
    
    #elcentralx_calculator_wrapper button.elcentralx_secondary-btn {
      background-color: white; 
      color: var(--text-color); 
      border: 1px solid var(--border-color); 
      padding: 14px; 
      border-radius: 8px;
      font-weight: 600; 
      cursor: pointer;
      width: 100%;
      transition: background-color 0.2s;
    }
    #elcentralx_calculator_wrapper button.elcentralx_secondary-btn:hover { background-color: #F1F5F9; }

    /* --- 4. RESULTS UI --- */
    #elcentralx_calculator_wrapper .elcentralx_hero-card {
        background-color: var(--white);
        border-radius: 8px;
        border: 1px solid var(--border-color);
        border-left: 6px solid var(--primary-color);
        margin-bottom: 25px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        padding: 25px;
        text-align: center;
        /* Initially hidden */
        display: none; 
        transform: translateY(10px);
        transition: opacity 0.4s ease, transform 0.4s ease;
        opacity: 0;
    }
    
    #elcentralx_calculator_wrapper .elcentralx_hero-card.elcentralx_visible { 
        display: block; 
        opacity: 1; 
        transform: translateY(0); 
    }

    #elcentralx_calculator_wrapper .elcentralx_hero-label { font-size: 13px; color: var(--primary-color); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
    #elcentralx_calculator_wrapper .elcentralx_hero-value { font-size: 42px; font-weight: 800; color: var(--primary-color); margin-bottom: 5px; line-height: 1; }
    #elcentralx_calculator_wrapper .elcentralx_hero-subtext { font-size: 14px; color: #64748B; font-weight: 500; }

    #elcentralx_calculator_wrapper .elcentralx_breakdown-box {
        background: var(--white);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 20px;
        display: none; 
    }
    
    #elcentralx_calculator_wrapper .elcentralx_breakdown-header {
        background: #F1F5F9;
        padding: 12px 20px;
        font-size: 13px;
        font-weight: 700;
        color: var(--primary-color);
        text-transform: uppercase;
        border-bottom: 1px solid var(--border-color);
    }

    #elcentralx_calculator_wrapper .elcentralx_result-row {
        display: flex;
        justify-content: space-between;
        padding: 12px 20px;
        border-bottom: 1px solid #F1F5F9;
        font-size: 14px;
        color: #334155;
    }
    #elcentralx_calculator_wrapper .elcentralx_result-row:last-child { border-bottom: none; }
    #elcentralx_calculator_wrapper .elcentralx_result-val { font-weight: 700; color: var(--primary-color); }
    
    #elcentralx_calculator_wrapper .elcentralx_rule-note {
        background-color: var(--info-bg); color: var(--info-text); padding: 12px; border-radius: 6px; font-size: 13px; margin-top: 20px; border-left: 3px solid #3B82F6; line-height: 1.5; display: none;
    }

    #elcentralx_calculator_wrapper .elcentralx_disclaimer-box {
        margin-top: 40px;
        border-top: 2px dashed #E2E8F0;
        padding-top: 20px;
        font-size: 12px;
        color: #64748B;
        text-align: center;
        display: none; /* Hidden on screen, shown in print */
    }

    #elcentralx_calculator_wrapper .elcentralx_hidden { display: none !important; }
    
    /* ========================================================= */
    /* RESPONSIVE DESIGN - STRICT MOBILE FIXES                   */
    /* ========================================================= */

    @media (max-width: 1024px) {
      #elcentralx_calculator_wrapper .elcentralx_calculator-grid { grid-template-columns: 1fr; } /* Stack vertically on smaller screens */
      #elcentralx_calculator_wrapper .elcentralx_input-section { border-right: none; border-bottom: 1px solid var(--border-color); padding: 25px; }
      #elcentralx_calculator_wrapper .elcentralx_results-section { padding: 25px; }
    }

    @media (max-width: 600px) {
        /* Force side-by-side flex inputs to stack vertically */
        #elcentralx_calculator_wrapper .elcentralx_input-group > div[style*="display:flex"] {
            flex-direction: column !important;
        }
        
        /* Force side-by-side grid buttons to stack vertically */
        #elcentralx_calculator_wrapper .elcentralx_action-buttons > div[style*="grid"] {
            grid-template-columns: 1fr !important;
        }
        
        /* Wing Selectors to stack vertically */
        #elcentralx_calculator_wrapper .elcentralx_type-selector {
            flex-direction: column;
        }
    }

    @media (max-width: 480px) {
        #elcentralx_calculator_wrapper { padding: 5px; }
        #elcentralx_calculator_wrapper .elcentralx_input-section, 
        #elcentralx_calculator_wrapper .elcentralx_results-section { padding: 15px; }
        #elcentralx_calculator_wrapper .elcentralx_hero-value { font-size: 32px; }
        
        /* Make Quick Fill Bar stack neatly */
        #elcentralx_calculator_wrapper .elcentralx_quick-fill-bar {
            flex-direction: column;
            align-items: stretch;
        }
        #elcentralx_calculator_wrapper .elcentralx_quick-fill-bar .elcentralx_input-wrapper {
            width: 100%;
        }
    }

    /* === BULLETPROOF PRINT STYLES FOR WORDPRESS === */
    #elcentralx_print_container { display: none; }

    @media print {
        /* 1. If printing via our button, hide EVERYTHING in body to prevent blank pages & headers */
        body.elcentralx_is_printing > * { display: none !important; }
        
        /* 2. ONLY display our special cloned print container */
        body.elcentralx_is_printing > #elcentralx_print_container { 
            display: block !important; 
            width: 100% !important; 
            margin: 0 !important; 
            padding: 0 !important; 
        }

        /* 3. Format the clone for paper economy */
        .elcentralx_is_print_clone { box-shadow: none !important; border: none !important; margin: 0 !important; padding: 0 !important; background: white !important; }
        .elcentralx_is_print_clone .elcentralx_hero-card { border: 1px solid #000 !important; box-shadow: none !important; page-break-inside: avoid !important; margin-bottom: 30px !important; display: block !important; opacity: 1 !important; transform: none !important;}
        .elcentralx_is_print_clone .elcentralx_breakdown-box { page-break-inside: avoid !important; border: 1px solid #000 !important; margin-bottom: 20px !important; display: block !important;}
        .elcentralx_is_print_clone .elcentralx_rule-note { border: 1px solid #000 !important; page-break-inside: avoid !important; display: block !important;}
        .elcentralx_is_print_clone .elcentralx_breakdown-header { background: #eee !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

        /* 4. Fallback for users who manually press Ctrl+P instead of clicking the print button */
        body:not(.elcentralx_is_printing) header, 
        body:not(.elcentralx_is_printing) footer, 
        body:not(.elcentralx_is_printing) .sidebar, 
        body:not(.elcentralx_is_printing) aside,
        body:not(.elcentralx_is_printing) .site-header, 
        body:not(.elcentralx_is_printing) .site-footer,
        body:not(.elcentralx_is_printing) .elementor-location-header,
        body:not(.elcentralx_is_printing) .elementor-location-footer { display: none !important; }

        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper { background: white !important; padding: 0 !important; box-shadow: none !important; border: none !important; margin: 0 !important;}
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_input-section, 
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_type-selector, 
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_action-buttons { display: none !important; }
        
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_calculator-grid { display: block !important; }
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_results-section { width: 100% !important; padding: 0 !important; display: block !important; }
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_disclaimer-box { display: block !important; margin-top: 20px !important; }
        
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_hero-card { border: 1px solid #000 !important; box-shadow: none !important; page-break-inside: avoid !important; margin-bottom: 30px !important; display: block !important; opacity: 1 !important; transform: none !important;}
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_breakdown-box { page-break-inside: avoid !important; border: 1px solid #000 !important; margin-bottom: 20px !important; }
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_rule-note { border: 1px solid #000 !important; page-break-inside: avoid !important; }
        body:not(.elcentralx_is_printing) #elcentralx_calculator_wrapper .elcentralx_breakdown-header { background: #eee !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    }