/* ==========================================================================
   Loan Amortization Calculator Specific Styles
   ========================================================================== */

/* Optional Label */
.optional-label {
    font-weight: 400;
    font-size: 14px;
    color: #666;
}

/* Select Dropdown Arrow */
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;
}

/* ==========================================================================
   Results Summary Cards
   ========================================================================== */
.payment-highlight {
    background: linear-gradient(to bottom right, #003049, #00436b);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    color: white;
}

.primary-payment {
    text-align: center;
    padding: 16px;
}

.primary-payment h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #bae6fd;
}

.payment-amount {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 4px;
}

.payment-label {
    font-size: 14px;
    color: #bae6fd;
}

/* Loan Details Grid */
.loan-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.details-column h4 {
    color: #003049;
    margin-bottom: 16px;
    font-size: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid #bae6fd;
}

.detail-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 15px;
    align-items: start;
}

.detail-item span:first-child {
    color: #666;
    text-align: left;
}

.detail-item span:last-child {
    font-weight: 500;
    color: #003049;
    text-align: right;
    word-break: break-word;
}

/* ==========================================================================
   Savings Section
   ========================================================================== */
.savings-section {
    background: linear-gradient(to bottom right, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
}

.savings-section .results-title {
    color: #166534;
    border-bottom-color: #86efac;
}

.savings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.savings-item {
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(134, 239, 172, 0.5);
}

.savings-item .value {
    font-size: 24px;
    font-weight: 700;
    color: #166534;
    margin-bottom: 4px;
}

.savings-item .label {
    font-size: 14px;
    color: #166534;
}

/* ==========================================================================
   Collapsible Schedule Section
   ========================================================================== */
.schedule-section {
    margin-top: 24px;
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.schedule-details {
    width: 100%;
}

.schedule-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(to bottom right, var(--color-results-from), var(--color-results-to));
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--color-results-border);
}

.schedule-toggle::-webkit-details-marker {
    display: none;
}

.schedule-toggle::marker {
    display: none;
    content: "";
}

.toggle-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
}

.toggle-icon {
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.schedule-details[open] .toggle-icon {
    transform: rotate(-135deg);
}

.schedule-toggle:hover {
    background: linear-gradient(to bottom right, #e0f2fe, #d0e8f7);
}

.schedule-content {
    padding: 0;
    max-height: 500px;
    overflow-y: auto;
}

/* ==========================================================================
   Responsive Table Styling
   ========================================================================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 12px 8px;
    text-align: right;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #003049;
    position: sticky;
    top: 0;
    z-index: 1;
}

th:first-child,
td:first-child {
    text-align: center;
    width: 50px;
}

th:nth-child(2),
td:nth-child(2) {
    text-align: left;
    width: 100px;
}

tr:nth-child(even) {
    background-color: #f9fafb;
}

tr:hover {
    background-color: #f0f9ff;
}

/* Highlight extra payment column */
td:nth-child(6) {
    color: #166534;
    font-weight: 500;
}

/* Final row styling */
tr.final-payment {
    background-color: #f0fdf4;
    font-weight: 600;
}

tr.final-payment td {
    border-bottom: 2px solid #86efac;
}

/* ==========================================================================
   Mobile Responsive Styles
   ========================================================================== */
@media (max-width: 640px) {
    .loan-details {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .payment-amount {
        font-size: 28px;
    }

    .savings-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .savings-item .value {
        font-size: 20px;
    }

    .detail-item {
        grid-template-columns: 100px 1fr;
        font-size: 14px;
    }

    .schedule-toggle {
        padding: 14px 16px;
    }

    .toggle-text {
        font-size: 15px;
    }

    th, td {
        padding: 10px 6px;
        font-size: 13px;
    }

    .schedule-content {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .input-container {
        flex-direction: column;
    }

    select.input-control {
        width: 100%;
    }

    .payment-highlight {
        padding: 16px;
    }

    .primary-payment {
        padding: 12px;
    }

    .payment-amount {
        font-size: 24px;
    }

    th, td {
        padding: 8px 4px;
        font-size: 12px;
    }

    th:first-child,
    td:first-child {
        width: 35px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .schedule-section {
        display: block !important;
    }

    .schedule-details[open] .schedule-content {
        max-height: none;
        overflow: visible;
    }

    .schedule-toggle {
        display: none;
    }

    .schedule-content {
        max-height: none !important;
        overflow: visible !important;
    }

    table {
        min-width: auto;
        font-size: 10px;
    }

    th, td {
        padding: 4px 2px;
    }
}
