/* Areas Management Styles */
/* wwwroot/css/areas.css */

/* Hide the old filter panel completely */

/* Sub Areas & Devices Section Improvements */
.subareas-content-wrapper {
  padding: 1rem 0;
  margin-bottom: 0.5rem;
}

.subareas-container {
  padding-bottom: 0.5rem;
}

.subarea-item:last-child {
  margin-bottom: 0;
}

/* Ensure proper spacing between Sub Areas section and footer */
.white-card:has(.subareas-container) {
  margin-bottom: 2rem;
}

/* Footer spacing improvements */
.dashboard-form-footer.outer-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
}

/* Improved Sub Area Styling */
.subarea-item {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.subarea-item:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.subarea-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.subarea-name-field {
  flex: 1;
  max-width: 400px;
}

.subarea-name-input {
  font-weight: 500;
  font-size: 1rem;
}

.subarea-actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Devices Container - Better Visual Hierarchy */
.devices-container {
  margin-top: 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid #cbd5e0;
  position: relative;
}

.devices-container::before {
  content: "Devices";
  position: absolute;
  top: -1.5rem;
  left: -1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Improved Device Card Styling */
.device-form-wrapper {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  position: relative;
  transition: all 0.2s ease;
}

.device-form-wrapper:hover {
  border-color: #cbd5e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.device-form-wrapper:last-child {
  margin-bottom: 0;
}

.device-form-tag {
  position: absolute;
  top: -0.75rem;
  left: 1rem;
  padding: 4px 12px;
  border-radius: 12px;
  background-color: #4a5568;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Device Form Fields - Grid Layout Instead of Horizontal Scroll */
.device-form-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.device-form-field {
  width: 100%;
  padding-bottom: 0;
}

.device-form-field label {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #2d3748;
}

.device-form-field .form-control,
.device-form-field .form-select {
  width: 100%;
}

/* Delete Button Positioning */
.device-form-wrapper .btn-delete {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 6px 10px;
  width: auto;
  min-width: auto;
  height: auto;
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.device-form-wrapper .btn-delete:hover {
  background-color: #fecaca;
  border-color: #fca5a5;
  color: #991b1b;
}

.subarea-actions-group .btn-delete {
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.subarea-actions-group .btn-delete:hover {
  background-color: #fecaca;
  border-color: #fca5a5;
  color: #991b1b;
}

/* Responsive Design */
@media (max-width: 768px) {
  .device-form-wrap {
    grid-template-columns: 1fr;
  }
  
  .subarea-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .subarea-name-field {
    max-width: 100%;
  }
  
  .subarea-actions-group {
    width: 100%;
    justify-content: flex-end;
  }
  
  .devices-container {
    padding-left: 0.5rem;
  }
}


/* ============================================
   Dashboard Container Styles - Matching area-setting.html design
   ============================================ */

.dashboard-container {
  padding: 2rem 0;
}

.dashboard-datatable {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
}

/* Dashboard Table Header */
.dashboard-table-header {
  margin-bottom: 1.5rem;
}

.dashboard-table-header p.fw-semibold {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.25rem;
}

.dashboard-table-header p:last-child {
  color: #718096;
  font-size: 0.875rem;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#datatableSearchContainer {
  min-width: 200px;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

/* Table Styles */
.table-responsive {
  border-radius: 8px;
  overflow: hidden;
}

#areaSettingTable {
  width: 100%;
}

#areaSettingTable thead th {
  background-color: #f7fafc;
  font-weight: 600;
  color: #2d3748;
  border-bottom: 2px solid #e2e8f0;
  padding: 1rem;
}

#areaSettingTable tbody td {
  padding: 1rem;
  vertical-align: middle;
}

/* Area Info Styles */
.area-info {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.area-info .form-check-input {
  margin-top: 0;
}

.area-info .d-flex.flex-column {
  flex: 1;
}

.area-name {
  font-weight: 500;
  color: #2d3748;
}

.has-subarea {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #718096;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Number Tags */
.number-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: #edf2f7;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.875rem;
  color: #2d3748;
}

.number-tag.occupancy {
  background-color: #bee3f8;
  color: #2c5282;
}

.number-tag.capacity {
  background-color: #c6f6d5;
  color: #22543d;
}

.number-tag.device {
  background-color: #fed7d7;
  color: #742a2a;
}

/* Overage Text */
.overage-text {
  font-weight: 500;
  color: #2d3748;
  font-size: 0.875rem;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.status-badge.status-approved {
  background-color: #c6f6d5;
  color: #22543d;
}

.status-badge.status-rejected {
  background-color: #fed7d7;
  color: #742a2a;
}

/* Table Actions */
.table-action {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.table-action a,
.table-action button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: #718096;
  cursor: pointer;
  transition: color 0.2s;
}

.table-action a:hover,
.table-action button:hover {
  color: #2d3748;
}

/* Icon Styles */
.icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* Table Footer */
.table-footer {
  padding: 16px 0;
  border-top: none;
}

/* Entries Selector Styling - Using dashboard-datatable prefix for specificity and !important to override conflicting styles */
.dashboard-datatable .table-footer .entries-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6b7280;
}

.dashboard-datatable .table-footer .entries-selector label {
  margin: 0;
  font-weight: 500;
}

.dashboard-datatable .table-footer .entries-selector select {
  padding: 6px 12px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  background-color: #ffffff !important;
  color: #374151 !important;
  cursor: pointer;
  width: auto !important;
  min-width: 60px !important;
  height: auto !important;
}

.dashboard-datatable .table-footer .entries-selector select option {
  color: #374151 !important;
  background-color: #ffffff !important;
}

.dashboard-datatable .table-footer .entries-selector select:focus {
  outline: none;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.dashboard-datatable .table-footer .entries-selector span {
  margin-left: 4px;
}

/* Modal Styles */
.delete-modal .modal-content {
  border-radius: 8px;
}

.delete-modal .alert-danger {
  background-color: #fed7d7;
  border-color: #fc8181;
  color: #742a2a;
}

.modal-divider {
  height: 1px;
  background-color: #e2e8f0;
  margin: 1.5rem 0;
}

.top-row-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 1rem;
}

.top-row {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.top-row li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: #edf2f7;
  border-radius: 20px;
  font-size: 0.875rem;
}

.top-row li button {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: #718096;
}

.top-row li button:hover {
  color: #2d3748;
}

/* Toast Styles */
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1055;
}

.toast-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  #datatableSearchContainer {
    width: 100%;
  }

  .table-footer {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
}

/* ============================================
   Custom Multi-Select Dropdown Styles
   ============================================ */

.custom-multiselect {
  position: relative;
  width: 100%;
}

.multiselect-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  min-height: 38px;
  cursor: pointer;
  user-select: none;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.multiselect-trigger:hover {
  border-color: #adb5bd;
}

.multiselect-trigger.active,
.multiselect-trigger:focus {
  border-color: #3653a9;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(54, 83, 169, 0.25);
}

.multiselect-trigger.has-selection .multiselect-placeholder {
  color: #2d3748;
}

.multiselect-placeholder {
  color: #6c757d;
  flex: 1;
  text-align: left;
}

.multiselect-selected-count {
  flex: 1;
  text-align: left;
  color: #2d3748;
  font-weight: 500;
}

.multiselect-arrow {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: #6c757d;
}

.multiselect-trigger.active .multiselect-arrow {
  transform: rotate(180deg);
}

.multiselect-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-top: 0.25rem;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow: hidden;
  flex-direction: column;
}

.multiselect-dropdown.show {
  display: flex;
}

.multiselect-search {
  position: relative;
  padding: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.multiselect-search input {
  flex: 1;
  padding-right: 3rem;
  border: 1px solid #ced4da;
}

.multiselect-search input:focus {
  border-color: #3653a9;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(54, 83, 169, 0.25);
}

.multiselect-clear-all {
  position: absolute;
  right: 2.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  transition: color 0.15s ease;
  z-index: 10;
}

.multiselect-clear-all:hover {
  color: #dc3545;
}

.multiselect-clear-all:focus {
  outline: 2px solid #3653a9;
  outline-offset: 2px;
  border-radius: 2px;
}

.multiselect-clear-all .icon {
  width: 16px;
  height: 16px;
}

.multiselect-search .search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  pointer-events: none;
  z-index: 1;
}

.multiselect-options {
  overflow-y: auto;
  max-height: 250px;
  padding: 0.25rem 0;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.multiselect-option:hover {
  background-color: #f8f9fa;
}

.multiselect-option.selected {
  background-color: #e7f3ff;
}

.multiselect-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.multiselect-option label {
  margin: 0;
  cursor: pointer;
  flex: 1;
  user-select: none;
  color: #2d3748;
}

.multiselect-empty {
  padding: 1.5rem;
  text-align: center;
  color: #6c757d;
}

.custom-multiselect.is-invalid .multiselect-trigger {
  border-color: #dc3545;
}

.custom-multiselect.is-invalid .multiselect-trigger:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

#areasMultiSelectError {
  display: none;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #dc3545;
}

.custom-multiselect.is-invalid ~ #areasMultiSelectError {
  display: block;
}

/* ============================================
   Classes Create Page Styles
   ============================================ */

/* Access Levels Container */
.access-levels-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 1rem;
  background: #fff;
}

.access-level-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.access-level-item:hover {
  background-color: #f8f9fa;
  border-color: #dee2e6;
}

.access-level-item.selected {
  background-color: #e3f2fd;
  border-color: #2196f3;
}

.access-level-name {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.access-level-description {
  font-size: 0.875rem;
  color: #6c757d;
  margin: 0;
}

.access-level-checkbox {
  margin-right: 0.75rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 0.375rem;
  border: 1px solid #e9ecef;
}

.stat-label {
  font-weight: 500;
  color: #495057;
}

.stat-value {
  font-weight: 600;
  color: #212529;
}

.loading-message {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
}

.alert {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
}

.alert-info {
  background-color: #e3f2fd;
  color: #0d47a1;
  border-color: #bbdefb;
}

.danger-panel .panel-header {
  background-color: #dc3545;
  color: white;
  border-radius: 0.375rem 0.375rem 0 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
}

.checkbox-custom {
  margin-left: 0.5rem;
}

#notesCharCount {
  font-weight: 500;
}

.form-help {
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .access-levels-container {
    max-height: 200px;
  }
}
