  /* @import url(../../Apps/Sandcastle/templates/bucket.css); */

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --dark-bg: #1a1a1a;
  --dark-surface: #2d2d2d;
  --dark-border: #3d3d3d;
  --text-primary: #f5f5f5;
  --text-secondary: #b3b3b3;
  --danger-color: #ef4444;
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --rounded-md: 8px;
  --rounded-lg: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", sans-serif;
  color: var(--text-primary);
  background-color: var(--dark-bg);
  overflow: hidden;
  height: 100%;
}

.fullSize {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  flex-direction: column;
}

#loadingOverlay h1 {
  color: var(--text-primary);
  font-size: 2.5rem;
  font-weight: 500;
  margin-top: 7em;
  margin-left: 17em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
#toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30%;
  max-width: 300px;
  padding: 16px;
  border-radius: var(--rounded-lg);
  background: rgba(45, 45, 45, 0.6);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.09) inset;
  color: var(--text-primary);
  z-index: 100;
  transition: all 0.3s ease;
  animation: fadeIn 0.5s ease-out;
}

#toolbar:hover {
  background: rgba(45, 45, 45, 0.75);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.07) inset;
}
.toolbarContent {
  height: 75vh;
  max-height: 600px;
  overflow-y: auto;
}
.toolbarContent::-webkit-scrollbar {
  width: 8px; /* Дебелина на скролбара */
}

.toolbarContent::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1); /* Цвят на "коловоза" */
  border-radius: 4px;
}

.toolbarContent::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3); /* Цвят на скролбара */
  border-radius: 4px;
}

.toolbarContent::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5); /* При hover става по-ярък */
}

.clock {
  margin: 8px 0 0px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex ;
  gap: 5px;
  align-items: center;
}
#toolbar h3 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.7),
    0 0 5px var(--primary-color),
    0 0 5px var(--primary-color);
}

#toolbar h3::before {
  content: "";
  width: 6px;
  height: 20px;
  background-color: var(--primary-color);
  margin-right: 10px;
  border-radius: 3px;
}

/* Section titles */
.section-title {
  margin: 16px 0 8px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Toggle switches       */
.toggle-label {
  cursor: pointer;
  user-select: none;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.toggle-switch {
  position: relative;
  width: 40px;
  height: 20px;
  display: inline-block;
  margin-right: 10px;
}
.toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #4b5563;
  transition: 0.4s;
  border-radius: 34px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-color);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}
input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
/* Text next to slider (for checkbox acting like radio) */
.toggle-text {
  margin-left: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* Sensor operator container for date/time inputs */
#sensorDate,
#sensorTime {
  background-color: var(--background-secondary);
  outline: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
 border: none;           /* премахва всички граници */
  box-shadow: none;   
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex ;
  align-items: center;
}

#sensorDate:focus,
#sensorTime:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}
.sensor-actions-container {
  /* бутонът се подрежда вдясно */
  margin-top: 12px;
  margin-right: 12px;
}
/* Sensor actions button */
#showChartBtn {
  width: 100%;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  background-color: var(--primary-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition:
    background-color 0.3s,
    transform 0.2s;
}

#showChartBtn:hover {
  background-color: #2563eb; /* малко по-тъмен син */
  transform: translateY(-1px);
}

#showChartBtn:active {
  transform: translateY(0);
}

.chart-toggle {
  margin-left: 8px;
  cursor: pointer;
  font-size: 14px;
}
.chart-container {
  width: 300px;
  height: 200px;
}

.chart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 8000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chart-modal-content {
  position: relative;
  background: white;
  padding: 20px;
  width: 80%;
  height: 80%;
  border-radius: 10px;
  box-shadow: 0 0 30px black;
}

.chart-modal-content canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-modal {
  position: fixed;
  background: rgba(0, 0, 0, 0.6);
  z-index: 8000;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* fullscreen режим */
.chart-modal.fullscreen {
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

/* минимизиран прозорец (долен десен ъгъл) */
.chart-modal.minimized {
  bottom: 20px;
  right: 20px;
  top: auto;
  left: auto;
  width: 800px;
  height: 400px;
  background: none; /* махаме тъмния overlay */
  align-items: flex-end;
  justify-content: flex-end;
}

.chart-modal-content {
  position: relative;
  background: white;
  padding: 20px;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  box-shadow: 0 0 30px black;
  overflow: hidden;
}

/* бутон за resize */
.resize-btn {
  position: absolute;
  top: 10px;
  right: 40px;
  background: #eee;
  border: none;
  cursor: pointer;
  padding: 5px 8px;
  font-size: 16px;
  border-radius: 5px;
}


.close-chart-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.chart-toggle {
  background-color: transparent;
  color: var(--text-primary);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  margin-top: 4px;
  text-shadow:
    1px 1px 2px rgba(0, 0, 0, 0.6),
    -1px -1px 1px rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.chart-toggle:hover {
  color: var(--primary-color);
  text-shadow:
    0 0 5px var(--primary-color),
    0 0 10px var(--primary-color);
  transform: scale(1.05);
}

.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 20px;
}

.toggle-label {
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* Релефен текст в toolbar */
#toolbar h3,
#toolbar .section-title,
#toolbar .toggle-label,
#toolbar .toggle-text {
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow:
    1px 1px 2px rgba(0, 0, 0, 0.75),
    -1px -1px 1px rgba(255, 255, 255, 0.08);
}

#toolbar h3 {
  font-size: 1.5rem;
  color: var(--text-primary);
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.8),
    0 0 10px var(--primary-color),
    0 0 10px var(--primary-color);
}

.section-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-top: 20px;
}

.toggle-label {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.toggle-text {
  color: var(--text-primary);
}

/* Legends   */

.legends-container {
  display: flex;
  flex-direction: row;
  position: absolute;
  bottom: 2rem;
  right: 1rem;
  height: 30;
}
.legend {
  background-color: rgba(30, 30, 30, 0.6);
  backdrop-filter: blur(6px);
  border: 1px solid var(--dark-border);
  border-radius: var(--rounded-lg);
  box-shadow: var(--shadow-md);
  padding: 1rem;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  z-index: 100;
  display: none;
  flex-direction: column;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.09) inset;
  height: auto;
}

#legend-airQuality {
  display: block;
}

.legend-title {
  display: flex;
  margin-bottom: 0.5rem;
  white-space: normal;
  word-break: break-word;
  font-weight: 600;
}
.legend-extra{
  display: flex;
  flex-direction: column;
    max-height: 170px;
  flex-wrap: wrap;
}
.legend-items {
  display: flex;
  align-items: center;
  margin: 0.15rem;
  margin-right: 1.25rem;
}
.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  margin-right: 0.5rem;
  flex-shrink: 0;
  border: 1px solid var(--dark-border);
}

/* Feature Info Box   */
.feature-info {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(45, 45, 45, 0.6);
  backdrop-filter: blur(10px);
  border-radius: var(--rounded-lg);
  padding: 16px;
  width: 300px;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.09) inset;
  border: 1px solid var(--dark-border);
  z-index: 100;
  display: none;
}

.feature-info-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  text-shadow:
    1px 1px 2px rgba(0, 0, 0, 0.75),
    -1px -1px 1px rgba(255, 255, 255, 0.08);
}

.feature-info-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 16px;
  background-color: var(--primary-color);
  margin-right: 10px;
  border-radius: 3px;
}

.feature-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.feature-info-table th {
  text-align: left;
  padding: 6px 0;
  color: var(--text-secondary);
  font-weight: 500;
  width: 40%;
}

.feature-info-table td {
  padding: 6px 0;
  color: var(--text-primary);
  font-weight: 400;
}

.feature-info-table tr:not(:last-child) {
  border-bottom: 1px solid var(--dark-border);
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text-primary);
}

.toggle-slider {
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.1),
    inset 0 -1px 2px rgba(0, 0, 0, 0.3),
    0 2px 5px rgba(0, 0, 0, 0.5);
}

.toggle-slider:before {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.6),
    inset 0 -1px 1px rgba(255, 255, 255, 0.2);
}

.sensor-scale-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: 0.95rem;
  color: var(--text-primary);
}

#sensorScale {
  accent-color: var(--primary-color);
  width: 100px;
}.sensor-params-container,
.sensor-operator-container {
  display: flex;
  align-items: center;
  margin-top: 0.625rem;
  margin-right: 0.75rem; 
  justify-content: space-between;
  gap: 0.5rem; 
}

.sensor-params-container select,
.sensor-operator-container select {
  background-color: rgba(30, 30, 30, 0.9);
  color: var(--text-primary);
  border: 0.0625rem solid var(--dark-border); /* 1px -> rem */
  border-radius: 0.25rem; /* 4px -> rem */
  padding: 0.3125rem 0.625rem; /* 5px 10px -> rem */
  font-size: 0.8125rem; /* 13px */
  min-width: 5rem; /* 80px -> rem */
  max-width: 9.375rem; /* 150px -> rem */
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

/* focus & hover ефект */
.sensor-params-container select:hover,
.sensor-params-container select:focus,
.sensor-operator-container select:hover,
.sensor-operator-container select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.125rem rgba(255, 255, 255, 0.05); /* 2px -> rem */
}

.chart-modal-content {
  display: flex;
  flex-direction: column;
  width: 90%;
  height: 90%;
  padding: 20px;
  background: white;
  position: relative;
}

.info-toolbar {
  display: none;
  margin: 10px 5px 0px 0px;
  padding: 10px;
  font-size: 1em;
  font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  position: relative;
  transition: all 0.3s ease;
}

.info-toolbar:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}

.info-toolbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #4f46e5, #858282);
  border-radius: 4px 0 0 4px;
}

.info-toolbar span {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 1.05em;
}

.info-toolbar a {
  color: #c3bff4;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  position: relative;
}

.info-toolbar a:hover {
  background-color: rgba(79, 70, 229, 0.08);
  text-decoration: none;
  padding-right: 24px;
}

.info-toolbar a::after {
  content: '→';
  position: absolute;
  right: 8px;
  opacity: 0;
  transition: all 0.2s ease;
}

.info-toolbar a:hover::after {
  opacity: 1;
  right: 6px;
}
.info-toolbar:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
#compareOperatorSelect,
#addChartBtn {
  background-color: #f4f4f4;  
  color: #333;                 
  border: 1px solid #ccc;     
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
#addChartBtn:hover{
  background-color: #e2f0e2;  
  border-color: #8bbf8b;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
