﻿body {
    direction: rtl; 
    background-color: #f0f0f0;
    margin: 0;
    font-family: iran-sanss;
}

.map-container {
    max-width: 1200px;
    margin: 40px auto;  
}
/* =====================
   باکس‌های مشترک
===================== */
.map-wrapper {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
   /* font-family: IRANSans, Vazirmatn, Tahoma, sans-serif;*/
   font-family: iran-sanss ;
}

/* =====================
   نقشه (ارتفاع مرجع)
===================== */
.map-wrapper.map {
    flex: 0 0 80%;
    height: 600px;                   /* ارتفاع نقشه */
}

/* =====================
   اطلاعات استان (بلندتر شد)
===================== */
.map-wrapper.info-box {
    flex: 0 0 45%;
    height: 600px;                   /* ⬅️ طول بیشتر (تقریباً هم‌قد نقشه) */
}

/* =====================
   SVG نقشه
===================== */
#iran-svg {
    width: 100%;
    height: 100%;
}

/* =====================
   محتوای اطلاعات استان
===================== */
#province-info {
    flex: 1;
    margin-top: 20px;
    font-size: 15px;
    line-height: 2;
    overflow-y: auto;                /* اسکرول داخلی برای دیتای زیاد */

    max-height: 420px;
    height: 420px;
    width: 100%;
    flex-shrink: 0; 

    overflow-y: auto;
    overflow-x: auto;
   
    /*border: 1px solid #e0e0e0;*/
    border-radius: 10px;
    background: #fff;
    /*box-shadow: 0 4px 12px rgba(0,0,0,0.08);*/
    font-family: iran-sanss ;
}

#province-info table {
    width: max-content; 
    min-width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
#province-info thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, #f9fafb, #eceff1);
    color: #333;
    font-weight: 600;
    padding: 10px;
    border-bottom: 2px solid #d0d7de;
    z-index: 2;
    text-align: right;

     white-space: nowrap;
         padding: 8px 10px;
    text-align: right;
}
#province-info td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
    white-space: nowrap;
         white-space: nowrap;
         padding: 8px 10px;
    text-align: right;
}

/* سطرها */
#province-info tbody tr {
    transition: background 0.15s ease;
}

#province-info tbody tr:hover {
    background: #f5faff;
}

/* سطرهای زوج */
#province-info tbody tr:nth-child(even) {
    background: #ddedfc;
}

/* اسکرول بار (Webkit) */
#province-info::-webkit-scrollbar {
    width: 8px;
}

#province-info::-webkit-scrollbar-thumb {
    background: #cfd8dc;
    border-radius: 4px;
}

#province-info::-webkit-scrollbar-thumb:hover {
    background: #b0bec5;
}

/* =====================
   استایل مسیرهای نقشه
===================== */
svg {
    pointer-events: none;
}

path {
    pointer-events: visiblePainted;
    fill: #d6d9de;
    stroke: #ffffff;
    stroke-width: 0.5;
    cursor: pointer;
    transition: fill 0.2s ease, stroke-width 0.2s ease;
}
/*
path:hover {
    fill: #c3e0fa;
    stroke-width: 1.2;
}*/

.province-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

.province-table th,
.province-table td {
    border: 1px solid #c3e0fa;
    padding: 8px;
    text-align: center;
}

.province-table th {
    background: #4694eb;
    font-weight: bold;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .province-table {
        font-size: 12px;
    }
}


.map-pins {
    position: absolute;
    inset: 0;
    pointer-events: none; /* پین‌ها کلیک‌پذیر نیستند */
}

.map-pin {
    position: absolute;
    width: 26px;          /* سایز ثابت */
    height: auto;
    transform: translate(-50%, -100%);
    animation: floatPin 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes floatPin {
    0%   { transform: translate(-50%, -100%) translateY(0); }
    50%  { transform: translate(-50%, -100%) translateY(-6px); }
    100% { transform: translate(-50%, -100%) translateY(0); }
}


.svg-pin {
    pointer-events: none; /* کلیک‌ناپذیر */
    animation: pinFloat 2s ease-in-out infinite;
}

@keyframes pinFloat {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

path.persian-gulf {
    fill: #1e88e5; /* آبی */
}
path.caspian {
    fill: #1e88e5; /* آبی */
}
path.jazmourian {
    fill: #1e88e5; /* آبی */
}
path.urmia {
    fill: #1e88e5; /* آبی */
}
path.qom-daryache {
    fill: #1e88e5; /* آبی */
}

ul, #myUL {
  list-style-type: none;
}

#myUL {
  margin: 0;
  padding: 0;
}

.caret {
  cursor: pointer;
  -webkit-user-select: none; /* Safari 3.1+ */
  -moz-user-select: none; /* Firefox 2+ */
  -ms-user-select: none; /* IE 10+ */
  user-select: none;
}

.caret::before {
  content: "\25B6";
  color: black;
  display: inline-block;
  margin-right: 6px;
}

.caret-down::before {
  -ms-transform: rotate(90deg); /* IE 9 */
  -webkit-transform: rotate(90deg); /* Safari */
  transform: rotate(90deg);  
}

.nested {
  display: none;
}

.active {
  display: block;
}

/* استان انتخاب‌شده */
path.active-province {
    fill: #305086 !important;   /* نارنجی مشخص */
    stroke: #1f335d;
    stroke-width: 1.5;
}


#province-info th {
    cursor: pointer;
}

#province-info th.sort-asc::after {
    content: " ▲";
    font-size: 11px;
    margin-right: 4px;
}

#province-info th.sort-desc::after {
    content: " ▼";
    font-size: 11px;
    margin-right: 4px;
}

#province-info th:hover::after {
    opacity: 1;
}


.map-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.map-btn img {
    width: 22px;
    height: 22px;
}


.map-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9999;
}

.map-modal-content {
    width: 85%;
    max-width: 900px;
    margin: 4% auto;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.map-modal-header {
    text-align: right;
    padding: 8px 12px;
}

.map-modal-close {
    font-size: 22px;
    cursor: pointer;
}

#leafletMap {
    height: 360px;
}

.map-modal-footer {
    padding: 12px;
    font-size: 14px;
    line-height: 1.9;
    direction: rtl;
    text-align: right;
}


.map-actions {
    display: flex;
    gap: 10px;
    padding: 12px;
    justify-content: flex-start;
    direction: rtl;
}

.map-actions button {
    background: #f1f1f1;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;

    display: flex;
    align-items: center;
    gap: 6px;
}

.map-actions img {
    width: 16px;
    height: 16px;
}

.map-actions button:hover {
    background: #e5e5e5;
}


/* کانتینر اصلی */
  .legend-container {
    display: flex;
    justify-content: flex-start; /* محتوا از چپ شروع شود */
    align-items: center;
    gap: 20px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 8px;
    /*border: 1px solid #ddd;*/
    width: fit-content;
    direction: ltr; /* اجبار به جهت چپ به راست */
    margin-right: auto; /* هل دادن کانتینر به سمت چپ */
  }

  /* استایل آیتم‌های راهنما */
  .legend-item {
    display: flex;
    align-items: center;
    gap: 8px; /* فاصله بین مربع رنگ و متن */
    font-size: 14px;
    color: #333;
  }

  /* مربع رنگی */
  .color-box {
    width: 10px;
    height: 10px;
    border-radius: 50%; /* کمی گوشه گرد برای زیبایی */
  }


    /* استایل Tooltip */
  #tooltip {
    position: absolute;
    display: none;
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
  }