/* CSS Variables for a dark theme, similar to TimelineMap */
:root {
    --color-bg-primary: #1F1F1F;
    --color-bg-secondary: #2C2C2C;
    --color-text-primary: #E0E0E0;
    --color-text-secondary: #B0B0B0;
    --color-accent-gold: #D4AF37;
    --color-timeline-bg: #1A1A1A;
    --color-timeline-year: #888888;
    --color-timeline-marker: #D32F2F;
    --color-link-hover: #D4AF37;
    --font-main: 'Vazirmatn', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: var(--font-main);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    direction: rtl;
    text-align: right;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* --- Header (Old Maps Online Style) --- */
.header {
            font-family: var(--font-main);
            display: flex;
            direction: rtl;
            text-align: right;
            justify-content: space-between;
            align-items: center;
            background-color: #473116;
            padding: 0 1rem;
            height: 80px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
            z-index: 1000;
        }
        
        #header-left {
            display: flex;
            align-items: center;
        }

        #header-logo {
            font-weight: 700;
            color: var(--color-accent-gold);
            text-decoration: none;
            white-space: nowrap;
            padding-top: 10px;
        }
        
        #search-box {
            display: flex;
            align-items: center;
            background-color: #837A6E80;
            border-radius: 20px;
            padding: 0.5rem 1rem;
            width: 300px;
            margin: 0 1.5rem;
        }
        
        #search-box input {
            background: none;
            border: none;
            color: var(--color-text-primary);
            font-family: var(--font-main);
            width: 100%;
            outline: none;
            padding: 0;
            margin-right: 0.5rem;
        }
        
        #search-box input::placeholder {
            color: var(--color-text-secondary);
        }
        
        #header-nav {
            display: flex;
            align-items: center;
        }

        #header-nav a {
            color: #ffffff;
            text-decoration: none;
            padding: 0.5rem 1rem;
            font-weight: 400;
            transition: color 0.2s ease;
            white-space: nowrap;
        }
        
        #header-nav a:hover {
            color: var(--color-accent-gold);
        }

        #header-right {
            display: flex;
            align-items: center;
            position: relative;
            gap: 1rem;
        }
        /* --- Share Button --- */
        #share-button {
            background: none;
            border: none;
            color: var(--color-text-secondary);
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            cursor: pointer;
            border-radius: 50%;
            transition: background-color 0.2s ease;
        }

        #share-button:hover {
            background-color: #383838;
        }

        /* --- User Avatar and Dropdown --- */
        #user-avatar-container {
            position: relative;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--color-text-primary);
            font-size: 1.2rem;
            cursor: pointer;
        }

        #user-dropdown {
            position: absolute;
            top: 100%;
            right: -250px;
            width: 250px;
            background-color: #473116c0;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.5);
            padding: 1rem;
            margin-top: 0.5rem;
            z-index: 999;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-10px);
            transition: opacity 0.2s ease, transform 0.2s ease;
        }
        
        #user-dropdown.open {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }
        
        .dropdown-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 0.7rem 1rem;
            text-decoration: none;
            color: var(--color-text-secondary);
            border-radius: 4px;
            transition: background-color 0.2s ease, color 0.2s ease;
        }
        
        .dropdown-item:hover {
            background-color: #383838;
            color: var(--color-text-primary);
        }
        
        .dropdown-item i {
            width: 20px;
            text-align: center;
            font-size: 1rem;
        }
        
        .dropdown-item span {
            font-size: 0.9rem;
        }



        /* استایل‌های مربوط به دکمه تغییر زبان */
        .language-switcher {
            position: relative;
            padding-right: 300px;
            /* این بخش را حذف کنید اگر قبلاً در `header-right` تعریف شده باشد. */
        }

        /* استایل دکمه تغییر زبان با متن */
        .language-button {
            background-color: rgba(255, 255, 255, 0.08); /* پس‌زمینه کمی شفاف */
            border: 1px solid rgba(255, 255, 255, 0.15); /* حاشیه */
            color: var(--color-text-primary);
            padding: 0.5rem 1rem;
            border-radius: 20px; /* گوشه‌های گرد */
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 1rem;
            cursor: pointer;
            transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
        }

        .language-button:hover {
            background-color: rgba(255, 255, 255, 0.15);
            border-color: var(--color-accent-gold); /* حاشیه طلایی پررنگ‌تر */
            transform: translateY(-2px);
        }

        /* آیکون داخل دکمه */
        .language-button .icon {
            font-size: 1.2rem;
            color: var(--color-accent-gold);
        }

        /* متن داخل دکمه */
        .language-button .text {
            font-family: var(--font-main);
            font-weight: 500;
        }

        /* استایل‌های مربوط به منوی کشویی زبان */
        .language-dropdown {
            position: absolute;
            top: 100%;
            width: 170px;
            background-color: #685f5480;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.5);
            padding: 1rem;
            margin-top: 0.5rem;
            z-index: 999;
            opacity: 0;
            visibility: hidden; /* منو را پنهان می‌کند */
            transform: translateY(-10px);
            transition: opacity 0.2s ease, transform 0.2s ease;
            direction: rtl; 
        }

        /* این کلاس با جاوا اسکریپت اضافه می‌شود تا منو نمایش داده شود */
        .language-dropdown.open {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

/* --- Share Modal --- */
#share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease;
}

#share-modal.open {
    visibility: visible;
    opacity: 1;
}

#share-popup {
    width: 500px;
    background-color: #473116;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    padding: 1.5rem;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#share-modal.open #share-popup {
    transform: scale(1);
}

#share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #383838;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

#share-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
}

#share-header button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.share-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #383838;
}

.share-tabs button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 0;
    cursor: pointer;
    transition: color 0.2s ease;
}

.share-tabs button.active {
    color: var(--color-accent-gold);
    border-bottom: 2px solid var(--color-accent-gold);
}

.tab-content {
    padding-top: 1rem;
}

.link-share-section p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.link-input-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.link-input-container input {
    flex-grow: 1;
    background-color: #837A6E80;
    border: 1px solid #444;
    color: var(--color-text-primary);
    font-family: var(--font-main);
    padding: 0.7rem;
    border-radius: 4px;
    outline: none;
}

.link-input-container button {
    background-color: var(--color-accent-gold);
    color: var(--color-bg-primary);
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.link-input-container button:hover {
    opacity: 0.8;
}

.social-share-section {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.social-share-section p {
    margin: 0;
    white-space: nowrap;
}

.social-icons {
    display: flex;
    gap: 0.5rem;
}

.social-icon {
    width: 40px;
    height: 40px;
    background-color: #383838;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 1.2rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.social-icon:hover {
    background-color: #444;
}

/* --- Main Content Area --- */
#main-content {
    flex-grow: 1;
    position: relative;
    display: flex;
}

/* --- Map Container --- */
#map-container {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #1F1F1F;
}

/* --- Left-side Map Controls --- */
#map-controls-left {
    position: absolute;
    top: 2rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 900;
}

#map-controls-left .control-group {
    display: flex;
    flex-direction: column;
    background-color: #473116;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    overflow: hidden;
    border: 1px solid #383838;
}

#map-controls-left button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.2s ease;
}

#map-controls-left button:hover {
    background-color: #383838;
}

#map-controls-left .control-group button:not(:last-child) {
    border-bottom: 1px solid #383838;
}

/* --- Right Sidebar (Maps) --- */
#sidebar-toggle-btn {
    position: absolute;
    top: 2rem;
    left: 2rem;
    background-color: #473116;
    color: var(--color-text-secondary);
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 900;
}


/* Container for the FAB and menu */
.layer-fab-container {
    position: fixed;
    /* این مقادیر را برای قرارگیری در مرکز صفحه تنظیم کنید */
    top: 16%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 900;
}

/* Hide the main toggle checkbox */
.layers-toggle-checkbox {
    display: none;
}

/* Style for the "Layers" button */
.layers-toggle-label {
    padding: 12px 20px;
    background-color: #5d3f1d;
    color: #ffffff;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: background-color 0.3s ease;
}

.layers-toggle-label:hover {
    background-color: #97672d;
}

/* Style for the dropdown menu */
.layers-dropdown-menu {
    position: absolute;
    top: 60px; /* این مقدار باید بزرگتر از ارتفاع دکمه باشد */
    left: 50%;
    transform: translateX(-50%) scale(0); /* تغییر مقادیر برای مرکز قرارگیری */
    transform-origin: top center; /* اینجا را اصلاح کنید */
    width: 160px;
    background: #2b1f13;
    border-radius: 12px;
    padding: 10px 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    pointer-events: none;
    opacity: 0;
}

/* Animate the menu when active */
.layers-toggle-checkbox:checked ~ .layers-dropdown-menu {
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
    opacity: 1;
}

/* بقیه استایل‌ها (dropdown-option, icon-checkbox و ...) بدون تغییر می‌مانند */

/* Style for each option in the menu */
.dropdown-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.dropdown-option:last-child {
    border-bottom: none;
}

/* Hide the actual checkboxes */
.dropdown-option input[type="checkbox"] {
    display: none;
}

/* Style for the icon as a checkbox */
.icon-checkbox {
    font-size: 16px;
    color: #ffffff4d; /* Faded color for inactive state */
    transition: color 0.3s ease;
}

/* Change icon color when checkbox is checked */
.dropdown-option input[type="checkbox"]:checked ~ .icon-checkbox {
    color: #ffffff; /* Full color for active state */
}

.option-label {
    color: #ffffff;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
}

#sidebar-right {
    position: absolute;
    top: 0px; /* ارتفاع هدر */
    bottom: 150px; /* ارتفاع تایم‌لاین */
    left: 0;
    width: 0;
    min-width: 0;
    background-color: #473116;
    box-shadow: -2px 0 5px rgba(0,0,0,0.5);
    transition: width 0.3s ease;
    z-index: 999;
    overflow: hidden; /* پنهان کردن محتوا در حالت بسته */
}

#sidebar-right.open {
    width: 400px;
    min-width: 400px;
    overflow-y: auto; /* فعال کردن اسکرول در حالت باز */
}

#sidebar-content {
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#sidebar-right.open #sidebar-content {
    opacity: 1;
}

#sidebar-header {
    display: flex;
    width: 370px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #383838;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    background-color: #837A6E80 ;
    z-index: 10;
}

#sidebar-header h2 {
    margin: 0;
    padding-right: 10px;
    font-size: 1.5rem;
    font-weight: 500;
}

#sidebar-header button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #383838;
    position: sticky;
    top: 60px; /* ارتفاع هدر سایدبار */
    background-color: #837A6E80;
    z-index: 10;
}

.sidebar-tabs button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 0;
    cursor: pointer;
    transition: color 0.2s ease;
}

.sidebar-tabs button.active {
    color: var(--color-accent-gold);
    border-bottom: 2px solid var(--color-accent-gold);
    padding-right: 10px;
}

.map-list {
    overflow-y: auto;
    height: 100%;
}

.map-item {
    display: flex;
    gap: 1rem;
    background-color: #383838;
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.map-item:hover {
    background-color: #444;
}

.map-item-image {
    width: 80px;
    height: 80px;
    background-color: #555;
    border-radius: 4px;
}

.map-item-details {
    flex-grow: 1;
}

.map-item-details h3 {
    margin: 0 0 0.2rem 0;
    font-size: 1rem;
    font-weight: 500;
}

.map-item-details p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

/* Region Polygon & Popups */
.leaflet-pane.leaflet-overlay-pane path {
    stroke: #9C27B0;
    stroke-width: 2;
    opacity: 0.8;
    fill: #9C27B0;
    fill-opacity: 0.2;
    transition: all 0.3s ease;
}

.leaflet-popup-content-wrapper {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border-radius: 8px;
    border: none;
    padding: 10px;
}

.leaflet-popup-content h2 {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin: 0 0 5px 0;
}

.leaflet-popup-content p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin: 0;
}

#community-button {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    font-size: 0.9rem;
    z-index: 100;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

#community-button:hover {
    background-color: #383838;
}

/* Adjust Leaflet default controls for the dark theme */
.leaflet-control-zoom, .leaflet-control-layers {
    display: none !important;
}

/* --- Timeline --- */
#timeline-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background-color: rgba(31, 31, 31, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
    padding: 0 5rem;
    transition: all 0.3s ease;
}

#timeline-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.1) 0%, rgba(31, 31, 31, 0) 70%);
    z-index: -1;
    transition: background 0.5s ease;
}

#timeline-slider-wrapper {
    position: relative;
    width: 80%;
    max-width: 1200px;
    height: 20px;
    margin-top: 2rem;
}

#timeline-slider {
    width: 100%;
    -webkit-appearance: none;
    background: #444;
    height: 5px;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

#timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--color-accent-gold);
    cursor: grab;
    margin-top: -8px;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#timeline-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.8);
}

#timeline-marks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
}

/* --- Timeline (Optimized) --- */
#timeline-years {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 80%;
    max-width: 1200px;
    position: relative;
    top: 20px;
    padding: 0 10px;
}

.timeline-label {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color 0.2s ease, font-weight 0.2s ease;
    white-space: nowrap;
    text-align: center;
    min-width: 80px;
}

.timeline-label:hover {
    color: var(--color-accent-gold);
    font-weight: 500;
}

.timeline-label.active {
    color: var(--color-accent-gold);
    font-weight: 700;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

.timeline-label:first-child {
    right: 0;
    margin-right: 0;
    transform: none;
    text-align: right;
}
.timeline-label:last-child {
    left: 0;
    margin-left: 0;
    transform: none;
    text-align: left;
}

.timeline-label:hover {
    color: var(--color-accent-gold);
    font-weight: 500;
}

.timeline-label.active {
    color: var(--color-accent-gold);
    font-weight: 700;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

#current-year-display {
    position: absolute;
    top: 10px;
    right: 50%;
    transform: translateX(50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent-gold);
    text-shadow: 1px 1px 5px rgba(0,0,0,0.8);
    white-space: nowrap;
}

#current-year-value {
    font-size: 2.5rem;
    font-weight: 900;
}

#current-year-era {
    font-size: 1.2rem;
    color: var(--color-text-secondary);
}

/* Preloader اصلی و تنظیمات کلی */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.7s ease-in-out, visibility 0s 0.7s;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* افکت ذرات */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #2a2a2a 1px, transparent 1px);
    background-size: 20px 20px;
    animation: move-particles 30s linear infinite;
}

@keyframes move-particles {
    from { background-position: 0 0; }
    to { background-position: 100px 100px; }
}

/* کانتینر محتوا (لوگو و متن) */
.preloader-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 2;
}

/* لوگوی سایت */
.preloader-site-logo {
    width: 150px;
    height: auto;
    border-radius: 30px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.6));
    animation: fadeIn 1s ease-in-out, pulse-shadow 2s ease-in-out infinite;
}

/* انیمیشن محو شدن لوگو */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* افکت درخشش نورانی */
.logo-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: #fff;
    filter: blur(20px);
    opacity: 0.2;
    animation: glow-pulse 2s ease-in-out infinite;
    z-index: 1;
}

/* انیمیشن تپش نور */
@keyframes glow-pulse {
    0% { transform: scale(1); opacity: 0.2; }
    50% { transform: scale(1.2); opacity: 0.5; }
    100% { transform: scale(1); opacity: 0.2; }
}

/* متن بارگذاری */
.preloader p {
    font-family: 'Vazirmatn', sans-serif;
    color: #a3a3a3;
    font-size: 1.1rem;
    margin-top: 20px;
    animation: pulse 1.5s infinite;
}

/* انیمیشن تپش متن */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.sidebar-info {
    position: absolute;
    top: 0px; /* ارتفاع هدر */
    bottom: 150px; /* ارتفاع تایم‌لاین */
    left: 0;
    transform: translateX(-100%);
    width: 350px;
    padding: 20px;
    transition: transform 0.3s ease;
    background-color: #473116;
    z-index: 999;
}

.sidebar-info.open {
    transform: translateX(0);
}

#period-timeline {
    font-size: 1rem;
    color: var(--color-accent-gold);
    margin-bottom: 15px;
}

#read-more-btn {
    display: none; /* به صورت پیش‌فرض مخفی است */
    margin-top: 20px;
}

/* Sidebar Header */
.sidebar-header {
    background: #837A6E80;
    color: #fff;
    padding: 30px;
    border-bottom: 3px solid #6c757d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

#info-close-btn {
    color: #fff;
    background: transparent;
    border: none;
    font-size: 32px;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1.05), color 0.4s ease;
}

#info-close-btn:hover {
    transform: rotate(180deg) scale(1.1);
    color: #fca311;
}

/* Main Content Area */
.info-details {
    padding: 30px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Site/Period Image */
#info-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    margin-bottom: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

/* Detail Cards */
.detail-item {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s ease-in-out;
}

.detail-item:hover {
    transform: translateY(-5px);
}

/* Detail Text */
.detail-label {
    color: #b0c4de;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.detail-value {
    color: #fff;
    font-weight: 500;
    font-size: 1rem;
}

p#info-description {
    line-height: 1.8;
    background: rgba(255, 255, 255, 0.03);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    white-space: pre-wrap;
    font-size: 1rem;
    text-align: justify;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

/* message */
/* Container for all message cards, centered on the screen */
.toast-container {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    z-index: 1050;
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
}

/* Base Toast Styles (unmodified from previous version) */
.toast {
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    background-color: rgba(30, 40, 50, 0.85) !important;
    color: #f0f0f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toast Body with Icon (unmodified) */
.toast-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-body:before {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 1.4rem;
}

/* Custom Colors and Icons for different message tags (unmodified) */
.toast.text-bg-success {
    background-color: rgba(40, 167, 69, 0.9) !important;
    border-color: #28a745;
}
.toast.text-bg-success .toast-body:before {
    content: '\f058';
    color: #fff;
}

.toast.text-bg-warning {
    background-color: rgba(255, 193, 7, 0.9) !important;
    border-color: #ffc107;
    color: #212529 !important;
}
.toast.text-bg-warning .toast-body:before {
    content: '\f071';
    color: #212529;
}

.toast.text-bg-danger {
    background-color: rgba(220, 53, 69, 0.9) !important;
    border-color: #dc3545;
}
.toast.text-bg-danger .toast-body:before {
    content: '\f057';
    color: #fff;
}

/* Close Button Styling (unmodified) */
.toast .btn-close {
    filter: brightness(0) invert(1);
    transition: transform 0.3s ease;
}

.toast .btn-close:hover {
    transform: rotate(90deg) scale(1.1);
}
.close-fixed-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-fixed-btn:hover {
    transform: scale(1.15) rotate(90deg);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    box-shadow:
        inset 0 0 40px rgba(255, 255, 255, 0.9),
        0 16px 30px rgba(0, 0, 0, 0.3);
}

.close-fixed-btn:active {
    transform: scale(0.98);
    box-shadow:
        inset 0 0 10px rgba(0, 0, 0, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.1);
}

/* فایل: style.css */

/* --- AI Chat Box - Modern & Professional Redesign --- */
#ai-chat-box {
    position: fixed;
    bottom: 180px;
    right: 20px;
    width: 380px;
    height: 520px;
    background-color: #35230f; /* پس‌زمینه تیره و یکپارچه */
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05); /* حاشیه بسیار ظریف و تیز */
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.6); /* سایه نرم‌تر برای عمق */
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateY(30px) scale(0.98);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* انیمیشن نرم و فنری */
}

#ai-chat-box.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent-gold);
}

#ai-chat-close-btn {
    background: none;
    border: none;
    color: #FF5A5A; /* رنگ قرمز برای حس خطر و تأکید */
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

#ai-chat-close-btn:hover {
    color: #FF2E2E;
    transform: rotate(90deg);
}

.chat-body {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar Styles - مینیمال و تیز */
.chat-body::-webkit-scrollbar {
    width: 5px;
}
.chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.chat-body::-webkit-scrollbar-thumb {
    background: var(--color-accent-gold);
    border-radius: 2.5px;
}
.chat-body::-webkit-scrollbar-thumb:hover {
    background: #e6b800;
}

.chat-footer {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-input {
    flex-grow: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #2e1616;
    color: var(--color-text-primary);
    padding: 12px 18px;
    border-radius: 8px; /* گوشه‌های تیز برای حس مدرن */
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#chat-input:focus {
    border-color: var(--color-accent-gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}
#chat-input::placeholder {
    color: var(--color-text-secondary);
}

.chat-btn {
    background-color: transparent;
    border: none;
    color: var(--color-text-secondary);
    width: 45px;
    height: 45px;
    border-radius: 8px; /* گوشه‌های تیز برای دکمه‌ها */
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-accent-gold);
}

#send-btn {
    background-color: var(--color-accent-gold);
    color: #1F1F1F;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}
#send-btn:hover {
    background-color: #e6b800;
    transform: translateY(-2px); /* حرکت به بالا در حالت هاور */
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.6);
}

.chat-messages {
    flex-grow: 1;
}

.message {
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 10px;
    max-width: 85%;
    line-height: 1.6;
    font-size: 0.95rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.message.sent {
    background-color: #333333;
    color: var(--color-text-primary);
    align-self: flex-end;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.message.received {
    background-color: #D4AF37;
    color: #1F1F1F;
    align-self: flex-start;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

/* Styling for new chat header buttons */
.chat-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-action-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.header-action-btn:hover {
    color: var(--color-text-primary);
    transform: scale(1.1);
}

.close-btn {
    /* اطمینان از اینکه دکمه بسته شدن استایل‌های خاص خود را حفظ می‌کند */
    font-size: 1.5rem;
    color: var(--color-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #FF5A5A;
    transform: rotate(90deg) scale(1.1);
}
@media (max-width: 768px) {
    /* تنظیمات عمومی برای بدنه و کانتینر اصلی */
    body, #app-container {
        overflow-x: hidden; /* جلوگیری از اسکرول افقی اضافی */
    }

    /* --- هدر (Header) بهینه شده برای موبایل --- */
    .header {
        height: 60px; /* ارتفاع کمتر برای هدر */
        padding: 0 1rem;
    }

    #header-logo {
        font-size: 1.2rem;
        padding-top: 0;
    }

    #header-nav {
        display: none; /* پنهان کردن منوی اصلی برای جلوگیری از شلوغی */
    }
    
    #search-box {
        display: none; /* پنهان کردن باکس جستجو در هدر موبایل */
    }
    
    #header-right {
        gap: 0.5rem;
    }

    .language-switcher {
        /* تنظیم موقعیت دکمه زبان */
        padding-right: 0;
    }
    
    /* نمایش دکمه‌های مهم در هدر */
    #header-right #share-button,
    #header-right .language-switcher {
        display: flex; /* مطمئن شوید که این دکمه‌ها نمایش داده می‌شوند */
    }

    /* --- تغییرات در سایدبارها و پنجره‌های شناور --- */
    
    /* سایدبار اطلاعات (اطلاعات دوره) به صورت تمام صفحه */
    .sidebar-info {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 1px;
        z-index: 1000;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }
    
    .sidebar-header {
        padding: 15px;
        position: sticky;
        top: 0;
    }

    .info-details {
        padding: 15px;
    }
    
    /* سایدبار نقشه‌ها (سمت راست) به صورت تمام صفحه */
    #sidebar-right.open {
        top: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        min-width: 100%;
        transition: transform 0.3s ease;
        transform: translateX(0);
        overflow-y: auto;
    }

    /* --- مرکز کردن صحیح پنجره‌های شناور --- */
    #share-modal #share-popup {
        width: 90%;
    }
    
    /* --- چت‌باکس AI بهینه شده --- */
    #ai-chat-box {
        bottom: 150px; /* بالای تایم‌لاین */
        right: 1%;
        transform: translateX(50%);
        width: 98%;
        height: 70%;
        max-width: none;
    }

    .ai-orb-container {
        bottom: 110px; /* موقعیت بالاتر از تایم‌لاین */
        right: 15px; /* فاصله از لبه سمت راست */
        width: 45px;
        height: 45px;
        box-shadow: 0 4px 10px rgba(64, 26, 26, 0.3); /* سایه کوچک‌تر */
    }

    .ai-orb {
        width: 22px;
        height: 22px;
    }

    .ai-orb-container:hover {
        transform: scale(1.05); /* افکت هاور کوچک‌تر */
    }

    /* --- تایم‌لاین (Timeline) --- */
    #timeline-container {
        height: 100px;
        padding: 0 0.5rem;
    }
    
    #timeline-slider-wrapper {
        width: 95%;
    }
    
    #timeline-years {
        width: 95%;
        top: 10px;
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
        gap: 2rem;
    }

    .timeline-label {
        min-width: auto;
    }
    
    #current-year-display {
        font-size: 1.2rem;
        top: 5px;
    }
}

/* --- استایل‌های جدید برای منوی موبایل --- */
.mobile-menu-toggle {
    display: none; /* به صورت پیش‌فرض در دسکتاپ پنهان است */
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute; /* موقعیت‌یابی در هدر */
    top: 31px;
    transform: translateY(-50%);
    left: 126px; /* فاصله از لبه چپ */
    z-index: 100;
}

/* استایل‌دهی منوی موبایل (به صورت پیش‌فرض پنهان است) */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 87%;
    height: 100%;
    background-color: var(--color-bg-primary);
    transform: translateX(100%); /* منو را به خارج از صفحه منتقل می‌کند */
    transition: transform 0.4s ease-in-out;
    z-index: 2000;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.mobile-menu.open {
    transform: translateX(0); /* منو را به داخل صفحه می‌آورد */
}

.mobile-menu a {
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: 1.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-bg-secondary);
}

.mobile-menu .menu-header {
    display: flex;
    justify-content: flex-end;
}

.menu-close-btn {
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.8rem;
    cursor: pointer;
}

/* --- Media Query برای حالت موبایل --- */
@media (max-width: 768px) {
    /* نمایش دکمه منوی موبایل */
    .mobile-menu-toggle {
        display: block;
    }

    /* پنهان کردن لینک‌های ناوبری دسکتاپ و تغییر زبان */
    #header-nav,
    .language-switcher {
        display: none;
    }
}