/* ===================================================================
   Azure Scout – Custom styles (Bootstrap 5.3 overrides)
   =================================================================== */

/* ---- Custom properties ---- */
:root {
    --az-blue: #0078d4;
    --az-dark: #004578;
}

/* ---- Topology sidebar ---- */
.topo-sidebar {
    position: sticky;
    top: 1rem;
}

/* ---- Subscription checklist ---- */
.subscription-checklist {
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: 0.35rem 0.5rem;
}

.subscription-checklist label {
    display: block;
    padding: 0.15rem 0;
    cursor: pointer;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Region combobox dropdown ---- */
#region-dropdown,
#planner-sub-dropdown {
    max-height: 260px;
    overflow-y: auto;
    font-size: 0.85rem;
}

#region-dropdown .dropdown-item,
#planner-sub-dropdown .dropdown-item {
    padding: 0.3rem 0.75rem;
    cursor: pointer;
}

.region-name {
    opacity: 0.6;
    font-size: 0.8em;
}

/* ---- Graph sizing (constrain on large screens) ---- */
.graph-container {
    max-width: 720px;
}

.graph-container svg {
    width: 100%;
    height: auto;
}

/* ---- D3 graph styles ---- */
.group-box-left {
    fill: var(--bs-tertiary-bg);
    stroke-width: 2;
    stroke-opacity: 0.8;
}

.group-box-right {
    fill: var(--bs-tertiary-bg);
    stroke: var(--az-blue);
    stroke-width: 2;
    stroke-opacity: 0.5;
}

.group-label-left,
.group-label-right {
    font-size: 12px;
    font-weight: 600;
}

.group-label-right {
    fill: var(--az-blue);
}

.node-rect-left {
    fill: var(--bs-body-bg);
    stroke-width: 2;
}

.node-rect-right {
    stroke-width: 2;
}

.node-label {
    font-size: 13px;
    font-weight: 500;
    fill: var(--bs-body-color);
}

.link {
    transition: opacity 0.15s;
}

.link.dimmed {
    opacity: 0.08 !important;
}

.link.highlighted {
    opacity: 1 !important;
    stroke-width: 3.5;
}

/* ---- Legend ---- */
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* ---- Zone mapping table ---- */
.mapping-table {
    font-size: 0.85rem;
}

.mapping-table .sub-name-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Physical zone colour badges */
.zone-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #fff;
}

.pz-1 { background: #0078d4; }
.pz-2 { background: #107c10; }
.pz-3 { background: #d83b01; }
.pz-4 { background: #8764b8; }
.pz-5 { background: #008272; }
.pz-6 { background: #b4009e; }

.consistency-row .same {
    color: var(--bs-success);
    font-weight: 600;
}

.consistency-row .different {
    color: var(--bs-warning);
    font-weight: 600;
}

/* ---- SKU table ---- */
.sku-table {
    font-size: 0.82rem;
}

.sku-table th {
    white-space: nowrap;
    vertical-align: middle;
}

/* ---- Simple-DataTables overrides ---- */
.datatable-container {
    overflow-x: auto;
}

.datatable-wrapper .datatable-top {
    padding: 0.5rem 0;
}

.datatable-wrapper .datatable-bottom {
    padding: 0.25rem 0;
}

.datatable-wrapper .datatable-info {
    font-size: 0.82rem;
    color: var(--bs-secondary-color);
}

/* ---- Per-column filter row ---- */
.datatable-filter-row td {
    padding: 0.2rem 0.25rem;
}

.datatable-column-filter {
    width: 100%;
    padding: 0.15rem 0.35rem;
    font-size: 0.78rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.datatable-column-filter:focus {
    border-color: var(--az-blue);
    box-shadow: 0 0 0 0.15rem rgba(0, 120, 212, 0.2);
    outline: none;
}

.datatable-column-filter::placeholder {
    color: var(--bs-secondary-color);
    opacity: 0.6;
    font-size: 0.75rem;
}

.zone-available {
    color: var(--bs-success) !important;
    text-align: center;
    font-size: 1rem;
}

.zone-restricted {
    color: var(--bs-warning) !important;
    text-align: center;
    font-size: 0.9rem;
}

.zone-unavailable {
    color: var(--bs-secondary) !important;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.5;
}

/* ---- SKU name as a link button ---- */
.sku-name-btn {
    background: none;
    border: none;
    color: var(--az-blue);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.sku-name-btn:hover {
    text-decoration-style: solid;
}

/* ---- Spot score badges ---- */
.spot-cell-btn {
    background: none;
    border: 1px dashed var(--bs-border-color);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--bs-body-color);
}

.spot-cell-btn:hover {
    border-style: solid;
    border-color: var(--az-blue);
}

.spot-cell-btn.has-score {
    border-style: solid;
}

.spot-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.spot-high { background: #d4edda; color: #155724; }
.spot-medium { background: #fff3cd; color: #856404; }
.spot-low { background: #f8d7da; color: #721c24; }
.spot-unknown { background: var(--bs-secondary-bg); color: var(--bs-body-color); }

.spot-zone-label {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-right: 0.15rem;
}

.spot-modal-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 0.5rem;
    align-items: center;
}

/* ---- Region summary bar ---- */
.region-summary-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
}
.region-summary-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    color: var(--bs-body-color);
}
.region-summary-title .bi {
    color: var(--bs-primary);
    margin-right: 0.35rem;
}
.region-summary-scores {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-wrap: wrap;
}
.region-score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}
.region-score-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}
.region-score-value .confidence-badge {
    font-size: 0.85rem;
    padding: 0.25rem 0.65rem;
}
.region-stat {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bs-body-color);
}

/* ---- Confidence badge ---- */
.confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.confidence-high { background: #d4edda; color: #155724; border: 1px solid #b1dfbb; }
.confidence-medium { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.confidence-low { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.confidence-very-low { background: #f5c6cb; color: #721c24; border: 1px solid #f1b0b7; }

/* ---- Confidence breakdown / VM profile inside pricing modal ---- */
.confidence-section {
    margin-top: 0;
    padding-top: 0;
}

.confidence-title {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.confidence-info-icon {
    font-size: 0.8rem;
    cursor: help;
}

.confidence-breakdown-table .bi-info-circle {
    font-size: 0.72rem;
    cursor: help;
}

.confidence-breakdown-table {
    font-size: 0.82rem;
}

.confidence-missing {
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.vm-profile-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color);
}

.vm-profile-title {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.vm-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.vm-profile-card {
    background: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius);
    padding: 0.75rem;
}

.vm-profile-card-title {
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.4rem;
    color: var(--az-blue);
}

.vm-profile-row {
    display: flex;
    justify-content: space-between;
    padding: 0.15rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.vm-profile-label {
    color: var(--bs-secondary-color);
}

.vm-profile-row-stacked {
    flex-direction: column;
    gap: 0.2rem;
}

.vm-badge {
    display: inline-block;
    padding: 0 0.35rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
}

.vm-badge-yes { background: #d4edda; color: #155724; }
.vm-badge-no { background: #f8d7da; color: #721c24; }
.vm-badge-unknown { background: var(--bs-secondary-bg); color: var(--bs-body-color); }
.vm-badge-limited { background: #fff3cd; color: #856404; }
.vm-badge-block {
    display: block;
    white-space: normal;
    word-break: break-word;
    text-align: left;
    line-height: 1.4;
}
.restriction-item + .restriction-item {
    margin-top: 0.2rem;
    padding-top: 0.2rem;
    border-top: 1px dashed rgba(133, 100, 4, 0.3);
}

.price-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---- Pricing detail table in modal ---- */
.pricing-detail-table {
    font-size: 0.85rem;
}

#pricingAccordion .accordion-button,
#quotaAccordion .accordion-button,
#zoneAccordion .accordion-button {
    font-size: 0.88rem;
    padding: 0.5rem 0.75rem;
}

#pricingAccordion .accordion-body,
#quotaAccordion .accordion-body,
#zoneAccordion .accordion-body {
    font-size: 0.85rem;
}

/* ---- Responsive modal sizing ---- */
@media (min-width: 1200px) {
    #pricingModal .modal-dialog { max-width: 900px; }
}

@media (max-width: 767.98px) {
    .vm-profile-grid { grid-template-columns: 1fr; }
    .pricing-detail-table { font-size: 0.78rem; }
    .confidence-breakdown-table { font-size: 0.76rem; }
    .vm-profile-row { font-size: 0.75rem; }
    .vm-profile-card { padding: 0.5rem; }
    .vm-profile-card-title { font-size: 0.78rem; }
    .region-summary-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }
    #pricingAccordion .accordion-button,
    #quotaAccordion .accordion-button,
    #zoneAccordion .accordion-button {
        font-size: 0.82rem;
        padding: 0.4rem 0.6rem;
    }
}

/* ---- Dark theme tweaks for custom badges ---- */
[data-bs-theme="dark"] .spot-high { background: #1e4620; color: #a3d9a5; }
[data-bs-theme="dark"] .spot-medium { background: #4a3c00; color: #ffe066; }
[data-bs-theme="dark"] .spot-low { background: #4a1c1e; color: #f5a3a7; }
[data-bs-theme="dark"] .confidence-high { background: #1e4620; color: #a3d9a5; border-color: #2d6a30; }
[data-bs-theme="dark"] .confidence-medium { background: #4a3c00; color: #ffe066; border-color: #6b5700; }
[data-bs-theme="dark"] .confidence-low { background: #4a1c1e; color: #f5a3a7; border-color: #6b2a2d; }
[data-bs-theme="dark"] .confidence-very-low { background: #3b1c1e; color: #f5a3a7; border-color: #5c2426; }
[data-bs-theme="dark"] .vm-badge-yes { background: #1e4620; color: #a3d9a5; }
[data-bs-theme="dark"] .vm-badge-no { background: #4a1c1e; color: #f5a3a7; }
[data-bs-theme="dark"] .vm-badge-limited { background: #4a3c00; color: #ffe066; }
