/* ============================================================
   DBR Loan Calculator — Mobile-First Responsive Styles
   ============================================================ */

/* ---------- Base ---------- */
.dbr-calculator-container {
    max-width: 1000px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    border: 1px solid #ccc;
    padding: 16px;
    border-radius: 10px;
    background: #ddd;
    box-sizing: border-box;
}

/* ---------- Layout: columns ---------- */
.dbr-form-columns {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.dbr-form-column {
    flex: 1 1 280px;
    min-width: 0;
}

/* ---------- Sections ---------- */
.dbr-section {
    background: #f9f9f9;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.dbr-section h3 {
    margin: 0 0 14px;
    font-size: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* ---------- Form groups ---------- */
.dbr-form-group {
    margin-bottom: 14px;
}

.dbr-form-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #34495e;
    flex-wrap: wrap;
}

/* ---------- Inputs ---------- */
.dbr-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dbr-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.18);
}

/* ---------- Tooltip ---------- */
.dbr-tooltip {
    cursor: help;
    font-size: 0.85em;
    opacity: 0.65;
    flex-shrink: 0;
}

/* ---------- Buttons ---------- */
.dbr-form-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 4px;
}

.dbr-button {
    padding: 13px 28px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.1s ease;
    min-width: 130px;
    touch-action: manipulation;
}

.dbr-button:active { transform: scale(0.97); }

.dbr-button-primary { background-color: #3498db; color: white; }
.dbr-button-primary:hover { background-color: #2980b9; }

.dbr-button-secondary { background-color: #95a5a6; color: white; }
.dbr-button-secondary:hover { background-color: #7f8c8d; }

/* ---------- Counter ---------- */
.dbr-counter-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border: 2px solid #ecf0f1;
}

.dbr-counter-title {
    font-size: 15px;
    font-weight: 600;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
    min-width: 180px;
}

.dbr-counter-number {
    font-size: 28px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #00ff00;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-block;
    min-width: 200px;
    text-align: center;
    border: 2px solid #7f8c8d;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 5px #00ff00, 0 0 10px #00ff00; }
    to   { text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00, 0 0 30px #00ff00; }
}

/* ---------- Results ---------- */
.dbr-results {
    background: #e8f5e8;
    padding: 18px;
    border-radius: 8px;
    border: 1px solid #27ae60;
    margin-top: 16px;
}

.dbr-results h3 {
    color: #27ae60;
    margin: 0 0 12px;
    font-size: 16px;
}

.dbr-results-columns {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.dbr-results-column {
    flex: 1 1 260px;
    min-width: 0;
}

.dbr-results-column h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #2c3e50;
    border-bottom: 1px solid #c3e6cb;
    padding-bottom: 6px;
}

.dbr-result-success { line-height: 1.6; }

.dbr-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin: 8px 0;
    padding: 7px 10px;
    background: rgba(255,255,255,0.8);
    border-radius: 4px;
    flex-wrap: wrap;
}

.dbr-summary-label {
    font-weight: 600;
    font-size: 13px;
    color: #34495e;
}

.dbr-summary-value {
    font-weight: bold;
    font-size: 13px;
    text-align: right;
}

.dbr-income { color: #27ae60; }
.dbr-debt   { color: #e74c3c; }

.dbr-dbr-value {
    font-size: 1.15em;
    color: #2980b9;
}

/* ---------- Chart ---------- */
.dbr-chart-container {
    background: white;
    padding: 18px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-top: 16px;
}

.dbr-chart-title {
    text-align: center;
    margin-bottom: 12px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

#dbr-pie-chart {
    width: 100% !important;
    max-height: 280px !important;
}

.dbr-chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
}

.dbr-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.dbr-legend-color {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    flex-shrink: 0;
}

.dbr-legend-income { background-color: #27ae60; }
.dbr-legend-debt   { background-color: #e74c3c; }

/* ---------- Apply Now ---------- */
.dbr-apply-now-container {
    text-align: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 2px dashed #27ae60;
}

.dbr-apply-now-button {
    display: inline-block;
    padding: 14px 30px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    font-size: 17px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(39,174,96,0.3);
    touch-action: manipulation;
}

.dbr-apply-now-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39,174,96,0.4);
    color: white;
}

/* ---------- Loading / Error ---------- */
.dbr-loading { text-align: center; padding: 20px; color: #7f8c8d; }

.dbr-error {
    color: #e74c3c;
    background: #ffe6e6;
    padding: 14px;
    border-radius: 4px;
    border: 1px solid #e74c3c;
}

/* ============================================================
   MOBILE — ≤ 600px
   ============================================================ */
@media (max-width: 600px) {

    .dbr-calculator-container {
        padding: 12px;
        border-radius: 8px;
    }

    .dbr-form-columns,
    .dbr-results-columns {
        flex-direction: column;
        gap: 0;
    }

    .dbr-form-column { flex: 1 1 100%; }

    .dbr-input {
        padding: 12px;
        font-size: 16px;
        border-radius: 8px;
    }

    .dbr-form-group label { font-size: 14px; }

    .dbr-form-actions { flex-direction: column; gap: 10px; }

    .dbr-button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        border-radius: 8px;
    }

    .dbr-counter-container {
        flex-direction: column;
        text-align: center;
        padding: 14px;
    }

    .dbr-counter-title {
        font-size: 13px;
        letter-spacing: 0.5px;
        min-width: unset;
    }

    .dbr-counter-number {
        font-size: 22px;
        min-width: unset;
        width: 95%;
        letter-spacing: 2px;
    }

    .dbr-results-column { flex: 1 1 100%; }

    .dbr-summary-item {
        flex-direction: column;
        gap: 2px;
    }

    .dbr-summary-value { text-align: left; }

    #dbr-pie-chart { max-height: 220px !important; }

    .dbr-apply-now-button {
        display: block;
        width: 100%;
        text-align: center;
        padding: 14px 20px;
        font-size: 16px;
        box-sizing: border-box;
    }

    .dbr-section { padding: 12px; }
    .dbr-section h3 { font-size: 14px; }
}

/* ============================================================
   TABLET — 601px – 768px
   ============================================================ */
@media (min-width: 601px) and (max-width: 768px) {

    .dbr-calculator-container { padding: 14px; }
    .dbr-form-columns { gap: 14px; }
    .dbr-form-column { flex: 1 1 calc(50% - 7px); }

    .dbr-counter-number {
        font-size: 24px;
        min-width: 170px;
    }

    .dbr-button { min-width: 120px; }
}

/* ============================================================
   ELIGIBLE (CONGRATULATIONS) MESSAGE
   ============================================================ */
.dbr-eligible-message {
    background: linear-gradient(135deg, #e8f8f0 0%, #d4edda 100%);
    border: 2px solid #27ae60;
    border-left: 6px solid #27ae60;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 15px;
    font-weight: 600;
    color: #1a5e35;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.dbr-eligible-icon {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ============================================================
   NOT ELIGIBLE MESSAGE
   ============================================================ */
.dbr-not-eligible-message {
    background: #fdf2f2;
    border: 2px solid #e74c3c;
    border-left: 6px solid #e74c3c;
    border-radius: 8px;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #922b21;
    line-height: 1.6;
}
