/* ==========================================================================
   محافظة بني سويف - التصميم الرسمي المستقل (بدون بطاقات أو ربط بين الصفحات)
   مستوحى من الرسم التوضيحي والهوية البصرية الرسمية لمحافظة بني سويف
   ========================================================================== */

:root {
    --bs-sand: #C89D5C;
    --bs-sand-light: #EFE4D2;
    --bs-paper: #FAF7F2;
    --bs-terracotta: #8B3A0E;
    --bs-green: #0E4D29;
    --bs-green-soft: #E9F3EC;
    --bs-amber: #E5A922;
    --bs-ink: #2D180D;
    --bs-muted: #5C4B3E;
    --bs-rule: #DDD0BD;
    --bs-white: #FFFFFF;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    direction: rtl;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
    background-color: var(--bs-paper);
    color: var(--bs-ink);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Top Masthead (Standalone per page - no multi-page nav bar) */
.site-masthead {
    background: var(--bs-white);
    border-bottom: 3px solid var(--bs-sand);
}

.masthead-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-identity-img {
    height: 52px;
    width: auto;
    object-fit: contain;
}

.brand-title {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--bs-ink);
    line-height: 1.3;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--bs-muted);
    font-weight: 600;
}

.btn-print {
    padding: 0.45rem 1rem;
    border-radius: 6px;
    border: 1.5px solid var(--bs-terracotta);
    background: var(--bs-white);
    color: var(--bs-terracotta);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-print:hover {
    background: var(--bs-terracotta);
    color: var(--bs-white);
}

/* Main Document Sheet */
.page-container {
    max-width: 1140px;
    margin: 1.5rem auto 3rem;
    padding: 0 1.25rem;
}

.document-sheet {
    background: var(--bs-white);
    border: 1px solid var(--bs-rule);
    padding: 2rem 2.25rem;
}

/* ==========================================================================
   Signature Profile Plaque (Directly matches the hand-drawn sketch)
   ========================================================================== */
.profile-plaque {
    border: 2.5px solid var(--bs-ink);
    padding: 1.5rem 1.85rem 1.75rem;
    background: var(--bs-white);
    position: relative;
}

.profile-plaque::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: linear-gradient(90deg, var(--bs-green) 0%, var(--bs-amber) 35%, var(--bs-terracotta) 70%, var(--bs-sand) 100%);
}

.plaque-top-title {
    text-align: center;
    padding-bottom: 1rem;
    margin-bottom: 1.35rem;
    border-bottom: 2px solid var(--bs-ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.plaque-kicker {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--bs-green);
}

.plaque-heading {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    font-weight: 900;
    color: var(--bs-ink);
}

.plaque-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2.25rem;
    align-items: start;
}

/* Right Side Rail (RTL Start): Shield Logo Box + Square QR Box */
.plaque-side-rail {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.logo-shield-box {
    border: 2.5px solid var(--bs-ink);
    border-radius: 10px 10px 72px 72px;
    background: #FCF9F4;
    padding: 1rem 0.9rem 1.35rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.55rem;
}

.logo-shield-box img {
    width: 140px;
    height: 150px;
    object-fit: contain;
}

.logo-shield-caption {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--bs-terracotta);
}

/* Left Side (Main Info Lines matching the sketch rules - NO boxed cards) */
.plaque-details {
    display: flex;
    flex-direction: column;
}

.plaque-row {
    display: grid;
    grid-template-columns: 185px 1fr;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.75rem 0.25rem;
    border-bottom: 1.5px solid var(--bs-rule);
}

.plaque-row-label {
    font-size: 1.04rem;
    font-weight: 800;
    color: var(--bs-terracotta);
    white-space: nowrap;
}

.plaque-row-value {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--bs-ink);
}

.plaque-row-sub {
    margin-top: 0.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bs-muted);
}

.highlights-block {
    padding-top: 1rem;
}

.highlights-title {
    margin: 0 0 0.5rem;
    font-size: 1.06rem;
    font-weight: 800;
    color: var(--bs-green);
}

.highlights-lines {
    list-style: none;
    margin: 0;
    padding: 0;
}

.highlights-lines li {
    padding: 0.58rem 0.25rem;
    border-bottom: 1.5px solid #C8B59B;
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--bs-ink);
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.highlight-bullet {
    width: 8px;
    height: 8px;
    margin-top: 0.6rem;
    background: var(--bs-terracotta);
    flex-shrink: 0;
}

/* ==========================================================================
   Editorial Sections Below Plaque (Flat, Clean, Document-Style — NO Cards)
   ========================================================================== */
.doc-section {
    margin-top: 2.5rem;
    padding-top: 1.75rem;
    border-top: 2px solid var(--bs-rule);
}

.doc-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bs-sand);
}

.doc-section-title {
    margin: 0;
    font-size: 1.28rem;
    font-weight: 800;
    color: var(--bs-ink);
}

.doc-section-note {
    font-size: 0.86rem;
    color: var(--bs-muted);
    font-weight: 600;
}

/* Map + Narrative Editorial Split (No Cards) */
.map-narrative-split {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 2rem;
    align-items: start;
}

.admin-map-figure {
    margin: 0;
    padding: 0.75rem;
    background: var(--bs-white);
    border: 1.5px solid var(--bs-rule);
    text-align: center;
}

.admin-map-figure img {
    width: 100%;
    max-height: 410px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.admin-map-caption {
    margin-top: 0.65rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--bs-rule);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bs-muted);
}

/* Narrative Prose Columns (No Cards) */
.narrative-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem 2.25rem;
}

.narrative-entry {
    border-right: 3px solid var(--bs-green);
    padding-right: 1rem;
}

.narrative-entry h3 {
    margin: 0 0 0.4rem;
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--bs-terracotta);
}

.narrative-entry p {
    margin: 0;
    font-size: 0.93rem;
    color: var(--bs-ink);
    line-height: 1.8;
    font-weight: 600;
}

/* Sectors Ledger Columns (No Cards) */
.sectors-ledger {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 1.75rem 2.25rem;
}

.sector-column {
    border-top: 2.5px solid var(--bs-terracotta);
    padding-top: 0.75rem;
}

.sector-column-title {
    margin: 0 0 0.65rem;
    font-size: 1.04rem;
    font-weight: 800;
    color: var(--bs-terracotta);
}

.sector-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sector-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.42rem 0;
    border-bottom: 1px solid #EDE3D4;
    font-size: 0.91rem;
}

.sector-item:last-child {
    border-bottom: none;
}

.sector-item-key {
    color: var(--bs-muted);
    font-weight: 600;
}

.sector-item-val {
    color: var(--bs-ink);
    font-weight: 800;
    text-align: left;
}

/* Landmarks Editorial List (No Cards) */
.landmarks-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.15rem 2.25rem;
}

.landmark-entry {
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--bs-rule);
}

.landmark-type {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--bs-green);
    display: block;
    margin-bottom: 0.15rem;
}

.landmark-title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 800;
    color: var(--bs-ink);
}

.landmark-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--bs-muted);
    font-weight: 600;
}

/* Flat Editorial Data Tables */
.table-scroll {
    overflow-x: auto;
    border-top: 2px solid var(--bs-ink);
    border-bottom: 2px solid var(--bs-ink);
}

.gov-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.89rem;
}

.gov-table th {
    background: #F4EAD9;
    color: var(--bs-ink);
    font-weight: 800;
    text-align: right;
    padding: 0.7rem 0.85rem;
    border-bottom: 2px solid var(--bs-sand);
    white-space: nowrap;
}

.gov-table td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid #EAE0D0;
    color: var(--bs-ink);
    font-weight: 600;
    vertical-align: top;
}

.gov-table tbody tr:nth-child(even) {
    background: #FCF9F4;
}

.gov-table tfoot td {
    background: #F4EAD9;
    font-weight: 800;
    border-top: 2px solid var(--bs-sand);
}

/* Tabs & Search Filter Bar (Flat Document Style) */
.tabs-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
    border-bottom: 1.5px solid var(--bs-rule);
    padding-bottom: 0.65rem;
}

.tab-btn {
    padding: 0.42rem 0.9rem;
    border-radius: 4px;
    border: 1px solid var(--bs-rule);
    background: var(--bs-paper);
    color: var(--bs-ink);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
}

.tab-btn:hover {
    background: var(--bs-sand-light);
}

.tab-btn.is-active {
    background: var(--bs-terracotta);
    color: var(--bs-white);
    border-color: var(--bs-terracotta);
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.filter-input,
.filter-select {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.48rem 0.8rem;
    border: 1.5px solid var(--bs-rule);
    border-radius: 4px;
    background: var(--bs-paper);
    color: var(--bs-ink);
}

.filter-input {
    flex: 1 1 260px;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--bs-terracotta);
}

.filter-count {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--bs-terracotta);
}

.village-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
}

.village-item {
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--bs-ink);
}

.village-item::after {
    content: " •";
    color: var(--bs-sand);
    margin-right: 0.45rem;
}

.village-item:last-child::after {
    content: "";
}

.village-item.is-city {
    color: var(--bs-green);
    font-weight: 800;
}

/* Population Bar Comparison */
.pop-bars {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.pop-bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 125px;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.9rem;
}

.pop-bar-track {
    height: 12px;
    background: #EFE6D8;
    overflow: hidden;
}

.pop-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bs-green), var(--bs-terracotta));
}

.is-hidden {
    display: none !important;
}

/* Footer */
.site-footer {
    max-width: 1140px;
    margin: 0 auto 2rem;
    padding: 0.85rem 1.25rem;
    font-size: 0.83rem;
    color: var(--bs-muted);
    font-weight: 600;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
}

@media (max-width: 860px) {
    .map-narrative-split {
        grid-template-columns: 1fr;
    }

    .document-sheet {
        padding: 1.25rem 1rem;
    }

    .profile-plaque {
        padding: 1.15rem 1rem;
    }

    .plaque-grid {
        grid-template-columns: 1fr;
    }

    .plaque-side-rail {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .logo-shield-box {
        flex: 0 1 220px;
    }

    .plaque-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}

@media print {
    .site-masthead,
    .site-footer,
    .no-print {
        display: none !important;
    }

    body {
        background: #FFFFFF;
    }

    .page-container {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    .document-sheet {
        border: none;
        padding: 0;
    }

    .profile-plaque {
        break-inside: avoid;
    }
}
