/* --- 1. VARIABLES & THEME --- */
    #lldcx_calculator_wrapper {
      --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;

      /* Body Styles Transferred to Wrapper */
      font-family: 'Inter', sans-serif;
      background-color: var(--bg-color);
      color: var(--text-color);
      line-height: 1.6;
      -webkit-font-smoothing: antialiased;
      width: 100%;
    }

    #lldcx_calculator_wrapper * { box-sizing: border-box; margin: 0; padding: 0; }

    /* --- 2. LAYOUT --- */
    #lldcx_calculator_wrapper .lldcx_calculator-container {
      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;
    }
    
    #lldcx_calculator_wrapper .lldcx_calculator-grid {
      display: grid;
      grid-template-columns: 1fr 1.3fr;
      min-height: 650px;
    }

    #lldcx_calculator_wrapper .lldcx_input-section, 
    #lldcx_calculator_wrapper .lldcx_results-section { padding: 35px; }

    #lldcx_calculator_wrapper .lldcx_input-section {
      background-color: #ffffff;
      border-right: 1px solid var(--border-color);
      display: flex;
      flex-direction: column;
    }

    #lldcx_calculator_wrapper .lldcx_results-section {
      background-color: #fafbfd;
      display: flex;
      flex-direction: column;
      min-width: 0;
      position: relative;
    }
    
    #lldcx_calculator_wrapper .lldcx_section-title {
      color: var(--primary-color);
      font-size: 18px;
      font-weight: 800;
      margin-bottom: 25px;
      padding-bottom: 10px;
      border-bottom: 2px solid var(--border-color);
      /* FIXED ALIGNMENT: Force contents to start on the left */
      display: flex;
      align-items: center;
      justify-content: flex-start; 
      text-align: left;
      flex-direction: row;
    }

    /* New class for the method badge to handle its positioning */
    #lldcx_calculator_wrapper .lldcx_method-tag {
        margin-left: auto; /* Pushes the badge to the far right */
        font-size: 12px; 
        font-weight: 500; 
        color: #64748B; 
        background: #F1F5F9; 
        padding: 4px 8px; 
        border-radius: 4px;
    }

    /* --- 3. INPUTS & CONTROLS --- */
    #lldcx_calculator_wrapper .lldcx_input-group { margin-bottom: 20px; position: relative; }
    
    #lldcx_calculator_wrapper .lldcx_input-row {
        display: flex;
        gap: 15px;
        margin-bottom: 15px;
    }
    #lldcx_calculator_wrapper .lldcx_input-row .lldcx_input-group {
        margin-bottom: 0;
        flex: 1;
    }

    #lldcx_calculator_wrapper .lldcx_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;
    }
    
    #lldcx_calculator_wrapper .lldcx_group-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 10px;
        margin-bottom: 10px;
        border-bottom: 1px dashed var(--border-color);
        padding-bottom: 5px;
    }
    #lldcx_calculator_wrapper .lldcx_group-label {
        font-size: 14px;
        font-weight: 800;
        color: var(--text-color);
    }
    #lldcx_calculator_wrapper .lldcx_group-header:first-of-type { margin-top: 0; }

    /* Swap Button */
    #lldcx_calculator_wrapper .lldcx_swap-container {
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 15px 0; /* Equal vertical spacing */
        position: relative;
    }
    
    /* --- CSS FIX FOR CENTERING THE SWAP BUTTON --- */
    /* Remove bottom margin from the row above swap */
    #lldcx_calculator_wrapper .lldcx_input-row:nth-of-type(1) {
        margin-bottom: 0 !important;
    }
    /* Remove top margin from the header below swap */
    #lldcx_calculator_wrapper .lldcx_swap-container + .lldcx_group-header {
        margin-top: 0 !important;
    }

    #lldcx_calculator_wrapper .lldcx_swap-btn {
        background: #F1F5F9;
        border: 2px solid var(--border-color); /* Slightly thicker border for boldness */
        color: var(--primary-color);
        width: 40px; /* Increased size slightly */
        height: 40px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        font-size: 18px; /* Larger icon */
        font-weight: 900; /* Bold icon */
    }
    #lldcx_calculator_wrapper .lldcx_swap-btn:hover {
        background: var(--hover-color);
        color: var(--primary-color);
        transform: rotate(180deg);
        border-color: var(--primary-color);
    }

    #lldcx_calculator_wrapper .lldcx_input-wrapper { position: relative; width: 100%; }

    /* Remove spinner arrows */
    #lldcx_calculator_wrapper input[type=number]::-webkit-inner-spin-button, 
    #lldcx_calculator_wrapper input[type=number]::-webkit-outer-spin-button { 
        -webkit-appearance: none; 
        margin: 0; 
    }
    #lldcx_calculator_wrapper input[type=number] { -moz-appearance: textfield; }

    #lldcx_calculator_wrapper .lldcx_input-field,
    #lldcx_calculator_wrapper .lldcx_input-wrapper input,
    #lldcx_calculator_wrapper .lldcx_input-wrapper select {
        width: 100%;
        padding: 12px 12px 12px 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        font-size: 16px; 
        background-color: var(--white);
        font-family: 'Inter', sans-serif;
        color: var(--primary-color);
        font-weight: 500;
        transition: border-color 0.2s;
        outline: none;
        appearance: none;
    }

    /* Custom arrow for select */
    #lldcx_calculator_wrapper .lldcx_input-wrapper select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%230B1F51' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 15px center;
        padding-right: 35px;
        /* Fix clipping issues */
        height: 48px; /* Explicit height to accommodate text */
        line-height: 1.5;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    #lldcx_calculator_wrapper .lldcx_input-field:focus,
    #lldcx_calculator_wrapper .lldcx_input-wrapper input:focus,
    #lldcx_calculator_wrapper .lldcx_input-wrapper select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(11, 31, 81, 0.1);
    }

    /* Error State */
    #lldcx_calculator_wrapper .lldcx_input-wrapper.lldcx_error input {
        border-color: var(--danger-color);
        background-color: var(--danger-bg);
    }

    #lldcx_calculator_wrapper .lldcx_error-message {
        color: var(--danger-color);
        font-size: 13px;
        margin-top: 10px;
        padding: 10px;
        background: var(--danger-bg);
        border-radius: 6px;
        display: none; 
        border: 1px solid #FECACA;
    }

    /* Action Buttons */
    #lldcx_calculator_wrapper .lldcx_action-buttons { 
        margin-top: 30px; 
        display: grid; 
        gap: 15px; 
        grid-template-columns: 1fr 1fr; /* Equal width columns */
    }

    #lldcx_calculator_wrapper button {
        padding: 14px;
        border-radius: 8px;
        font-weight: 600;
        font-size: 16px;
        cursor: pointer;
        border: none;
        transition: transform 0.1s, background-color 0.2s;
        width: 100%; /* Ensure full width of grid cell */
    }

    #lldcx_calculator_wrapper .lldcx_primary-btn {
      background-color: var(--primary-color); 
      color: white; 
    }
    #lldcx_calculator_wrapper .lldcx_primary-btn:hover { background-color: #1a3a8a; }

    #lldcx_calculator_wrapper .lldcx_secondary-btn {
      background-color: white; 
      color: var(--text-color); 
      border: 1px solid var(--border-color); 
    }
    #lldcx_calculator_wrapper .lldcx_secondary-btn:hover { background-color: #F1F5F9; border-color: var(--primary-color); }

    #lldcx_calculator_wrapper button:active { transform: translateY(1px); }

    /* Helper Text */
    #lldcx_calculator_wrapper .lldcx_helper-text {
        font-size: 11px;
        color: #64748B;
        position: absolute;
        bottom: -18px;
        left: 2px;
    }

    /* --- 4. RESULTS UI --- */
    #lldcx_calculator_wrapper .lldcx_hero-card {
        background-color: var(--white);
        border-radius: 8px;
        border: 1px solid var(--border-color);
        border-left: 5px solid var(--primary-color);
        margin-bottom: 25px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    #lldcx_calculator_wrapper .lldcx_hero-main {
        padding: 25px;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }
    
    #lldcx_calculator_wrapper .lldcx_result-group { margin-bottom: 10px; }
    
    #lldcx_calculator_wrapper .lldcx_result-label-sm {
        font-size: 12px;
        color: #64748B;
        text-transform: uppercase;
        font-weight: 700;
        letter-spacing: 0.5px;
        margin-bottom: 4px;
    }

    #lldcx_calculator_wrapper .lldcx_hero-value { 
        font-size: 36px; 
        font-weight: 800; 
        color: var(--primary-color); 
        line-height: 1.2; 
    }
    
    #lldcx_calculator_wrapper .lldcx_unit-badge {
        font-size: 0.5em;
        vertical-align: middle;
        color: #64748B;
        font-weight: 600;
        text-transform: lowercase; /* Ensure consistent lowercase for badge */
    }

    #lldcx_calculator_wrapper .lldcx_secondary-metrics {
        display: flex;
        justify-content: center;
        gap: 20px;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #F1F5F9;
    }

    #lldcx_calculator_wrapper .lldcx_metric-item {
        font-size: 14px;
        color: var(--text-color);
        font-weight: 600;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    #lldcx_calculator_wrapper .lldcx_metric-item span:first-child { color: #64748B; font-weight: 500; margin-bottom: 4px; }

    #lldcx_calculator_wrapper .lldcx_units-note {
        padding: 12px 25px;
        font-size: 11px;
        color: #94A3B8;
        background: #FAFAFA;
        text-align: center;
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
        border-top: 1px solid #E2E8F0;
        line-height: 1.5;
        font-weight: 700; /* Bold as requested */
    }

    /* Breakdown Box */
    #lldcx_calculator_wrapper .lldcx_breakdown-box {
        background: var(--white);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 20px;
    }
    
    #lldcx_calculator_wrapper .lldcx_breakdown-header {
        background: #F1F5F9;
        padding: 12px 15px; /* Reduced side padding slightly for corner feel */
        font-size: 13px;
        font-weight: 700;
        color: var(--primary-color);
        text-transform: uppercase;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        justify-content: space-between; /* Ensures items are at the corners */
        align-items: center;
    }

    #lldcx_calculator_wrapper .lldcx_step-toggle-btn {
        background: none;
        border: none;
        color: var(--primary-color);
        font-size: 14px;
        font-weight: 800;
        cursor: pointer;
        padding: 4px 8px;
        text-decoration: none;
        text-align: right;
    }
    #lldcx_calculator_wrapper .lldcx_step-toggle-btn:hover { color: #1a3a8a; }

    #lldcx_calculator_wrapper .lldcx_step-content {
        padding: 20px;
        display: none; 
    }

    #lldcx_calculator_wrapper .lldcx_math-block {
        font-family: 'Courier New', Courier, monospace;
        background: #F8FAFC;
        padding: 12px;
        border-radius: 6px;
        margin-top: 5px;
        font-weight: 600;
        color: var(--text-color);
        border: 1px solid #E2E8F0;
        overflow-x: auto;
        font-size: 13px;
    }
    
    #lldcx_calculator_wrapper .lldcx_step-row { margin-bottom: 15px; }
    #lldcx_calculator_wrapper .lldcx_step-label { font-weight: 700; font-size: 13px; color: #475569; display: block; margin-bottom: 4px;}

    /* Chart Box */
    #lldcx_calculator_wrapper .lldcx_chart-box {
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 15px;
        height: 300px;
        position: relative;
        display: flex;
        flex-direction: column;
    }
    
    #lldcx_calculator_wrapper .lldcx_chart-canvas-wrapper {
        flex: 1;
        position: relative;
        min-height: 0;
    }

    #lldcx_calculator_wrapper .lldcx_chart-caption {
        text-align: center;
        font-size: 0.8rem;
        color: #94A3B8;
        margin-top: 8px;
        font-style: italic;
        font-weight: 700; /* Bold as requested */
    }

    #lldcx_calculator_wrapper #lldcx_chart-fallback {
        background: #F8FAFC;
        border-radius: 8px;
        border: 1px dashed #CBD5E1;
        height: 100%;
        display: none; 
        flex-direction: column;
        justify-content: center; 
        align-items: center;
        color: #94A3B8;
        padding: 20px;
    }

    /* Empty State */
    #lldcx_calculator_wrapper .lldcx_empty-state {
        text-align: center;
        color: #94A3B8;
        padding: 40px;
        /* Flex properties will apply when display is set to flex via JS */
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        display: none; /* Default state */
    }
    
    #lldcx_calculator_wrapper .lldcx_results-container {
        display: block; 
        animation: fadeIn 0.4s ease-in-out;
        outline: none; /* For focus management */
    }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

    /* Example Notice */
    #lldcx_calculator_wrapper #lldcx_example-notice {
        background-color: #EFF6FF; 
        color: #1E40AF; 
        padding: 10px; 
        border-radius: 6px; 
        font-size: 13px; 
        margin-bottom: 15px; 
        border: 1px solid #DBEAFE; 
        text-align: center;
        font-weight: 500;
    }

    /* Mobile Responsive */
    @media (max-width: 900px) {
      #lldcx_calculator_wrapper { padding: 15px; }
      #lldcx_calculator_wrapper .lldcx_calculator-grid { grid-template-columns: 1fr; }
      #lldcx_calculator_wrapper .lldcx_input-section { border-right: none; border-bottom: 1px solid var(--border-color); padding: 25px; }
      #lldcx_calculator_wrapper .lldcx_results-section { padding: 25px; }
    }
    
    @media (max-width: 600px) {
        #lldcx_calculator_wrapper .lldcx_input-row { flex-direction: column; gap: 25px; } /* Stack inputs on small screens */
        #lldcx_calculator_wrapper .lldcx_input-row .lldcx_input-group { margin-bottom: 0; width: 100%; }
        /* Buttons stack on very small screens if needed */
        #lldcx_calculator_wrapper .lldcx_action-buttons { grid-template-columns: 1fr; }
        #lldcx_calculator_wrapper .lldcx_secondary-metrics { flex-direction: column; gap: 10px; align-items: center; }
        #lldcx_calculator_wrapper .lldcx_hero-value { font-size: 28px; }
        #lldcx_calculator_wrapper .lldcx_input-section, 
        #lldcx_calculator_wrapper .lldcx_results-section { padding: 20px; }

        /* Improved Empty State on Mobile */
        #lldcx_calculator_wrapper .lldcx_empty-state h3 { font-size: 1.5rem; }
        #lldcx_calculator_wrapper .lldcx_empty-state p { font-size: 0.9rem; }
    }