/* Savings Goal Calculator Specific Styles */

/* Input container */
.input-container {
    display: flex;
    gap: 8px;
}

/* Input row for time with unit selector */
.input-row {
    display: flex;
    gap: 8px;
}

.input-row .input-container {
    flex: 1;
}

.time-unit-select {
    width: 120px;
    flex-shrink: 0;
}

/* Input control styling */
.input-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.input-control:hover {
    border-color: #003049;
    box-shadow: 0 0 0 3px rgba(0, 48, 73, 0.1);
}

.input-control:focus {
    outline: none;
    border-color: #003049;
    box-shadow: 0 0 0 3px rgba(0, 48, 73, 0.1);
}

/* Custom select styling */
select.input-control {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    cursor: pointer;
    background: white url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23333333' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
}

/* Optional label styling */
.optional-label {
    font-weight: 400;
    color: #666;
    font-size: 14px;
}

/* Preset buttons */
.preset-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.preset-btn:hover {
    background: #e5e7eb;
    border-color: #003049;
}

.preset-btn:active {
    background: #d1d5db;
}

/* Error states */
.input-control.error {
    border-color: #dc2626;
    background-color: #fff;
}

.input-control.error:hover {
    border-color: #dc2626;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.1);
}

.input-control.error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.error-message {
    color: #dc2626;
    font-size: 14px;
    margin-top: 4px;
    display: none;
}

.error-message.visible {
    display: block;
}

/* Results grid */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    border: 1px solid #bae6fd;
}

.result-item.highlight {
    grid-column: 1 / -1;
    background: rgba(0, 48, 73, 0.05);
    border-color: #003049;
}

.result-label {
    font-size: 14px;
    color: #666;
}

.result-value {
    font-size: 18px;
    font-weight: 600;
    color: #003049;
}

.result-item.highlight .result-value {
    font-size: 24px;
}

/* Savings benefit highlight */
.savings-benefit {
    color: #059669;
}

/* Progress Visualization */
.progress-container {
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    border: 1px solid #bae6fd;
}

.progress-bar {
    height: 32px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.progress-current {
    background: #003049;
    height: 100%;
    transition: width 0.5s ease-out;
}

.progress-contributions {
    background: #0077b6;
    height: 100%;
    transition: width 0.5s ease-out;
}

.progress-interest {
    background: #059669;
    height: 100%;
    transition: width 0.5s ease-out;
}

.progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.legend-color.current {
    background: #003049;
}

.legend-color.contributions {
    background: #0077b6;
}

.legend-color.interest {
    background: #059669;
}

/* Growth Table (Monthly Breakdown) */
.growth-table-details {
    margin-top: 8px;
}

.growth-table-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    background: rgba(0, 48, 73, 0.03);
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    list-style: none;
}

.growth-table-summary::-webkit-details-marker {
    display: none;
}

.growth-table-summary:hover {
    background: rgba(0, 48, 73, 0.06);
    border-color: #003049;
}

.growth-table-summary .results-section-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #003049;
}

.toggle-icon {
    width: 20px;
    height: 20px;
    position: relative;
    transition: transform 0.2s;
}

.toggle-icon::before,
.toggle-icon::after {
    content: '';
    position: absolute;
    background: #003049;
    transition: transform 0.2s;
}

.toggle-icon::before {
    width: 12px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.toggle-icon::after {
    width: 2px;
    height: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.growth-table-details[open] .toggle-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
    opacity: 0;
}

.table-container {
    margin-top: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 400px;
    overflow-y: auto;
}

.growth-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.growth-table th,
.growth-table td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid #e5e7eb;
}

.growth-table th:first-child,
.growth-table td:first-child {
    text-align: left;
}

.growth-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #003049;
    position: sticky;
    top: 0;
}

.growth-table tbody tr:hover {
    background: rgba(0, 48, 73, 0.03);
}

.growth-table tbody tr:last-child {
    font-weight: 600;
    background: rgba(0, 48, 73, 0.05);
}

.growth-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .results-grid {
        grid-template-columns: 1fr;
    }

    .result-item.highlight {
        grid-column: 1;
    }

    .preset-buttons {
        flex-direction: column;
    }

    .preset-btn {
        width: 100%;
        text-align: center;
        padding: 10px 12px;
    }

    .input-row {
        flex-direction: column;
    }

    .time-unit-select {
        width: 100%;
    }

    .growth-table {
        font-size: 13px;
    }

    .growth-table th,
    .growth-table td {
        padding: 8px 6px;
    }

    .growth-table-summary {
        padding: 10px;
    }

    .progress-legend {
        flex-direction: column;
        gap: 8px;
    }
}

/* Deep mobile optimizations */
@media (max-width: 480px) {
    .input-control {
        font-size: 16px;
        padding: 10px 12px;
        min-height: 44px;
    }

    .result-item.highlight .result-value {
        font-size: 20px;
    }

    .result-value {
        font-size: 16px;
    }

    .growth-table th,
    .growth-table td {
        padding: 8px 4px;
        font-size: 12px;
    }

    .progress-bar {
        height: 24px;
    }
}
