/* --- Infobox Container --- */
.infobox {
    --infobox-bg: #101019db;
    --infobox-padding: 12px;
    --infobox-radius: 4px;
    --infobox-border-color: var(--accent);
    --infobox-title-bg: #2d2d5769;
    --infobox-header-bg: #2d2d5769;
    --infobox-label-color: #d3d3ff;
    --infobox-data-color: #acacff;
    --infobox-row-border: rgba(255, 255, 255, 0.05);
    --infobox-sub-row-bg: #1a1a2b;
    --infobox-group-header-bg: #2d2d5740;

    float: right;
    width: 25em;
    background-color: var(--infobox-bg);
    border: 1px solid var(--infobox-border-color);
    padding: var(--infobox-padding);
    margin-left: 20px;
    margin-bottom: 20px;
    border-radius: var(--infobox-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    font-size: 0.85rem;
    user-select: none;
}

.infobox > * {
    user-select: text;
}

/* --- Headers and Titles --- */
.infobox-title {
    background: var(--infobox-title-bg);
    padding: 16px 8px;
    margin: calc(-1 * var(--infobox-padding)) calc(-1 * var(--infobox-padding)) 10px calc(-1 * var(--infobox-padding));
    text-align: center;
    font-weight: bold;
    border-bottom: 1px solid var(--infobox-border-color);
    line-height: 1.2;
    font-size: 1.4em;
}

.infobox .subheader {
    display: block;
    font-weight: 500;
    font-size: 0.75em;
    margin-top: 4px;
    line-height: 1.3;
}

.infobox-header {
    font-weight: bold;
    text-align: center;
    padding: 8px 0;
    margin: 5px 0;
    background-color: var(--infobox-header-bg);
    color: var(--text);
    border-radius: 3.5px;
}

/* --- Rows and Data --- */
.infobox-row {
    display: grid;
    grid-template-columns: 1.1fr 2fr; 
    gap: 15px; 
    padding: 6px 0;
    border-bottom: 1px solid var(--infobox-row-border);
    text-align: left;
    color: var(--infobox-data-color);
    align-items: baseline;
}

.infobox-row:has(+ .infobox-header),
.infobox > .infobox-row:last-child {
    border-bottom: none;
}

.infobox-row:has(+ .compact-row) {
    border-bottom: none !important;
}

.infobox-label {
    font-weight: bold;
    color: var(--infobox-label-color);
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

/* sub‑label inside a main cell (e.g. “and largest city”) */
.sub-label {
    display: block;
    font-weight: normal;
    font-size: 0.9em;
    color: var(--infobox-label-color);
    line-height: 1.1;
    margin-top: 1px;
}

.full-width-row {
    grid-column: 1 / -1; 
    text-align: center;
    justify-content: center;
    padding: 10px 0; 
}

/* --- Grouped Sub‑Rows (for `items` objects) --- */
.infobox-data-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-item-row {
    background-color: var(--infobox-sub-row-bg);
    font-size: 0.95em;
}

.sub-item-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 6px; 
}

.bullet {
    flex-shrink: 0;
    width: 10px;
    text-align: center;
    color: var(--infobox-label-color);
    user-select: none;
}

.sub-item-label:not(:has(.bullet)) {
    gap: 0;
}

.bullet {
    flex-shrink: 0;
    width: 12px;
    text-align: center;
}

.label-text {
    word-break: break-word;
}

.group-header {
    background-color: var(--infobox-group-header-bg);
}

/* --- Lists and Misc --- */
.no-border {
    border-bottom: none !important;
}

.compact-row {
    padding: 2px 0 !important;
    border-bottom: none !important;
}

.compact-row .infobox-label {
    font-weight: normal;
}

.compact-row:not(:has(+ .compact-row)) {
    border-bottom: 1px solid var(--infobox-row-border) !important;
    padding-bottom: 6px !important;
}

.infobox-row.last-item {
    border-bottom: 1px solid var(--infobox-row-border) !important;
    padding-bottom: 6px !important;
}

.infobox ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

/* --- Image Styling --- */
.infobox-img {
    width: 100% !important;
    max-width: 250px;  
    margin: 0 auto;   
    display: block;
}

.image-container:not(.dual-image) .infobox-img {
    max-width: 90%; 
    margin: 0 auto;
}

.image-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px 0px;
}

.dual-image {
    display: flex;
    align-items: center; 
    justify-content: space-around;
    gap: 15px;
    margin-bottom: 15px;
}

.dual-image .infobox-img { 
    max-height: 120px;
    object-fit: contain;
    flex: 0 1 auto;
    height: 80px;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .infobox {
        float: none;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    .dual-image {
        flex-direction: column;
        align-items: center;
    }
    .dual-image .infobox-img {
        max-height: none;
        height: auto;
        max-width: 90%;
    }
}