:root {
    --green-deep: #021a0e;
    --green-dark: #042d16;
    --green-mid: #06401f;
    --green-accent: #0a5c2c;
    --green-light: #2ecc71;
    --cyan: #00d4aa;
    --gold: #e6a817;
    --gold-light: #ffd740;
    --white: #ffffff;
    --white-08: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.10);
    --radius-lg: 16px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --header-h: 72px;
    --info-bar-h: 44px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
    direction: rtl;
    font-family: 'Cairo', sans-serif;
    background: var(--green-deep);
    color: var(--white);
}

/* ══ HEADER ══ */
header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1000;
    height: var(--header-h);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(2, 26, 14, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(46, 204, 113, 0.15);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(46, 204, 113, 0.3));
    transition: filter var(--transition), transform var(--transition);
}

.header-brand:hover .logo-img {
    filter: drop-shadow(0 4px 16px rgba(46, 204, 113, 0.55));
    transform: scale(1.04);
}

.logo-fallback {
    display: none;
    align-items: center;
    gap: 10px;
}

.logo-fallback-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #0a5c2c, #00d4aa);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.logo-fallback-text {
    font-family: 'Amiri Quran', serif;
    font-size: 19px;
    color: white;
}

.logo-fallback-sub {
    font-size: 10px;
    color: #2ecc71;
    letter-spacing: 2px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 14px;
    color: var(--gold-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: white;
    background: var(--white-08);
}

.nav-link.active {
    color: var(--gold-light);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 14px;
    left: 14px;
    height: 2px;
    background: var(--gold-light);
    border-radius: 2px;
}

.btn-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(230, 168, 23, 0.15), rgba(255, 215, 64, 0.08));
    border: 1px solid rgba(230, 168, 23, 0.35);
    border-radius: 50px;
    color: var(--gold-light);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-login:hover {
    background: linear-gradient(135deg, rgba(230, 168, 23, 0.28), rgba(255, 215, 64, 0.15));
    border-color: var(--gold-light);
    transform: translateY(-1px);
}

/* ══ INFO BAR ══ */
.info-bar {
    position: fixed;
    top: var(--header-h);
    right: 0;
    left: 0;
    z-index: 900;
    background: rgba(4, 45, 22, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(46, 204, 113, 0.12);
}

.info-toggle-btn {
    width: 100%;
    padding: 10px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gold-light);
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 700;
    transition: var(--transition);
}

.info-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.04);
}

.info-toggle-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-toggle-icon {
    font-size: 18px;
}

.info-toggle-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold-light);
}

.info-toggle-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.40);
    font-weight: 400;
    margin-right: 8px;
}

.info-toggle-arrow {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.40);
    transition: transform var(--transition);
}

.info-toggle-btn.open .info-toggle-arrow {
    transform: rotate(180deg);
}

.info-content-wrap {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
}

.info-content-wrap.open {
    max-height: 200px;
    opacity: 1;
}

.info-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 0 32px 14px;
}

.info-icon {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}

.info-text {
    flex: 1;
}

.info-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.60);
    line-height: 1.75;
}

.info-desc span {
    color: var(--cyan);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px dashed rgba(0, 212, 170, 0.4);
    transition: color 0.2s;
}

.info-desc span:hover {
    color: var(--green-light);
}

.info-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    padding: 6px 32px 0;
}

.breadcrumb-link {
    color: var(--green-light);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb-link:hover {
    color: var(--cyan);
}

/* ══ MAP CONTAINER ══ */
#map-container {
    position: fixed;
    top: calc(var(--header-h) + var(--info-bar-h));
    right: 0;
    left: 0;
    bottom: 44px;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#map-container.info-open {
    top: calc(var(--header-h) + var(--info-bar-h) + 120px);
}

#map {
    width: 100%;
    height: 100%;
}

/* ══ FLOAT PANEL ══ */
.float-panel {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.panel-btn-wrap {
    position: relative;
}

.panel-btn {
    width: 46px;
    height: 46px;
    background: rgba(2, 26, 14, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(46, 204, 113, 0.25);
    border-radius: 12px;
    color: var(--green-light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.panel-btn:hover {
    background: rgba(10, 92, 44, 0.85);
    border-color: var(--green-light);
    transform: scale(1.05);
}

.panel-btn.active {
    background: rgba(10, 92, 44, 0.90);
    border-color: var(--gold-light);
    color: var(--gold-light);
}

/* Dropdown */
.panel-dropdown {
    position: absolute;
    top: 0;
    right: 54px;
    background: rgba(2, 26, 14, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(46, 204, 113, 0.25);
    border-radius: 14px;
    padding: 8px;
    min-width: 190px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    gap: 3px;
    animation: slide-in 0.2s ease;
    /* تأكد أنه لا يخرج من الشاشة */
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.panel-dropdown::-webkit-scrollbar {
    width: 3px;
}

.panel-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.panel-dropdown.open {
    display: flex;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.dropdown-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 1.5px;
    padding: 3px 8px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 2px;
}

/* تصنيف داخل قائمة البيانات */
.dropdown-section-label {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 1px;
    padding: 6px 8px 3px;
    text-transform: uppercase;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 10px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.70);
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid transparent;
}

.dropdown-item:hover {
    background: rgba(46, 204, 113, 0.10);
    color: white;
}

.dropdown-item.active {
    background: rgba(46, 204, 113, 0.15);
    color: var(--green-light);
    border-color: rgba(46, 204, 113, 0.25);
}

.dropdown-item-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.chk {
    width: 15px;
    height: 15px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    transition: var(--transition);
}

.dropdown-item.active .chk {
    background: var(--green-light);
    border-color: var(--green-light);
    color: #021a0e;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

/* ══ ZOOM ══ */
.zoom-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
}

.zoom-btn {
    width: 46px;
    height: 46px;
    background: rgba(2, 26, 14, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: rgba(10, 92, 44, 0.85);
    border-color: var(--green-light);
}

/* Reset */
.btn-reset {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: rgba(2, 26, 14, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(46, 204, 113, 0.22);
    border-radius: 50px;
    color: var(--green-light);
    font-family: 'Cairo', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-reset:hover {
    background: rgba(10, 92, 44, 0.85);
}

/* ══ LEGEND — قابلة للطي ══ */
.map-legend {
    position: absolute;
    bottom: 14px;
    left: 14px;
    z-index: 800;
    background: rgba(2, 26, 14, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    min-width: 145px;
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}

.legend-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.legend-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 1px;
}

.legend-toggle-arrow {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.30);
    transition: transform var(--transition);
}

.legend-body {
    padding: 8px 12px 10px;
}

.legend-body.collapsed {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 4px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.leg-line {
    width: 16px;
    height: 2px;
    border-radius: 2px;
    flex-shrink: 0;
}

.leg-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

/* ══ COORDS ══ */
.coords-bar {
    position: absolute;
    bottom: 54px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 800;
    background: rgba(2, 26, 14, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 4px 14px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.40);
    pointer-events: none;
    white-space: nowrap;
}

/* ══ POPUP ══ */
.leaflet-popup-content-wrapper {
    background: rgba(4, 45, 22, 0.97) !important;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(46, 204, 113, 0.25) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
    color: white !important;
    direction: rtl;
    font-family: 'Cairo', sans-serif !important;
}

.leaflet-popup-tip-container {
    display: none;
}

.leaflet-popup-content {
    margin: 0 !important;
}

.popup-inner {
    padding: 12px 16px;
    min-width: 180px;
}

.popup-type {
    font-size: 10px;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 5px;
}

.popup-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
    color: white;
}

.popup-row {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.popup-row span {
    color: rgba(255, 255, 255, 0.85);
}

.leaflet-popup-close-button {
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 16px !important;
    top: 8px !important;
    left: 8px !important;
    right: auto !important;
}

/* ══ FOOTER ══ */
.map-footer {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 700;
    padding: 0 32px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(2, 26, 14, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(46, 204, 113, 0.10);
}

.footer-copy {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.30);
}

.footer-copy strong {
    color: rgba(255, 255, 255, 0.55);
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border: none;
    border-radius: 50px;
    color: white;
    font-family: 'Cairo', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 3px 12px rgba(37, 211, 102, 0.25);
    transition: var(--transition);
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
}

/* ══ TOAST ══ */
#toast {
    position: fixed;
    top: 86px;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    z-index: 9999;
    background: rgba(4, 45, 22, 0.97);
    border: 1px solid var(--cyan);
    border-radius: 50px;
    padding: 9px 22px;
    font-size: 13px;
    color: var(--cyan);
    backdrop-filter: blur(12px);
    transition: transform 0.4s ease;
    pointer-events: none;
    white-space: nowrap;
    font-family: 'Cairo', sans-serif;
}

/* ══ GOV LABELS ══ */
.gov-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #ffd740;
    font-family: 'Cairo', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
}

/* ══ LOGIN MODAL ══ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: linear-gradient(160deg, #042d16, #021a0e);
    border: 1px solid rgba(46, 204, 113, 0.25);
    border-radius: 20px;
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    transform: translateY(30px) scale(0.96);
    transition: transform 0.35s ease;
    position: relative;
}

.modal-overlay.open .modal-box {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 12px;
    left: 14px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover {
    color: white;
}

.modal-logo {
    text-align: center;
    margin-bottom: 20px;
}

.modal-logo-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #0a5c2c, #00d4aa);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 8px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 3px;
}

.modal-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.40);
}

.modal-tabs {
    display: flex;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 4px;
}

.modal-tab {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.50);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.modal-tab.active {
    background: rgba(46, 204, 113, 0.15);
    color: var(--green-light);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
}

.form-input {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: white;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    outline: none;
    direction: rtl;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--green-light);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.btn-submit {
    padding: 11px;
    margin-top: 4px;
    background: linear-gradient(135deg, #0a5c2c, #1a8c4e);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-submit:hover {
    transform: translateY(-2px);
}

.modal-footer-note {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.30);
    margin-top: 6px;
}

.modal-footer-note span {
    color: var(--green-light);
    cursor: pointer;
    font-weight: 600;
}

/* ══ RESPONSIVE ══ */
@media (max-width:768px) {
    header {
        padding: 0 12px;
    }

    .header-nav {
        display: none;
    }

    .btn-login {
        padding: 7px 12px;
        font-size: 12px;
    }

    .info-toggle-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .info-content {
        padding: 0 16px 12px;
    }

    .info-breadcrumb {
        padding: 6px 16px 0;
    }

    .panel-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }

    .zoom-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }

    .float-panel {
        top: 10px;
        right: 10px;
        gap: 5px;
    }

    /* Dropdown لليسار داخل الشاشة على الموبايل */
    .panel-dropdown {
        right: auto;
        left: 50px;
        min-width: 175px;
        max-height: calc(100vh - 180px);
    }

    /* Legend أصغر وأسفل يسار */
    .map-legend {
        left: 8px;
        bottom: 56px;
        min-width: 130px;
    }

    .legend-title {
        font-size: 9px;
    }

    .legend-item {
        font-size: 9px;
        gap: 5px;
        margin-bottom: 3px;
    }

    .leg-line {
        width: 13px;
    }

    .leg-dot {
        width: 6px;
        height: 6px;
    }

    .btn-reset {
        bottom: 56px;
        right: 10px;
        padding: 6px 12px;
        font-size: 11px;
    }

    .map-footer {
        padding: 0 12px;
    }

    .footer-copy {
        font-size: 10px;
    }
}

@media (max-width:480px) {
    .info-toggle-sub {
        display: none;
    }

    .coords-bar {
        display: none;
    }

    /* Legend مطوية افتراضياً على الموبايل الصغير */
    .legend-body {
        display: none;
    }

    .legend-toggle-arrow::before {
        content: '▼';
    }
}