/* Adaptive dashboard layout for desktop, tablet and phone */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img,
svg,
canvas {
  max-width: 100%;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.glass-card,
.card {
  overflow-wrap: anywhere;
}

.side-panel {
  min-width: 0;
}

.charging-graph {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.slot {
  scroll-snap-align: start;
}

@media (min-width: 1500px) {
  .app {
    max-width: 1680px;
    padding: 40px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 28px;
  }

  .glass-card,
  .card {
    padding: 26px;
  }

  .battery-row strong,
  .metric-row strong {
    font-size: 2.55rem;
  }

  .charging-graph {
    height: 220px;
  }

  .slot {
    min-width: 22px;
  }
}

@media (max-width: 1200px) {
  .app {
    max-width: 1180px;
    padding: 24px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
  }

  .glass-card,
  .card {
    border-radius: 28px;
    padding: 18px;
  }

  .battery-row strong,
  .metric-row strong {
    font-size: 1.9rem;
  }
}

@media (max-width: 980px) {
  .app {
    width: 100%;
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .topbar-actions .status-pill {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .topbar-actions .ghost-button,
  .topbar-actions button {
    width: 100%;
    justify-content: center;
  }

  .dashboard-grid,
  .grid,
  .rule-form-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .rules-card {
    grid-column: 1 / -1;
  }

  .section-header {
    align-items: flex-start;
  }

  .chart-card {
    min-height: 245px;
  }

  .charging-graph {
    height: 170px;
    gap: 5px;
  }

  .slot {
    min-width: 17px;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 12px;
  }

  h1 {
    font-size: clamp(1.8rem, 9vw, 2.6rem);
  }

  h2 {
    font-size: 1.15rem;
  }

  .glass-card,
  .card {
    border-radius: 24px;
    padding: 16px;
    margin-bottom: 12px;
  }

  .topbar-actions {
    grid-template-columns: 1fr 1fr;
  }

  .status-pill {
    width: 100%;
    min-height: 44px;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .battery-row,
  .metric-row,
  .section-header,
  .hero-info {
    gap: 10px;
  }

  .battery-row strong,
  .metric-row strong {
    font-size: 1.75rem;
  }

  .clean-hero-info {
    align-items: flex-start;
    padding: 0 4px;
  }

  .legend {
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
  }

  .charging-graph {
    height: 150px;
    padding-bottom: 32px;
  }

  .slot {
    min-width: 16px;
  }

  .slot-label {
    font-size: 9px;
  }

  .rule-item,
  .item {
    align-items: flex-start;
    flex-direction: column;
  }

  .rule-toggle {
    align-self: flex-end;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 10px;
  }

  .login-shell {
    min-height: calc(100vh - 20px);
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .compact,
  .ghost-button,
  .primary-button {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
  }

  .glass-card,
  .card {
    border-radius: 20px;
    padding: 14px;
  }

  .battery-row strong,
  .metric-row strong {
    font-size: 1.55rem;
  }

  .chart-card {
    min-height: 220px;
  }

  .charging-graph {
    height: 135px;
    gap: 4px;
  }

  .slot {
    min-width: 15px;
  }

  input,
  select,
  button {
    min-height: 44px;
  }
}
