/**
 * CREDDO_LOAN_COSTS — Plugin Styles
 * Uses Creddo brand colors: Yellow #FFCE00, Dark Blue #004A6E, Light Blue #5CC4C4
 * Font: Lato (loaded from Google Fonts)
 */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap');

/* ==================== WRAPPER ==================== */
.creddo-lc-wrap {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 720px;
    margin: 0 auto;
    color: #1a2332;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==================== HEADER ==================== */
.creddo-lc-header {
    background: #FFCE00;
    padding: 2rem 1.5rem;
    text-align: center;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.creddo-lc-header h1 {
    font-size: 1.75rem;
    font-weight: 900;
    color: #004A6E;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.creddo-lc-header p {
    font-size: 1rem;
    color: rgba(0, 74, 110, 0.8);
    margin: 0;
    font-weight: 500;
}

/* ==================== CARD ==================== */
.creddo-lc-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.creddo-lc-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #004A6E;
    margin: 0 0 1.25rem 0;
}

/* ==================== FORM FIELDS ==================== */
.creddo-lc-field {
    margin-bottom: 1.25rem;
}

.creddo-lc-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #1a2332;
    margin-bottom: 0.375rem;
}

.creddo-lc-field input[type="number"],
.creddo-lc-field select {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: 'Lato', sans-serif;
    color: #1a2332;
    background: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.creddo-lc-field input[type="number"]:focus,
.creddo-lc-field select:focus {
    outline: none;
    border-color: #2B7DF6;
    box-shadow: 0 0 0 3px rgba(43, 125, 246, 0.15);
}

.creddo-lc-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0.25rem 0 0 0;
}

/* ==================== TOGGLE / SWITCH ==================== */
.creddo-lc-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.creddo-lc-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.creddo-lc-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.creddo-lc-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: background 0.2s;
}

.creddo-lc-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.creddo-lc-switch input:checked + .creddo-lc-slider {
    background: #2B7DF6;
}

.creddo-lc-switch input:checked + .creddo-lc-slider::before {
    transform: translateX(20px);
}

.creddo-lc-toggle-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1a2332;
}

/* ==================== ERRORS ==================== */
.creddo-lc-errors {
    background: #fef2f2;
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.creddo-lc-errors p {
    font-size: 0.875rem;
    color: #dc2626;
    font-weight: 500;
    margin: 0 0 0.25rem 0;
}

.creddo-lc-errors p:last-child {
    margin-bottom: 0;
}

/* ==================== BUTTON ==================== */
.creddo-lc-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #2B7DF6;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.creddo-lc-btn:hover {
    background: #1a6de0;
}

.creddo-lc-btn:focus-visible {
    outline: 2px solid #2B7DF6;
    outline-offset: 2px;
}

/* ==================== RESULT ROWS ==================== */
.creddo-lc-rows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.creddo-lc-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.creddo-lc-row-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.creddo-lc-row-value {
    font-size: 0.875rem;
    color: #1a2332;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.creddo-lc-row--highlight .creddo-lc-row-label {
    color: #004A6E;
    font-weight: 700;
}

.creddo-lc-row--highlight .creddo-lc-row-value {
    color: #004A6E;
    font-weight: 700;
}

/* ==================== DIVIDER ==================== */
.creddo-lc-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1.25rem 0;
}

/* ==================== GRAND TOTAL ==================== */
.creddo-lc-grand-total {
    background: rgba(255, 206, 0, 0.15);
    border: 2px solid #FFCE00;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.creddo-lc-grand-label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #004A6E;
}

.creddo-lc-grand-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: #004A6E;
}

/* ==================== AMORTIZATION TABLE ==================== */
.creddo-lc-toggle-amort {
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 700;
    color: #2B7DF6;
    cursor: pointer;
    padding: 0;
    margin-top: 1rem;
    font-family: 'Lato', sans-serif;
}

.creddo-lc-toggle-amort:hover {
    text-decoration: underline;
}

.creddo-lc-amort-wrap {
    margin-top: 1rem;
}

.creddo-lc-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.creddo-lc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    min-width: 480px;
}

.creddo-lc-table thead {
    background: #004A6E;
}

.creddo-lc-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #ffffff;
    font-size: 0.8125rem;
}

.creddo-lc-table th:not(:first-child) {
    text-align: right;
}

.creddo-lc-table td {
    padding: 0.5rem 0.75rem;
    color: #1a2332;
    border-top: 1px solid #e5e7eb;
}

.creddo-lc-table .creddo-lc-num {
    text-align: right;
}

.creddo-lc-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

/* ==================== INFO BUTTON & TOOLTIP ==================== */
.creddo-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #9ca3af;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 1;
    padding: 0;
    font-family: 'Lato', sans-serif;
    transition: background 0.15s;
    flex-shrink: 0;
}

.creddo-info-btn:hover {
    background: #6b7280;
}

.creddo-tooltip-box {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: #374151;
    line-height: 1.5;
    margin-top: 0.375rem;
    margin-bottom: 0.5rem;
}

/* ==================== FOOTER ==================== */
.creddo-lc-footer {
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
    padding: 1.5rem 0;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .creddo-lc-header h1 {
        font-size: 1.375rem;
    }
    .creddo-lc-header p {
        font-size: 0.875rem;
    }
    .creddo-lc-card {
        padding: 1rem;
        border-radius: 8px;
    }
    .creddo-lc-grand-total {
        flex-direction: column;
        align-items: flex-start;
    }
    .creddo-lc-grand-value {
        font-size: 1.25rem;
    }
}
