/**
 * Credit Savings Calculator - CSS Styles
 * Responsive design for the interactive credit savings calculator widget
 */

/* Main Container */
.credit-savings-calculator {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Dynamic Heading */
.csc-heading {
    text-align: center;
    margin-bottom: 40px;
}

.csc-segment-title {
    font-size: 30px;
    font-weight: 700;
    color: #000;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.csc-segment-value {
    font-size: 38px;
    font-weight: 700;
    color: #018600;
    margin: 0;
    line-height: 1;
}

/* Gauge Container */
.csc-gauge-container {
    margin-bottom: 50px;
    position: relative;
}

.csc-gauge {
    display: flex;
    height: 40px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

/* Gauge Slices */
.csc-gauge-slice {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}
.csc-gauge-slice:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Slice Colors */
.csc-bad {
    background: linear-gradient(135deg, #E74C3C, #c0392b);
}
.csc-average {
    background: linear-gradient(135deg, #F1C40F, #f39c12);
}
.csc-good {
    background: linear-gradient(135deg, #018600, #005f00);
}
.csc-excellent {
    background: linear-gradient(135deg, #005f00, #004200);
}

/* Slice Content */
.csc-slice-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.csc-slice-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2px;
}

.csc-slice-range {
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
}

/* Text Colors */
.csc-bad .csc-slice-content,
.csc-excellent .csc-slice-content {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Force Average & Good labels white */
.csc-average .csc-slice-content,
.csc-good    .csc-slice-content {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

/* Gauge Handle */
.csc-gauge-handle {
    position: absolute;
    width: 17px;
    height: 17px;
    background: #fff;
    border: 3px solid #000;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* Handle positions */
.csc-gauge-handle[data-segment="bad"] {
    left: 12.5%;
}
.csc-gauge-handle[data-segment="average"] {
    left: 37.5%;
}
.csc-gauge-handle[data-segment="good"] {
    left: 62.5%;
}
.csc-gauge-handle[data-segment="excellent"] {
    left: 87.5%;
}

/* Table Container */
.csc-table-container {
    margin-bottom: 30px;
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Table Styles */
.csc-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 16px;
}

/* Solid black header */
#credit-savings-calculator .csc-table thead {
    background: #000 !important;
    background-image: none !important;
}

/* White header text */
#credit-savings-calculator .csc-table thead th {
    color: #fff !important;
}

.csc-table th:first-child {
    border-top-left-radius: 8px;
}
.csc-table th:last-child {
    border-top-right-radius: 8px;
}

/* Body rows */
.csc-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background-color 0.2s ease;
}
.csc-table tbody tr:hover {
    background-color: #f8f9fa;
}
.csc-table tbody tr:last-child {
    border-bottom: none;
}

/* Table cells */
.csc-table td {
    padding: 14px 12px;
    vertical-align: middle;
    border: none;
    font-size: 16px;
}

.csc-table td:first-child {
    font-weight: 600;
    color: #000;
}
.csc-table td:nth-child(2) {
    color: #e74c3c;
    font-weight: 600;
}
.csc-table td:nth-child(3) {
    color: #000;
    font-weight: 500;
}
.csc-table td:nth-child(4) {
    color: #018600;
    font-weight: 600;
}

/* Footer */
.csc-footer {
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
    font-style: italic;
}
.csc-footer p {
    margin: 0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .credit-savings-calculator {
        padding: 20px 15px;
        margin: 0 10px;
    }
    .csc-segment-title {
        font-size: 26px;
    }
    .csc-segment-value {
        font-size: 32px;
    }
    .csc-gauge {
        height: 35px;
    }
    .csc-slice-name {
        font-size: 14px;
    }
    .csc-slice-range {
        font-size: 12px;
    }
    .csc-gauge-handle {
        width: 15px;
        height: 15px;
        border-width: 2px;
    }
    .csc-table {
        font-size: 14px;
    }
    .csc-table th,
    .csc-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .credit-savings-calculator {
        padding: 15px 10px;
    }
    .csc-segment-title {
        font-size: 22px;
    }
    .csc-segment-value {
        font-size: 28px;
    }
    .csc-gauge {
        height: 30px;
    }
    .csc-slice-name {
        font-size: 13px;
    }
    .csc-slice-range {
        font-size: 11px;
    }
    .csc-table {
        font-size: 13px;
    }
    .csc-table th,
    .csc-table td {
        padding: 8px 6px;
    }
}

/* Animation */
.csc-table tbody {
    transition: opacity 0.3s ease;
}
.csc-table tbody.updating {
    opacity: 0.6;
}

/* Loading */
.csc-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Focus states */
.csc-gauge-slice:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .credit-savings-calculator {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    .csc-gauge-handle {
        display: none;
    }
}


/* FULL BLACK HEADER + WHITE TEXT */
#credit-savings-calculator .csc-table thead {
  background-color: #000 !important;
  background-image: none !important;
}
#credit-savings-calculator .csc-table thead th {
  color: #fff !important;
}

/* FORCE AVERAGE & GOOD SLICE LABELS TO WHITE */
#credit-savings-calculator .csc-gauge-slice.csc-average .csc-slice-name,
#credit-savings-calculator .csc-gauge-slice.csc-average .csc-slice-range,
#credit-savings-calculator .csc-gauge-slice.csc-good    .csc-slice-name,
#credit-savings-calculator .csc-gauge-slice.csc-good    .csc-slice-range {
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}