/**
 * Stylesheet cho Công cụ Tra cứu Suất vốn đầu tư & Tính giá xây dựng mới
 * Phiên bản: 1.3.0 - Bổ sung Trích đoạn Văn bản gốc & Dialog phóng to
 */

.sv-container {
    max-width: 1200px;
    margin: 20px auto 40px;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
}

.sv-header {
    margin-bottom: 24px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 16px;
}

.sv-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
    line-height: 1.3;
}

.sv-lead {
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}

.sv-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.sv-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.sv-mb-0 { margin-bottom: 0 !important; }
.sv-mt-2 { margin-top: 8px !important; }
.sv-mt-3 { margin-top: 16px !important; }
.sv-cursor-pointer { cursor: pointer; }

/* Filter Grid */
.sv-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.sv-form-group {
    margin-bottom: 14px;
}

.sv-form-row {
    display: flex;
    gap: 14px;
}

.sv-col-6 {
    flex: 1;
}

.sv-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}

.sv-select, .sv-input {
    width: 100%;
    height: 40px;
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #fff;
    color: #0f172a;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.sv-select:focus, .sv-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sv-radio-group {
    display: flex;
    gap: 14px;
    padding: 2px 0;
}

.sv-radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
}

.sv-meta-text {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}

.sv-region-badge {
    margin-top: 6px;
    padding: 6px 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 12px;
    color: #166534;
    line-height: 1.4;
}

.sv-structure-desc {
    margin-top: 4px;
    font-size: 12px;
    color: #475569;
    background: #f8fafc;
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid #2563eb;
    line-height: 1.4;
}

/* KHỐI 2: KẾT QUẢ SUẤT VỐN */
.sv-result-card {
    border: 2px solid #2563eb;
    background: #f8fafc;
}

.sv-res-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.sv-res-sub {
    font-size: 13px;
    color: #64748b;
    margin: 4px 0 0;
}

.sv-steps-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.sv-step-box {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.sv-step-num {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 4px;
}

.sv-step-title {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.sv-step-value {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.sv-highlight-k { color: #d97706; }
.sv-primary-val { color: #1d4ed8; }

.sv-step-detail {
    font-size: 11px;
    color: #64748b;
    line-height: 1.4;
}

.sv-vat-tag {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
}

.sv-cite-tag {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
}

.sv-step-multiplier {
    font-size: 24px;
    font-weight: 700;
    color: #94a3b8;
    user-select: none;
}

.sv-step-final {
    background: #eff6ff;
    border: 2px solid #3b82f6;
}

.sv-step-final-num {
    color: #1d4ed8;
    font-weight: 800;
}

.sv-final-words {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: #334155;
    margin-bottom: 16px;
}

.sv-final-words strong {
    color: #1e3a8a;
}

.sv-legal-summary {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 12px;
    margin-bottom: 16px;
}

.sv-legal-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.sv-legal-col {
    flex: 1;
    min-width: 240px;
}

.sv-legal-label {
    color: #64748b;
    margin-right: 4px;
}

.sv-legal-col strong {
    color: #0f172a;
}

/* PHẦN TRÍCH ĐOẠN VĂN BẢN GỐC (SNIPPET FACSIMILE) */
.sv-snippet-section {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 16px;
}

.sv-snippet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.sv-snippet-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.sv-snippet-sub {
    font-size: 12px;
    color: #64748b;
    margin: 3px 0 0;
}

.sv-snippet-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sv-doc-preview-wrapper {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    max-height: 480px;
    overflow-y: auto;
}

/* Authentic Document Facsimile (Kiểu dáng Văn bản Hành chính BXD) */
.sv-doc-facsimile {
    background: #ffffff;
    color: #000000;
    font-family: "Times New Roman", Times, Georgia, serif;
    padding: 24px 30px;
    border: 1px solid #94a3b8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    min-width: 680px;
    margin: 0 auto;
    font-size: 13.5px;
    line-height: 1.45;
}

.sv-doc-head-grid {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.sv-doc-head-left {
    text-align: center;
    font-size: 13px;
    line-height: 1.35;
}

.sv-doc-head-left strong {
    font-size: 13.5px;
    letter-spacing: 0.5px;
}

.sv-doc-head-right {
    text-align: center;
    font-size: 13px;
    line-height: 1.35;
}

.sv-doc-head-right strong {
    font-size: 13.5px;
}

.sv-doc-head-right em {
    font-style: italic;
    text-decoration: underline;
}

.sv-doc-main-title {
    text-align: center;
    margin: 14px 0 16px;
}

.sv-doc-main-title h4 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
}

.sv-doc-main-title p {
    margin: 0;
    font-size: 13px;
    font-style: italic;
    color: #333333;
}

.sv-doc-table-caption {
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    margin: 14px 0 4px;
}

.sv-doc-table-unit {
    font-size: 12.5px;
    font-style: italic;
    text-align: right;
    margin-bottom: 6px;
}

.sv-doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 13px;
}

.sv-doc-table th, .sv-doc-table td {
    border: 1px solid #111827;
    padding: 6px 8px;
    vertical-align: middle;
}

.sv-doc-table th {
    background: #f3f4f6;
    font-weight: 700;
    text-align: center;
}

.sv-doc-table td.text-center { text-align: center; }
.sv-doc-table td.text-right { text-align: right; }

.sv-row-highlight {
    background-color: #fef08a !important;
    font-weight: 700;
}

.sv-cell-highlight {
    background-color: #fde047 !important;
    font-weight: 700;
    color: #92400e;
}

.sv-row-highlight td {
    border-top: 2px solid #ca8a04 !important;
    border-bottom: 2px solid #ca8a04 !important;
}

.sv-doc-footer-note {
    font-size: 12px;
    font-style: italic;
    color: #475569;
    margin-top: 10px;
    border-top: 1px dashed #cbd5e1;
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
}

/* KHỐI 3: TIỆN ÍCH MỞ RỘNG (OPTION) */
.sv-extension-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

.sv-extension-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.sv-ext-toggle-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sv-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #2563eb;
    cursor: pointer;
}

.sv-toggle-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sv-toggle-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.sv-divider {
    border: 0;
    border-top: 1px dashed #cbd5e1;
    margin: 16px 0;
}

.sv-ext-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 20px;
    align-items: start;
}

/* Tabs */
.sv-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.sv-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sv-tab-btn:hover {
    color: #1e293b;
}

.sv-tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.sv-tab-content { display: none; }
.sv-tab-content.active { display: block; }

.sv-tip-text {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Breakdown List */
.sv-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sv-bd-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
}

.sv-bd-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sv-bd-weight {
    color: #0369a1;
    font-size: 11px;
}

.sv-bd-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sv-bd-slider {
    flex: 1;
    accent-color: #2563eb;
}

.sv-bd-val {
    width: 45px;
    text-align: right;
    font-weight: 700;
    font-size: 12px;
    color: #1e3a8a;
}

/* Outputs */
.sv-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.sv-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
}

.sv-stat-label {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 4px;
    font-weight: 500;
}

.sv-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.sv-stat-sub {
    font-size: 11px;
    color: #94a3b8;
}

.sv-success-val { color: #059669; }
.sv-danger-val { color: #dc2626; }
.sv-remain-val { color: #16a34a; }

.sv-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.sv-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    transition: width 0.3s ease;
}

.sv-remain-total {
    font-size: 13px;
    font-weight: 600;
    color: #1e3a8a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 10px 12px;
    border-radius: 6px;
}

.sv-big-remain {
    font-size: 18px;
    font-weight: 800;
    color: #047857;
}

/* Justification Card */
.sv-justification-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
}

.sv-just-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.sv-just-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.sv-just-actions {
    display: flex;
    gap: 6px;
}

.sv-btn {
    border: none;
    border-radius: 5px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.sv-btn-copy { background: #2563eb; color: #ffffff; }
.sv-btn-copy:hover { background: #1d4ed8; }

.sv-btn-zoom { background: #0284c7; color: #ffffff; }
.sv-btn-zoom:hover { background: #0369a1; }

.sv-btn-download { background: #059669; color: #ffffff; }
.sv-btn-download:hover { background: #047857; }

.sv-btn-pdf { background: #f8fafc; color: #334155; border: 1px solid #cbd5e1; }
.sv-btn-pdf:hover { background: #e2e8f0; }

.sv-btn-print { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.sv-btn-print:hover { background: #e2e8f0; }

.sv-btn-secondary { background: #64748b; color: #ffffff; }
.sv-btn-secondary:hover { background: #475569; }

.sv-report-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #1e293b;
    white-space: pre-wrap;
    max-height: 280px;
    overflow-y: auto;
}

/* NATIVE POPUP DIALOG */
.sv-snippet-dialog {
    border: none;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    max-width: 950px;
    width: 95vw;
    max-height: 90vh;
    background: #ffffff;
}

.sv-snippet-dialog::backdrop {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(2px);
}

.sv-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.sv-dialog-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.sv-dialog-close {
    background: none;
    border: none;
    font-size: 18px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.sv-dialog-close:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.sv-dialog-body {
    padding: 20px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    background: #f1f5f9;
}

.sv-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

/* Responsive */
@media (max-width: 850px) {
    .sv-steps-flow {
        flex-direction: column;
        gap: 8px;
    }
    .sv-step-multiplier {
        transform: rotate(90deg);
        margin: 2px 0;
    }
    .sv-step-box {
        width: 100%;
        box-sizing: border-box;
    }
    .sv-ext-grid {
        grid-template-columns: 1fr;
    }
    .sv-stats-grid {
        grid-template-columns: 1fr;
    }
    .sv-remain-total {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .sv-res-header {
        flex-direction: column;
    }
    .sv-res-actions {
        width: 100%;
    }
    .sv-btn-copy {
        width: 100%;
    }
    .sv-doc-facsimile {
        min-width: 600px;
        padding: 16px 18px;
    }
}
