/* Scoped Styles for Twins & Triplets Birth Chart Calculator (.tbc-*)
 * Preserves existing HosurOnline template, Bootstrap, city search, and ad-slot CLS=0.
 */
:root {
    --tbc-primary: #7c1d1d;
    --tbc-primary-dark: #5e1515;
    --tbc-accent: #b45309;
    --tbc-bg-soft: #fdf9f0;
    --tbc-border: #e5d4b3;
    --tbc-border-neutral: #d1d5db;
    --tbc-text: #111827;
    --tbc-muted: #4b5563;
    --tbc-radius: 8px;
}

.tbc-app {
    color: var(--tbc-text);
    font-size: 14.5px;
    line-height: 1.55;
}

/* Top Utility Menu (Single-row, responsive, ad-safe) */
.tbc-utility-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    background: var(--tbc-bg-soft);
    border: 1px solid var(--tbc-border);
    border-radius: var(--tbc-radius);
    padding: 10px 12px;
    margin: 12px 0 16px;
}

.tbc-utility-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.tbc-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--tbc-primary);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tbc-nav-link:hover {
    background: #fff3db;
    border-color: var(--tbc-border);
    text-decoration: none;
    color: var(--tbc-primary-dark);
}

.tbc-nav-link.tbc-is-active {
    background: var(--tbc-primary);
    color: #ffffff;
}

.tbc-nav-jump {
    font-weight: 600;
    color: var(--tbc-muted);
    font-size: 12.5px;
}

.tbc-nav-sep {
    color: #c4a97d;
    user-select: none;
}

.tbc-utility-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.tbc-control-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--tbc-primary);
}

.tbc-select-sm {
    height: 32px;
    padding: 2px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tbc-text);
    background: #ffffff;
    border: 1px solid #c9b28a;
    border-radius: 6px;
    cursor: pointer;
}

/* Hero Header */
.tbc-hero {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--tbc-border);
}

.tbc-hero h1 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 800;
    color: var(--tbc-primary);
    line-height: 1.3;
}

.tbc-hero-sub {
    margin: 0;
    font-size: 14px;
    color: var(--tbc-muted);
}

/* Form Panels */
.tbc-card {
    background: #ffffff;
    border: 1px solid var(--tbc-border-neutral);
    border-radius: var(--tbc-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.tbc-card-warm {
    background: var(--tbc-bg-soft);
    border-color: var(--tbc-border);
}

.tbc-section-title {
    margin: 0 0 12px;
    font-size: 15.5px;
    font-weight: 800;
    color: var(--tbc-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.tbc-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.tbc-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.tbc-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.tbc-field label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--tbc-text);
    margin: 0;
}

.tbc-input,
.tbc-select {
    width: 100%;
    height: 38px;
    padding: 6px 10px;
    font-size: 14px;
    color: var(--tbc-text);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.tbc-input:focus,
.tbc-select:focus {
    outline: none;
    border-color: var(--tbc-primary);
    box-shadow: 0 0 0 2px rgba(124, 29, 29, 0.12);
}

.tbc-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--tbc-muted);
}

/* Sibling Repeater Rows */
.tbc-sibling-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tbc-sibling-row {
    background: #ffffff;
    border: 1px solid #d6c3a3;
    border-left: 4px solid var(--tbc-primary);
    border-radius: var(--tbc-radius);
    padding: 12px 14px;
}

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

.tbc-sibling-badge {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--tbc-primary);
}

.tbc-delta-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.tbc-delta-pill.tbc-delta-base {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.tbc-delta-pill.tbc-delta-alert {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.tbc-time-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 8px;
    align-items: end;
}

.tbc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.tbc-btn-primary {
    background: var(--tbc-primary);
    color: #ffffff;
    width: 100%;
    padding: 12px 18px;
    font-size: 15px;
}

.tbc-btn-primary:hover {
    background: var(--tbc-primary-dark);
}

.tbc-btn-outline {
    background: #ffffff;
    color: var(--tbc-primary);
    border-color: var(--tbc-primary);
    padding: 6px 12px;
    font-size: 13px;
}

.tbc-btn-outline:hover {
    background: #fff5eb;
}

.tbc-btn-danger-sm {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
    padding: 4px 9px;
    font-size: 12px;
}

.tbc-alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13.5px;
    margin-bottom: 14px;
}

.tbc-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    font-weight: 600;
}

.tbc-alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Educational & FAQ Section */
.tbc-edu-section {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 2px solid var(--tbc-border);
}

.tbc-edu-section h2 {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 800;
    color: var(--tbc-primary);
}

.tbc-edu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 14px 0 22px;
}

.tbc-edu-card {
    background: var(--tbc-bg-soft);
    border: 1px solid var(--tbc-border);
    border-radius: var(--tbc-radius);
    padding: 14px;
}

.tbc-edu-card h3 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 800;
    color: var(--tbc-primary);
}

.tbc-edu-card p {
    margin: 0;
    font-size: 13.5px;
    color: var(--tbc-text);
}

.tbc-faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tbc-faq-item {
    background: #ffffff;
    border: 1px solid var(--tbc-border-neutral);
    border-radius: var(--tbc-radius);
    padding: 10px 14px;
}

.tbc-faq-item summary {
    font-weight: 700;
    color: var(--tbc-primary);
    cursor: pointer;
    font-size: 14.5px;
}

.tbc-faq-item p {
    margin: 8px 0 2px;
    font-size: 13.5px;
    color: var(--tbc-muted);
}

@media (max-width: 768px) {
    .tbc-grid-2,
    .tbc-grid-3,
    .tbc-edu-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .tbc-time-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media print {
    .tbc-utility-bar,
    .tbc-edu-section,
    .tbc-form-wrap,
    .no-print {
        display: none !important;
    }
    .tbc-app {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}


/* === PHASE 3: COMPARISON DASHBOARD, SVG CHARTS & DIFF MATRIX === */
.tbc-dashboard {
    margin-top: 20px;
}

.tbc-result-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: var(--tbc-bg-soft);
    border: 1px solid var(--tbc-border);
    border-top: 3px solid var(--tbc-primary);
    border-radius: var(--tbc-radius);
    margin-bottom: 14px;
}

.tbc-result-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 800;
    color: var(--tbc-primary);
}

.tbc-result-meta {
    font-size: 13px;
    color: var(--tbc-muted);
    font-weight: 600;
}

.tbc-alert-warn {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.tbc-loading {
    margin-top: 16px;
    padding: 20px;
    text-align: center;
    background: var(--tbc-bg-soft);
    border: 1px dashed var(--tbc-border);
    border-radius: var(--tbc-radius);
    font-weight: 700;
    color: var(--tbc-primary);
}

/* Synchronized Chart Tabs */
.tbc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--tbc-border);
    padding-bottom: 8px;
}

.tbc-tab-btn {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--tbc-primary);
    background: #ffffff;
    border: 1px solid var(--tbc-border);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tbc-tab-btn:hover {
    background: #fff5eb;
}

.tbc-tab-btn.tbc-tab-active {
    background: var(--tbc-primary);
    color: #ffffff;
    border-color: var(--tbc-primary);
}

/* Side-by-Side SVG Chart Grid */
.tbc-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.tbc-charts-grid.tbc-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tbc-chart-card {
    background: #ffffff;
    border: 1px solid var(--tbc-border-neutral);
    border-radius: var(--tbc-radius);
    padding: 12px;
    min-width: 0;
}

.tbc-chart-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.tbc-chart-card-head h3 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 800;
    color: var(--tbc-primary);
}

.tbc-chart-meta {
    font-size: 12px;
    color: var(--tbc-muted);
    font-weight: 600;
}

.tbc-badge-delta {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    white-space: nowrap;
}

.tbc-rot-chip {
    margin-bottom: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.tbc-svg-holder svg {
    width: 100%;
    max-width: 380px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Panels & Tables */
.tbc-panel {
    background: #ffffff;
    border: 1px solid var(--tbc-border-neutral);
    border-radius: var(--tbc-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.tbc-panel-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 800;
    color: var(--tbc-primary);
    border-bottom: 1px solid var(--tbc-border);
    padding-bottom: 6px;
}

.tbc-table-scroll {
    width: 100%;
    overflow-x: auto;
}

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

.tbc-table th {
    background: var(--tbc-primary);
    color: #ffffff;
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    border: 1px solid var(--tbc-primary);
}

.tbc-table td {
    padding: 7px 10px;
    border: 1px solid #e5e7eb;
    vertical-align: top;
}

.tbc-row-diff td {
    background: #fffbeb;
}

.tbc-row-subdiff td {
    background: #f0f9ff;
}

.tbc-subtext {
    font-size: 11.5px;
    color: var(--tbc-muted);
    margin-top: 2px;
}

.tbc-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.tbc-pill-diff { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.tbc-pill-subsub { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.tbc-pill-same { background: #f3f4f6; color: #4b5563; border: 1px solid #d1d5db; }
.tbc-pill-ben { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.tbc-pill-mal { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Insights List */
.tbc-insights-box {
    background: #fdf9f0;
    border-color: var(--tbc-border);
}

.tbc-insights-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13.5px;
}

.tbc-insight-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 800;
    background: var(--tbc-primary);
    color: #ffffff;
    margin-right: 4px;
}

@media (max-width: 900px) {
    .tbc-charts-grid,
    .tbc-charts-grid.tbc-cols-3 {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media print {
    @page { size: A4 portrait; margin: 10mm; }
    .ho-topbar-strip, header, .ho-breadcrumb-bar, .ho-sidebar-stack, footer {
        display: none !important;
    }
    .ho-main-grid { display: block !important; }
    .ho-content-box { border: none !important; padding: 0 !important; }
    .tbc-charts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .tbc-panel { page-break-inside: avoid; break-inside: avoid; }
    .tbc-table th {
        background: #7c1d1d !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}


/* === FORM LAYOUT POLISH: CLEAN ALIGNMENT & CITY DROPDOWN === */
.tbc-card {
    padding: 18px 20px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.tbc-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #efe4cf;
}

.tbc-card-head .tbc-section-title {
    margin: 0;
    padding: 0;
    border: none;
}

.tbc-card-head .tbc-hint {
    margin: 4px 0 0;
}

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

.tbc-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    align-items: start;
}

.tbc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

.tbc-field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 0;
    line-height: 1.3;
}

.tbc-input,
.tbc-select,
.tbc-app #search-data {
    width: 100%;
    height: 40px;
    padding: 7px 11px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--tbc-text);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    margin: 0;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tbc-input:focus,
.tbc-select:focus,
.tbc-app #search-data:focus {
    outline: none;
    border-color: var(--tbc-primary);
    box-shadow: 0 0 0 3px rgba(124, 29, 29, 0.12);
}

/* City autocomplete dropdown floats cleanly without shifting grid alignment */
.tbc-city-field {
    position: relative;
}

.tbc-city-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 240px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

.tbc-city-dropdown .search-result {
    padding: 9px 12px;
    font-family: inherit;
    font-size: 13.5px;
    color: #1e3a8a;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.tbc-city-dropdown .search-result:hover {
    background: #fdf8ee;
    color: #7c1d1d;
}

/* Sibling rows: proportional columns so HH:MM:SS never cramps */
.tbc-sibling-row {
    background: #fcfcfd;
    border: 1px solid #e2d5be;
    border-left: 4px solid var(--tbc-primary);
    border-radius: 8px;
    padding: 14px 16px;
}

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

.tbc-sibling-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tbc-sibling-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr) minmax(0, 1.8fr);
    gap: 12px 14px;
    align-items: end;
}

.tbc-time-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.tbc-time-group.tbc-has-ampm {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(66px, 0.95fr);
}

.tbc-time-group .tbc-select {
    padding: 6px 6px;
    text-align: center;
}

.tbc-submit-row {
    margin-top: 4px;
}

.tbc-btn-primary {
    height: 46px;
    border-radius: 8px;
    font-size: 15.5px;
    letter-spacing: 0.01em;
}

@media (max-width: 820px) {
    .tbc-form-grid,
    .tbc-sibling-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* === HORIZONTAL LANGUAGE SELECTION MENU === */
.tbc-lang-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    background: #ffffff;
    border: 1px solid var(--tbc-border);
    border-radius: var(--tbc-radius);
    padding: 8px 12px;
    margin: 12px 0 10px;
}

.tbc-lang-label {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--tbc-primary);
    white-space: nowrap;
}

.tbc-lang-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.tbc-lang-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: var(--tbc-primary);
    background: var(--tbc-bg-soft);
    border: 1px solid var(--tbc-border);
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tbc-lang-link:hover {
    background: #fff1d6;
    border-color: var(--tbc-primary);
    color: var(--tbc-primary-dark);
    text-decoration: none;
}

.tbc-lang-link.tbc-lang-active {
    background: var(--tbc-primary);
    border-color: var(--tbc-primary);
    color: #ffffff;
}

.tbc-lang-bar + .tbc-utility-bar {
    margin-top: 0;
}

@media print {
    .tbc-lang-bar {
        display: none !important;
    }
}
