/* =====================================================
   Loan Calculator Plugin v2 - CSS
===================================================== */

.lc-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
}

.lc-wrapper *, .lc-wrapper *::before, .lc-wrapper *::after {
    box-sizing: inherit;
}

/* ---- Tabs ---- */
.lc-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #fff;
}

.lc-tab {
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #888;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    outline: none;
}

.lc-tab:hover { color: #333; }
.lc-tab.active { color: #c0392b; border-bottom-color: #c0392b; font-weight: 600; }

/* ---- Tab Content ---- */
.lc-tab-content { display: none; }
.lc-tab-content.active { display: block; }

/* ---- Layout ---- */
.lc-layout {
    display: flex;
    min-height: 360px;
}

.lc-form-panel {
    flex: 1;
    padding: 28px 32px;
    border-right: 1px solid #e0e0e0;
}

.lc-result-panel {
    width: 300px;
    min-width: 260px;
    background: #737373;
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
}

/* ---- Form Fields ---- */
.lc-field-row {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
    gap: 0;
}

.lc-label {
    width: 220px;
    min-width: 180px;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    padding-right: 16px;
    flex-shrink: 0;
    line-height: 1.4;
}

.lc-label small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
}

/* Loan field */
.lc-field-loan {
    align-items: flex-start;
}

.lc-loan-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ---- Input ---- */
.lc-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s;
}

.lc-input-wrap:focus-within { border-color: #c0392b; }

.lc-input {
    flex: 1;
    padding: 9px 12px;
    font-size: 14px;
    border: none;
    outline: none;
    background: transparent;
    color: #222;
    min-width: 0;
}

/* Remove spinners from number inputs */
.lc-input[type=number]::-webkit-inner-spin-button,
.lc-input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.lc-input[type=number] { -moz-appearance: textfield; }

.lc-unit {
    padding: 9px 12px;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Date ---- */
.lc-date-wrap { position: relative; }

.lc-date-native {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    top: 0;
    left: 0;
}

.lc-date-btn {
    padding: 7px 12px;
    background: none;
    border: none;
    border-left: 1px solid #ccc;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    flex-shrink: 0;
}
.lc-date-btn:hover { color: #c0392b; }
.lc-date-btn svg { width: 18px; height: 18px; display: block; }

/* ---- Slider ---- */
.lc-slider-wrap { width: 100%; }

.lc-slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
    position: relative;
    height: 20px;
}

.lc-slider-thumb-label {
    position: absolute;
    z-index: 100;
    top: -10px;
    left: 69%;
    transform: translateX(-50%);
    color: #713523;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
    transition: left 0.05s;
}

.lc-slider-track {
    position: relative;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    margin: 2px 0;
}

.lc-slider-fill {
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    background: #c0392b;
    border-radius: 3px;
    width: 80%;
    pointer-events: none;
}

.lc-range {
    position: absolute;
    width: 100%; top: 50%; left: 0;
    transform: translateY(-50%);
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    height: 20px;
    cursor: pointer;
    margin: 0; padding: 0;
}

.lc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #bbb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    cursor: grab;
    transition: border-color 0.15s;
}
.lc-range::-webkit-slider-thumb:hover { border-color: #c0392b; }
.lc-range:active::-webkit-slider-thumb { cursor: grabbing; border-color: #c0392b; }
.lc-range::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #bbb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    cursor: grab;
}

/* ---- Result Panel ---- */
.lc-result-label {
    font-size: 13px;
    color: #ddd;
    margin: 0 0 6px;
}

.lc-result-range {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.lc-result-from, .lc-result-to {
    display: flex;
    flex-direction: column;
}

.lc-range-label {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 2px;
}

.lc-result-from strong, .lc-result-to strong {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.2px;
    line-height: 1.3;
}

.lc-result-total-wrap { margin-bottom: 22px; }

.lc-result-total {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    display: block;
    margin-top: 2px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.lc-detail-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s;
    text-align: left;
}
.lc-detail-btn:hover { opacity: 0.75; }

/* ---- Modal ---- */
.lc-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 999999;
    align-items: flex-start;
    justify-content: center;
    padding: 20px 16px;
    overflow-y: auto;
}
.lc-modal-overlay.open { display: flex; }

.lc-modal-box {
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.28);
    animation: lcModalIn 0.2s ease;
    margin: auto;
    max-height: calc(100vh - 40px);
}

@keyframes lcModalIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;          /* không bị co */
    background: #fff;
    z-index: 10;
    border-radius: 6px 6px 0 0;
}

.lc-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #222;
}

.lc-modal-close {
    background: none;
    border: none;
    font-size: 26px;
    color: #888;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}
.lc-modal-close:hover { color: #c0392b; }

.lc-modal-body {
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    min-height: 0;
}

/* ---- Table ---- */
.lc-table-wrap {
    min-width: 600px; 
}

.lc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.lc-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.lc-table thead tr { background: #713523; color: #fff; }

.lc-table thead th {
    padding: 12px 14px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.lc-table tbody tr { border-bottom: 1px solid #f0f0f0; }
.lc-table tbody tr:nth-child(even) { background: #fafafa; }
.lc-table tbody tr:hover { background: #fef5f4; }

.lc-table tbody td {
    padding: 9px 14px;
    text-align: center;
    color: #333;
    font-size: 13px;
    white-space: nowrap;
}

.lc-table tfoot tr { background: #713523; color: #fff; }
.lc-table tfoot td {
    padding: 11px 14px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .lc-layout { flex-direction: column; }
    .lc-result-panel { width: 100%; min-width: unset; }
    .lc-form-panel { padding: 18px 16px; border-right: none; border-bottom: 1px solid #e0e0e0; }
    .lc-field-row { flex-direction: column; align-items: flex-start; gap: 6px; }
    .lc-field-loan { flex-direction: column; }
    .lc-label { width: 100%; }
    .lc-loan-right { width: 100%; }
    .lc-tab { padding: 10px 14px; font-size: 13px; }
    .lc-modal-box { margin: 0; border-radius: 6px; max-height: calc(100vh - 32px); }
}
