/* ============================================================
   ELECTRIC DEMAND LIMITING (EDL) — Styles
   Add these to your styles.css
   ============================================================ */

.edl-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  width: 100%;
}

/* Header */
.edl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.edl-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.edl-badge {
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
}

.edl-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.0px;
  text-transform: uppercase;
  margin: 0;
}

.edl-asset-name {
  color: var(--text-muted, #888);
  font-size: 18px;
  font-style: italic;
}

/* Status dot */
.edl-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #444;
  transition: background 0.3s;
}

.edl-dot-ok {
  background: #00c48c;
  box-shadow: 0 0 6px #00c48c88;
}

.edl-dot-error {
  background: #ff4d4d;
  box-shadow: 0 0 6px #ff4d4d88;
}

/* Layout grid */
.edl-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.edl-stats {
  display: flex;
  gap: 16px;
}

/* Stat cards */
.edl-stat-card {
  background: var(--card, #12122a);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  /* min-width: 30px; */
  flex: 1;
}

.edl-stat-label {
  font-size: 12px;
  color: var(--text-muted, #888);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edl-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.edl-stat-unit {
  font-size: 12px;
  color: var(--text-muted, #888);
  margin-top: 2px;
}

/* Progress bar */
.edl-bar-section {
  margin-bottom: 20px;
}

.edl-bar-track {
  position: relative;
  height: 20px;
  background: var(--card, #12122a);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 10px;
  overflow: hidden;
}

.edl-bar-fill {
  height: 100%;
  width: 0%;
  background: #00c48c;
  border-radius: 10px;
  transition:
    width 0.6s ease,
    background 0.4s ease;
}

.edl-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted, #888);
  margin-top: 4px;
}

/* Settings */
.edl-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edl-setting-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.edl-setting-row label {
  font-size: 12px;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edl-input {
  background: var(--card, #12122a);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 6px;
  color: inherit;
  font-size: 16px;
  padding: 8px 10px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s;
  height: 40px;
}

.edl-input:focus {
  outline: none;
  border-color: #00d4ff;
}

.edl-apply-btn {
  background: var(--accent);
  border: 1px solid #00d4ff55;
  border-radius: 6px;
  color: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 10px;
  transition:
    background 0.2s,
    border-color 0.2s;
  margin-top: 4px;
}

.edl-apply-btn:hover {
  background: var(--accentdark);
  /* border-color: #00d4ff; */
}

.edl-msg {
  font-size: 12px;
  display: flex;
  min-height: 16px;
  align-items:center ;
  gap: 8px;
}

/* Chart */
.edl-chart-wrap {
  min-height: 300px;
}

.edl-chart {
  width: 100%;
  height: 340px;
  border-radius: 8px;
  overflow: hidden;
}

.edl-slider-input-box {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.edl-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* margin-bottom: 8px; */
  width: 100%;
  box-sizing: border-box;
  /* padding: 0; */
}

.edl-slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  margin: 0;
  padding: 0;
  height: 12px;
  border-radius: var(--radius);
  background: linear-gradient(to right,
      var(--accent) var(--fill, 0%),
      var(--accenttint, #2a2012) var(--fill, 0%));
  border: 1px solid var(--border);
  outline: none;
  cursor: pointer;
}

input[type="range"].edl-slider {
  width: 100%;
}

.edl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accentdark);
  border: 2px solid #fff;
  /* box-shadow: 0 0 8px var(--accenttint); */
  cursor: grab;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}

.edl-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
  box-shadow: 0 0 14px var(--accenttint);
}

.edl-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #00d4ff;
  border: 2px solid #fff;
  box-shadow: 0 0 8px #00d4ff88;
  cursor: grab;
}

.edl-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted, #888);
}

.edl-slider-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edl-input-small {
  width: 70px !important;
  text-align: center;
}

.edl-input-unit {
  font-size: 13px;
  color: var(--text-muted, #888);
}

hr {
  border: none;
  /* Remove default border */
  height: 2px;
  /* Thickness of the line */
  background-color: var(--muted);
  /* Line color */
  width: 90%;
  /* Full width */
  margin: 20px 0;
  border-radius: var(--radius);
  align-self: center;
}

/* ============================================================
   EDL — Additional styles for shed logic & device list
   ============================================================ */

.edl-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.edl-auto-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edl-auto-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted, #888);
}

/* Stats row */
.edl-stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.edl-stats-row .edl-stat-card {
  flex: 1;
  min-width: 120px;
  margin-bottom: 0;
}

/* Zone card variants */
.edl-zone-ok {
  border-color: rgba(22, 163, 74, 0.3) !important;
  background: rgba(22, 163, 74, 0.05) !important;
}

.edl-zone-hold {
  border-color: rgba(245, 158, 11, 0.3) !important;
  background: rgba(245, 158, 11, 0.05) !important;
}

.edl-zone-warn {
  border-color: rgba(245, 158, 11, 0.4) !important;
  background: rgba(245, 158, 11, 0.08) !important;
}

.edl-zone-crit {
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

.edl-zone-ok .edl-stat-value {
  color: var(--ok, #16a34a);
}

.edl-zone-hold .edl-stat-value {
  color: var(--warn, #f59e0b);
}

.edl-zone-warn .edl-stat-value {
  color: var(--warn, #f59e0b);
}

.edl-zone-crit .edl-stat-value {
  color: var(--crit, #ef4444);
}

/* Bar markers */
.edl-bar-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--ok, #16a34a);
  border-radius: 2px;
  transform: translateX(-50%);
}

.edl-bar-marker-shed {
  background: var(--warn, #f59e0b);
}

/* Bottom grid */
.edl-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

@media (max-width: 860px) {
  .edl-bottom-grid {
    grid-template-columns: 1fr;
  }
}

/* Section titles */
.edl-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--muted, #888);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border, #e2e7ef);
}

/* Settings block */
.edl-settings-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Restore mode buttons */
.edl-restore-mode-wrap {
  display: flex;
  gap: 8px;
}

.edl-mode-btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border, #e2e7ef);
  border-radius: 6px;
  background: var(--card-inner, #f7f9fc);
  color: var(--muted, #888);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px ;
}

.edl-mode-btn:hover {
  border-color: var(--accent, #2f3e5a);
  color: var(--accent, #2f3e5a);
}

.edl-mode-active {
  background: var(--accenttint, #f0f4fa) !important;
  border-color: var(--accent, #2f3e5a) !important;
  color: var(--accent, #2f3e5a) !important;
}

/* Slider variants */
.edl-slider-warn {
  --thumb-color: var(--warn, #f59e0b);
}

.edl-slider-ok {
  --thumb-color: var(--ok, #16a34a);
}

.edl-slider-warn::-webkit-slider-thumb {
  background: var(--warn, #f59e0b) !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4) !important;
}

.edl-slider-ok::-webkit-slider-thumb {
  background: var(--ok, #16a34a) !important;
  box-shadow: 0 0 8px rgba(22, 163, 74, 0.4) !important;
}

/* Device list */
.edl-devices-block {
  display: flex;
  flex-direction: column;
}

.edl-device-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.edl-device-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--border, #e2e7ef);
  background: var(--card-inner, #f7f9fc);
  transition: background 0.2s;
}

.edl-device-shed {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.2);
}

.edl-device-ready {
  background: rgba(22, 163, 74, 0.04);
  border-color: rgba(22, 163, 74, 0.2);
}

.edl-device-inactive {
  background: var(--card-inner, #f7f9fc);
  opacity: 0.6;
}

.edl-device-priority {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #888);
  min-width: 24px;
  font-family: "Courier New", monospace;
}

.edl-device-info {
  display: flex;
  flex: 1;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.edl-device-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text, #0f1923);
  letter-spacing: 0.5px;
}

.edl-device-meta {
  font-size: 11px;
  color: var(--muted, #888);
  letter-spacing: 0.4px;
  /* margin-top: 2px; */
}

.edl-device-badges {
  display: flex;
  gap: 5px;
  align-items: center;
}

.edl-device-switch,
.edl-device-status {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 4px;
}

.edl-switch-on {
  background: rgba(22, 163, 74, 0.12);
  color: var(--ok, #16a34a);
}

.edl-switch-off {
  background: rgba(239, 68, 68, 0.1);
  color: var(--crit, #ef4444);
}

.edl-status-ready {
  background: rgba(22, 163, 74, 0.1);
  color: var(--ok, #16a34a);
}

.edl-status-shed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--crit, #ef4444);
}

.edl-status-inactive {
  background: var(--border, #e2e7ef);
  color: var(--muted, #888);
}

/* Shed log */
.edl-shed-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 500px;
  overflow-y: auto;
  margin-top: 4px;
}

.edl-log-empty {
  font-size: 11px;
  color: var(--muted, #888);
  font-style: italic;
  padding: 8px 0;
}

.edl-log-entry {
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 5px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--card-inner, #f7f9fc);
  border-left: 3px solid transparent;
  align-items: center;
}

.edl-log-time {
  color: var(--muted, #888);
  font-family: "Courier New", monospace;
  font-size: 10px;
  flex-shrink: 0;
}

.edl-log-ok {
  border-left-color: var(--ok, #16a34a);
}

.edl-log-warn {
  border-left-color: var(--warn, #f59e0b);
}

.edl-log-crit {
  border-left-color: var(--crit, #ef4444);
}

.edl-log-info {
  border-left-color: var(--accent, #2f3e5a);
}

/* EDL Suggest Auto Program */

.edl-suggest-btn {
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-inner);
  color: var(--accent);
  transition: all 0.2s;
  letter-spacing: 0.3px;
  width: 100%;
}

.edl-suggest-btn:hover{
  background: var(--accenttint);
  border-color: var(--accent);
}

.edl-suggest-btn:disabled{
  opacity: 0.6;
  cursor: not-allowed;
}

.edl-suggestion-panel{
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.edl-suggestion-loading{
  padding: 12px;
  font-size: 11px;
  color: var(--muted, #888);
  font-style: italic;
}

.edl-suggestion-error {
  padding: 12px;
  font-size: 11px;
  color: var(--crit)
}

.edl-suggestion-result{
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edl-suggestion-headline{
  font-size: 13px;
  color: var(--text);
}

.edl-suggestion-headline strong {
  font-size: 15px;
  color: var(--accent);
}

.edl-suggestion-divider{
  height: 1px;
  background: var(--border);
  margin: 4px 0 ;
}

.edl-suggestion-stat{
display: flex;
justify-content: space-between;
font-size: 11px;
color: var(--muted);
}

.edl-suggestion-stat span:last-child{
  color: var(--text);
  font-weight: 600;
  font-family: 'Courier New', Courier, monospace;
}

.edl-suggestion-risk{
  font-size: 12px;
  color: var(--warn);
  font-weight: 600;
  align-items: center;
  display: flex;
  gap: 8px;
}

.edl-suggestion-actions{
  display: flex;
border-top:1px solid var(--border);
}

.edl-apply-suggestion-btn,
.edl-dismiss-suggestion-btn{
  flex:1;
  padding: 8px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.3px;
}

.edl-apply-suggestion-btn{
  background: var(--accenttint);
  color: var(--accent);
  border-right: 1px solid var(--border);
}

.edl-apply-suggestion-btn:hover{
  background: var(--accent);
  color: #fff;
}

.edl-dismiss-suggestion-btn{
  background: transparent;
  color: var(--muted);
}

.edl-dismiss-suggestion-btn:hover{
  background: var(--border);
}