/**
 * Device Mode Styles
 */

/* Device list modal */
.device-list-modal {
  max-width: 800px;
  width: 100%;
}

.device-list-container {
  max-height: 600px;
  overflow-y: auto;
}

.device-list-filters {
  padding: 15px;
  background-color: #f5f5f5;
  border-bottom: 1px solid #ddd;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.device-list-filters input,
.device-list-filters select {
  flex: 1;
  min-width: 200px;
}

/* Device list table */
.device-table {
  width: 100%;
  border-collapse: collapse;
}

.device-table th {
  background-color: #f8f9fa;
  padding: 10px;
  text-align: left;
  font-weight: bold;
  border-bottom: 2px solid #dee2e6;
}

.device-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #dee2e6;
}

.device-table tr:hover {
  background-color: #f5f5f5;
  cursor: pointer;
}

/* Device detail modal */
.device-detail-modal {
  max-width: 600px;
  width: 100%;
}

.device-photo {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 15px;
}

.device-info-section {
  margin-bottom: 20px;
}

.device-info-section h4 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #333;
  font-size: 1.1em;
  border-bottom: 1px solid #ddd;
  padding-bottom: 5px;
}

/* Sensor list */
.sensor-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sensor-item {
  padding: 10px;
  margin-bottom: 8px;
  background-color: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid #007bff;
}

.sensor-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.sensor-name {
  font-weight: bold;
  color: #333;
}

.sensor-type {
  font-size: 0.85em;
  color: #666;
  background-color: #e9ecef;
  padding: 2px 8px;
  border-radius: 3px;
}

.sensor-reading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9em;
}

.sensor-value {
  font-weight: bold;
  color: #28a745;
  font-size: 1.1em;
}

.sensor-date {
  color: #6c757d;
  font-size: 0.85em;
}

.sensor-no-data {
  color: #dc3545;
  font-style: italic;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .device-list-modal,
  .device-detail-modal {
    max-width: 95%;
    margin: 10px auto;
  }

  .device-list-filters {
    flex-direction: column;
  }

  .device-list-filters input,
  .device-list-filters select {
    width: 100%;
    min-width: auto;
  }

  .device-table {
    font-size: 0.9em;
  }

  .device-table th,
  .device-table td {
    padding: 6px 8px;
  }
}

/* Loading spinner */
.device-loading {
  text-align: center;
  padding: 20px;
}

.device-loading i {
  font-size: 2em;
  color: #007bff;
}

/* Empty state */
.device-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.device-empty-state i {
  font-size: 3em;
  margin-bottom: 15px;
  opacity: 0.5;
}

/* Device popup customization */
.device-popup {
  min-width: 200px;
}

.device-popup h4 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #333;
}

.device-popup ul {
  margin: 5px 0;
  padding-left: 20px;
}

.device-popup li {
  margin-bottom: 5px;
}

/* Sidepanel styles */
.device-layer-container {
  padding: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 100px);
}

.available-layer-container {
  margin-bottom: 10px;
}

.label-toggle-container {
  margin-bottom: 10px;
}

.label-toggle-container input[type="checkbox"] {
  margin-right: 5px;
}

.label-toggle-container label {
  cursor: pointer;
  user-select: none;
}

.data-management-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.data-management-container button {
  width: 100%;
}

/* Small Grafana button */
.btn-grafana-small {
  padding: 1px 4px !important;
  line-height: 1.2 !important;
  font-size: 10px !important;
  vertical-align: middle;
}

.btn-grafana-small i {
  margin-right: 2px;
}

/* Leaflet tooltip for device labels */
.leaflet-tooltip-device {
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #007bff;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  color: #333;
  font-weight: bold;
  font-size: 12px;
  padding: 4px 8px;
}

.leaflet-tooltip-device::before {
  border-top-color: #007bff;
}

/* Technical-only elements (hidden by default for non-technical users) */
.device-technical-only-hidden {
  display: none !important;
}

/* jsPanel styles for device list */
.js-Panel-device-list
{
  background-clip: padding-box;
  background-color: #00000000;
  border: 2px solid #00000033;
  border-radius: .25rem;
  box-shadow: 0 1px 5px #00000066;
}

.js-Panel-device-list .jsPanel-content
{
  background-color: #FFFFFFD2;
  font-size: 90%;
  padding: 10px;
}

.js-Panel-device-list .jsPanel-headerbar
{
  background-color: #A9A9A9D2;
  font-size: 65%;
}

/* DataTable adjustments */
.js-Panel-device-list table.dataTable
{
  font-size: 0.95em;
}

.js-Panel-device-list table.dataTable thead th
{
  padding: 9px 6px;
  font-size: 0.95em;
}

.js-Panel-device-list table.dataTable tbody td
{
  padding: 7px 6px;
}

/* Responsive design for jsPanel */
@media only screen and (max-width: 900px)
{
  .js-Panel-device-list
  {
    max-width: 95% !important;
    left: 2.5% !important;
  }

  .js-Panel-device-list .jsPanel-content
  {
    padding: 5px;
    font-size: 85%;
  }

  .js-Panel-device-list .jsPanel-headerbar
  {
    font-size: 70%;
  }

  .js-Panel-device-list table.dataTable
  {
    font-size: 0.85em;
  }

  .js-Panel-device-list table.dataTable thead th
  {
    padding: 8px 4px;
    font-size: 0.9em;
  }

  .js-Panel-device-list table.dataTable tbody td
  {
    padding: 6px 4px;
  }
}

@media only screen and (max-width: 480px)
{
  .js-Panel-device-list
  {
    max-width: 98% !important;
    left: 1% !important;
  }

  .js-Panel-device-list .jsPanel-content
  {
    padding: 3px;
    font-size: 75%;
  }

  .js-Panel-device-list .jsPanel-headerbar
  {
    font-size: 60%;
  }

  .js-Panel-device-list table.dataTable
  {
    font-size: 0.75em;
  }

  .js-Panel-device-list table.dataTable thead th,
  .js-Panel-device-list table.dataTable tbody td
  {
    padding: 4px 2px;
  }
}

/* jsPanel styles for device information popup */
.js-Panel-device-info
{
  background-clip: padding-box;
  background-color: #00000000;
  border: 2px solid #00000033;
  border-radius: .25rem;
  box-shadow: 0 1px 5px #00000066;
}

.js-Panel-device-info .jsPanel-content
{
  background-color: #FFFFFFD2;
  font-size: 90%;
  padding: 15px;
}

.js-Panel-device-info .jsPanel-headerbar
{
  background-color: #A9A9A9D2;
  font-size: 70%;
}

@media only screen and (max-width: 900px)
{
  .js-Panel-device-info
  {
    max-width: 95%;
  }

  .js-Panel-device-info .jsPanel-content
  {
    font-size: 85%;
    padding: 10px;
  }
}

/* jsPanel styles for Grafana chart popup */
.js-Panel-device-grafana
{
  background-clip: padding-box;
  background-color: #00000000;
  border: 2px solid #00000033;
  border-radius: .25rem;
  box-shadow: 0 1px 5px #00000066;
}

.js-Panel-device-grafana .jsPanel-content
{
  background-color: #FFFFFFD2;
  padding: 0;
  overflow: hidden;
}

.js-Panel-device-grafana .jsPanel-headerbar
{
  background-color: #A9A9A9D2;
  font-size: 70%;
}

@media only screen and (max-width: 900px)
{
  .js-Panel-device-grafana
  {
    max-width: 98%;
  }
}
