/**
 * 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: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.csc-segment-value {
    font-size: 36px;
    font-weight: 700;
    color: #27ae60;
    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, #2ECC71, #27ae60);
}

.csc-excellent {
    background: linear-gradient(135deg, #27AE60, #229954);
}

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

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

.csc-slice-range {
    font-size: 12px;
    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);
}

.csc-average .csc-slice-content,
.csc-good .csc-slice-content {
    color: #333;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* Gauge Handle */
.csc-gauge-handle {
    position: absolute;
    width: 17px;
    height: 17px;
    background: #fff;
    border: 3px solid #2c3e50;
    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 for each segment */
.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: 14px;
}

.csc-table thead {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
}

.csc-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    border: none;
}

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

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

.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;
}

.csc-table td {
    padding: 14px 12px;
    vertical-align: middle;
    border: none;
}

/* Table cell styling */
.csc-table td:first-child {
    font-weight: 600;
    color: #2c3e50;
}

.csc-table td:nth-child(2) {
    color: #e74c3c;
    font-weight: 600;
}

.csc-table td:nth-child(3) {
    color: #2c3e50;
    font-weight: 500;
}

.csc-table td:nth-child(4) {
    color: #27ae60;
    font-weight: 600;
}

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

.csc-footer p {
    margin: 0;
}

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

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

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

.csc-table tbody.updating {
    opacity: 0.6;
}

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

/* Focus states for accessibility */
.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;
    }
}