/* Scoped styles for Buy-to-Let Retirement Income Calculator */

.btl-root-wrapper {
    margin: 2rem auto;
    width: 100%;
    max-width: 1400px;
    padding: 0 1rem;
    box-sizing: border-box;
}

.btl-root {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #083141;
    background: #ffffff;
    border: 1px solid #e0eaef;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 15px;
}

.btl-card {
    border: 1px solid #d5e4eb;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.25rem;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease;
}

.btl-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.btl-header {
    margin-bottom: 1rem;
}

.btl-header h2 {
    margin: 0 0 0.5rem;
    font-size: 1.3rem;
    font-weight: 800;
    color: #083141;
    letter-spacing: -0.01em;
}

.btl-chart-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #083141;
    margin: 1.5rem 0 0.75rem 0;
    letter-spacing: -0.01em;
}

.btl-chart-title:first-child {
    margin-top: 0;
}

.btl-header p {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #526b75;
    line-height: 1.5;
}

.btl-step-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.btl-section-group {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e0eaef;
    margin-bottom: 1.5rem;
}

.btl-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #083141;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0eaef;
    letter-spacing: -0.01em;
    line-height: 1.4;
    word-wrap: break-word;
    min-height: auto;
}

.btl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem 1rem;
    align-items: start;
}

.btl-ltd-fields {
    display: contents; /* Allow fields to participate in parent grid */
}

@media (max-width: 768px) {
    .btl-grid {
        grid-template-columns: 1fr;
    }
    
    .btl-ltd-fields {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
}

.btl-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: fit-content;
    align-items: flex-start;
}

.btl-field label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
}

.btl-field input,
.btl-field select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    min-height: 32px;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    background: #ffffff;
}

.btl-field input:focus,
.btl-field select:focus {
    outline: none;
    border-color: #59747c;
    box-shadow: 0 0 0 2px rgba(89, 116, 124, 0.2);
    background: #f8fafc;
}

.btl-help {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
    margin-top: 0.25rem;
}

.btl-btn-row {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btl-btn {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    border: 1px solid #59747c;
    background: #edf3f5;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    min-height: 36px;
}

.btl-btn:hover {
    background: #dde7eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btl-btn--primary {
    background: #59747c;
    color: #ffffff;
    border-color: #59747c;
    font-weight: 600;
}

.btl-btn--primary:hover {
    background: #476069;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(89, 116, 124, 0.3);
}

.btl-btn--remove {
    background: #fee2e2;
    border-color: #ef4444;
    color: #dc2626;
    font-weight: 600;
}

.btl-btn--remove:hover {
    background: #fecaca;
    border-color: #dc2626;
    color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.btl-properties-list {
    margin-top: 8px;
    border-top: 1px solid #d4e0e6;
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btl-property {
    border: 2px solid #e0eaef;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 1rem;
}

.btl-property:hover {
    border-color: #59747c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.btl-property-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0eaef;
}

.btl-property-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #083141;
    letter-spacing: -0.01em;
}

.btl-property-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btl-toggle-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.btl-results-summary {
    margin-top: 1rem;
    padding: 1.25rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0f7fa 0%, #e8f4f8 100%);
    border: 1px solid #b6c6cf;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.btl-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #d4e0e6;
}

.btl-summary-line:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.btl-summary-line span:first-child {
    color: #445567;
}

.btl-summary-line span:last-child {
    font-weight: 700;
    font-size: 1.1rem;
    color: #083141;
    transition: all 0.3s ease;
}

.btl-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.btl-badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid #b6c6cf;
    background: #ffffff;
}

.btl-badge--ok {
    border-color: #1c7c54;
    color: #1c7c54;
    background: #e5f5ed;
}

.btl-badge--warn {
    border-color: #b34723;
    color: #b34723;
    background: #fbe9e1;
}

.btl-table-wrap {
    margin-top: 10px;
    overflow-x: auto;
}

.btl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 1rem;
}

.btl-table th,
.btl-table td {
    border: 1px solid #d4e0e6;
    padding: 0.6rem 0.75rem;
    text-align: right;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.btl-table tbody tr:hover {
    background-color: #f8fafc;
}

.btl-table th {
    background: #e8f4f8;
    font-weight: 700;
    color: #083141;
    font-size: 0.9rem;
}

.btl-table td:first-child,
.btl-table th:first-child {
    text-align: left;
}

.btl-footer-note {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0eaef;
    line-height: 1.6;
}

/* Charts Section */
.btl-charts-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0eaef;
}

.btl-chart-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #083141;
    margin: 1.5rem 0 0.75rem 0;
    letter-spacing: -0.01em;
}

.btl-chart-title:first-child {
    margin-top: 0;
}

.btl-chart-wrapper {
    position: relative;
    height: 300px;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #fafbfc;
    border-radius: 8px;
    border: 1px solid #e0eaef;
}

.btl-chart-wrapper canvas {
    max-height: 100%;
}

/* Key Metrics Grid */
.btl-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.btl-metric-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.btl-metric-card:nth-child(1) {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #bbf7d0;
}

.btl-metric-card:nth-child(2) {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fcd34d;
}

.btl-metric-card:nth-child(3) {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    border-color: #f9a8d4;
}

.btl-metric-card:nth-child(4) {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-color: #a5b4fc;
}

.btl-metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    border-color: #59747c;
}

.btl-metric-label {
    font-size: 0.9rem;
    color: #083141;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.btl-metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #083141;
    transition: all 0.3s ease;
}

.btl-metric-value.positive {
    color: #1c7c54;
}

.btl-metric-value.negative {
    color: #b34723;
}

@media (max-width: 768px) {
    .btl-root-wrapper {
        padding: 0 0.5rem;
    }

    .btl-root {
        padding: 1rem;
    }

    .btl-card {
        padding: 1rem;
    }

    .btl-chart-wrapper {
        height: 250px;
    }

    .btl-metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* Print tweaks */
@media print {
    .btl-root {
        max-width: 100%;
    }
    .btl-btn-row {
        display: none;
    }
}
