html,
body {
margin: 0;
padding: 0;
height: 100vh;
width: 100vw;
overflow: hidden;
font-family: 'Vazirmatn', sans-serif;
}

#header {
width: 100%;
text-align: center;
background-color: #000033;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
z-index: 9999;
flex-shrink: 0;
height: 60px;
}

#header img {
max-height: 60px;
width: auto;
}

#app {
display: flex;
height: calc(100vh);
width: 100%;
}

#map {
flex: 1;
height: 100%;
width: 100%;
}


.menu-item {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    color: #efefef;
    transition: background-color 0.3s ease;
    margin-right: 15px;
    margin-top: 5px;
    margin-bottom: 5px;
    }

.menu-item:hover {
background-color: #7b7b7b;
}

.menu-item.active {
background-color: #4285f4;
color: white;
}

.submenu {
    list-style: none;
    padding: 5px 0 5px 20px;
    margin: 0 0 15px 0;
    display: none;
    /* border-left: 3px solid #bebebe; */
    color: #dbdada;
    margin-right: 15px;
}

.submenu.show {
display: block;
}

.submenu li {
margin-bottom: 8px;
}

.submenu label {
cursor: pointer;
user-select: none;
font-weight: 500;
}

.logo-container {
position: absolute;
top: 140px;
right: 260px;
z-index: 1050;
}

.logo-container img {
width: 45px;
height: 45px;
object-fit: cover;
border-radius: 8px;
cursor: pointer;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
transition: transform 0.2s ease;
}

.logo-container img:hover {
transform: scale(1.1);
}

.info-popup {
position: absolute;
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(5px);
border-radius: 8px;
padding: 15px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
z-index: 1000;
font-family: 'Vazirmatn', sans-serif;
font-size: 12px;
max-width: 300px;
max-height: 400px;
overflow-y: auto;
display: none;
}

.info-popup table {
width: 100%;
border-collapse: collapse;
}

.info-popup th,
.info-popup td {
padding: 8px;
text-align: right;
border-bottom: 1px solid #ddd;
}

.info-popup th {
background-color: #f2f2f2;
font-weight: bold;
}

.legends-panel {
position: absolute;
bottom: -5px;
left: 55px;
max-height: calc(100vh - 120px);
overflow-y: auto;
z-index: 1000;
font-family: 'Vazirmatn', sans-serif;
}

.legend-container {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(5px);
border-radius: 8px;
padding: 15px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
margin-bottom: 15px;
font-size: 11px;
max-width: 400px;
}

.legend-title {
font-weight: bold;
margin-bottom: 12px;
text-align: center;
color: #000033;
}

.legend-colors {
display: flex;
justify-content: space-between;
gap: 8px;
margin: 10px 0;
}

.legend-color-block {
flex: 1;
height: 20px;
border-radius: 4px;
border: 1px solid #ddd;
position: relative;
min-width: 30px;
}

.legend-color-label {
position: absolute;
bottom: -25px;
width: 100%;
text-align: center;
font-size: 10px;
color: #333;
white-space: nowrap;
}

.legend-current {
display: flex;
align-items: center;
gap: 12px;
margin-top: 35px;
font-size: 11px;
color: #333;
}

.legend-current-color {
width: 20px;
height: 20px;
border-radius: 4px;
border: 1px solid #ddd;
}

.legend-current-value {
font-weight: bold;
}

@media (max-width: 768px) {
#app {
    flex-direction: column;
    height: calc(100vh - 60px);
    width: 100%;
}

.sidebar-right {
    width: 100%;
    height: auto;
    max-height: 220px;
    overflow-y: auto;
    padding: 12px 16px;
    background-color: #212529;
    border-top: 1px solid #444;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

#map {
    flex: 1;
    width: 100%;
    height: calc(100% - 220px);
}

.menu-item {
    padding: 8px 12px;
    font-size: 14px;
}

.submenu {
    padding-right: 15px;
}

.logo-container {
    top: 70px;
    right: 12px;
    transform: scale(0.9);
}

.legends-panel {
    right: 12px;
    bottom: 230px;
    max-width: 150px;
}

.legend-container {
    max-width: 150px;
}

.legend-color-label {
    font-size: 9px;
}

.legend-current {
    font-size: 10px;
}
}

@media (max-width: 480px) {
.menu-item span,
.submenu label {
    font-size: 13px;
}

.sidebar-right {
    font-size: 13px;
    padding: 10px 14px;
}

.logo-container {
    top: 250px;
    right: 8px;
    transform: scale(0.85);
}

.legends-panel {
    right: 8px;
    bottom: 260px;
    max-width: 120px;
}

.legend-container {
    max-width: 120px;
    font-size: 10px;
}

.legend-color-label {
    font-size: 8px;
}

.legend-current {
    font-size: 9px;
}

.legend-current-color {
    width: 16px;
    height: 16px;
}

#header img {
    max-height: 50px;
}
}

#app {
    position: relative;
    height: 100vh;
}

.sidebar-right {
    width: 230px;
    background-color: #212529;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 20px 10px;
    overflow-y: auto;
    font-size: 14px;
    flex-shrink: 0;
    top: 0;
    right: 0;
    display: none; /* به طور پیش‌فرض مخفی است */
}


#toggleButton {
    background-color: white;
    color: #979797;
    border: 2px solid rgba(0, 0, 0, 0.3);
    padding: 10px;
    cursor: pointer;
    border-radius: 5px; 
    font-size: 18px;
    width: 48px;
    height: 48px;
    justify-content: center;
    align-items: center;
    display: flex;
}
#toggleButton i {
    font-size: 18px;
}
#toggleButton:hover {
    background-color: #f1f1f1;
}

.sidebar-toggle-floating {
    position: fixed;
    bottom: 39%;
    right: 250px; /* وقتی سایدبار بازه */
    background: #343a40;
    color: #fff;
    width: 20px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px 0 0 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: right 0.3s ease;
    z-index: 2000;
}


.icon-dropdown {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 410;
}

.icon-toggle {
  position: relative;
  display: inline-block;
  text-align: center;
}

.icon-toggle img {
  height: 50px;
  width: 50px;
  border-radius: 10%;
  background-color: #eaeaea;
  border: 2px solid rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

/* متن دکمه اصلی */
.toggle-text {
  position: absolute;
  top: 100%;               /* دقیقا زیر عکس */
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  font-size: 13px;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  color: #000;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  text-align: center;

  visibility: hidden;      /* به جای display */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.icon-toggle:hover .toggle-text {
  visibility: visible;
  opacity: 1;
}

/* لیست آیکون‌ها */
.icon-bar {
  display: none;              
  position: absolute;
  left: 60px;                
  bottom: 0;
  flex-direction: row;
  margin-bottom: 5px;
  gap: 12px;
}

.icon-bar.show {
  display: flex;             
}

.icon-item {
  position: relative;   /* برای اینکه متن زیرش ثابت بشه */
  text-align: center;
}

.icon-item i {
  height: 40px;
  width: 40px;
  border-radius: 10%;
  background-color: #eaeaea;
  border: 2px solid rgba(0, 0, 0, 0.29);
  cursor: pointer;
  transition: transform 0.3s ease;
  align-content: center;
  font-size: x-large;
}

.icon-item:hover i {
  transform: scale(1.1);
}

.icon-text {
  position: absolute;
  top: 100%; 
  left: 50%;
  transform: translateX(-50%);
  margin-top: 5px;     
  font-size: 12px;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  color: #000;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  text-align: center;
  visibility: hidden; 
  opacity: 0;
  transition: opacity 0.3s ease;
}
.icon-item:hover .icon-text {
  visibility: visible;
  opacity: 1;
}

.icon-item i.loading {
  border: 2px solid #007bff !important; 
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.6);
  pointer-events: none; 
  opacity: 0.7;   
}

.icon-item i.active {
  border: 2px solid green !important; 
  box-shadow: 0 0 8px rgba(0, 128, 0, 0.6);
  pointer-events: auto; 
  opacity: 1;
}


#statusBox {
  position: fixed;
  top: 10px;  
  left: 50%;              
  transform: translateX(-50%); 
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.status-message {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: #fff;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.status-message.show {
  opacity: 1;
  transform: translateY(0);
}

.status-message.success { background: #28a745; }  /* سبز */
.status-message.error { background: #dc3545; }    /* قرمز */
.status-message.info { background: #007bff; }     /* آبی */

.list-group-item input[type=range] {
  width: 150px;
  height: 6px;
  border-radius: 4px;
  background: #e9ecef;
  outline: none;
  margin: 0 7px;   /* فاصله متعادل چپ و راست */
  cursor: pointer;
  direction: ltr;   /* تضمین اینکه 0 چپ باشه و 1 راست */
  padding-top: 10px;
  padding-bottom: 10px;
}


/* 🎨 دکمه حذف */
.list-group-item .remove-icon {
  margin-right: 8px;
  transition: color 0.2s ease;
}
.list-group-item .remove-icon:hover {
  color: #b02a37 !important;
}

.list-group-item .toggle-visibility {
    transition: color 0.2s ease;
}
.list-group-item .toggle-visibility.text-muted {
    color: #6c757d !important;
}
.list-group-item .toggle-visibility:hover {
    color: #0d6efd;
}


.position-queue-toggle {
    position: absolute;
    top: 5px;
    border-radius: 10%;
    background-color: #f5f5f5;
    color: rgb(245, 209, 3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 16px;
    border: none;
    transition: all 0.3s ease; /* انیمیشن نرم */
}

/* وقتی مینیمایز نیست */
.position-queue-toggle.left {
    left: 5px;
    right: auto;
    width: 30px;
    height: 30px;
    border: none;
    font-size: larger;
}

/* وقتی مینیمایز شده */
.position-queue-toggle.right {
    left: auto;
    right: 5px;
    width: 40px;
    height: 40px;
    font-size: x-large;
    border: 2px solid rgba(0, 0, 0, 0.17) !important;
}


.queue-badge {
    position: absolute;
    bottom: 0px;
    right: -5px;
    background-color: red;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 11;
    padding: 0;
    padding-top: 0px;
    text-align: center;
    line-height: normal;  /* let flex do the centering */
    transform: translateY(2px); /* رفع مشکل اندکی پایین بودن متن */
}

.legend-help-btn {
    background: none;
    border: none;
    color: #0d6efd;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
}

.legend-help-btn:hover {
    color: #084298;
}

.legend-popup {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.legend-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.legend-modal {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    width: 550px;
    max-width: 90%;
    animation: slideUp 0.25s ease;
    overflow: hidden;
}

.legend-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0d6efd;
    color: white;
    padding: 10px 15px;
    font-weight: bold;
    border-radius: 10px 10px 0 0;
}

.legend-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.legend-modal-close:hover {
    transform: scale(1.1);
}

.legend-modal-body {
    padding: 15px;
    max-height: 250px;
    overflow-y: auto;
    font-size: 14px;
    color: #333;
    line-height: 1.7;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}


/* باکس کلی legend */
.legend-container {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* عنوان */
.legend-title {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 10px;
  color: #333;
}

/* بخش رنگ‌ها */
.legend-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 8px;
  justify-content: start;
}

/* هر رنگ و متن زیرش */
.legend-color-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 55px;
  padding: 3px;
  border-radius: 6px;
  background-color: #f8f8f8;
  transition: transform 0.2s ease;
}


/* توضیح رنگ */
.legend-color-label {
  font-size: 11px;
  text-align: center;
  color: #333;
  margin-top: 4px;
  white-space: nowrap;
  direction: rtl;
}

/* قسمت مقدار فعلی */
.legend-current {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #555;
  margin-top: 35px;
}

.legend-current-color {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1px solid #ccc;
  border-radius: 3px;
}
