/* EZ-CHARGE portal theme — aligned with Documentation/Layout mockups */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --ez-green: #3d9e47;
  --ez-green-light: #e8f6ea;
  --ez-green-dark: #2f7f38;
  --ez-orange: #e8913a;
  --ez-bg: #eef1f4;
  --ez-sidebar-bg: #ffffff;
  --ez-card-bg: #ffffff;
  --ez-text: #1f2937;
  --ez-text-muted: #6b7280;
  --ez-border: #e5e7eb;
  --ez-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --ez-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --ez-radius: 16px;
  --ez-radius-sm: 10px;
  --ez-sidebar-width: 248px;
  --ez-danger: #e05252;
  --ez-blue: #4f8fe8;
}

html, body {
  height: 100%;
}

body.ez-app {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: var(--ez-text);
  background: var(--ez-bg);
}

body.ez-login {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #f4f7f9 0%, #e8f0ea 100%);
}

/* ---- App shell ---- */

.ez-shell {
  display: flex;
  min-height: 100vh;
}

.ez-sidebar {
  width: var(--ez-sidebar-width);
  flex-shrink: 0;
  background: var(--ez-sidebar-bg);
  border-radius: 0 24px 24px 0;
  box-shadow: var(--ez-shadow);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.ez-sidebar-brand {
  display: block;
  padding: 0.25rem 0.75rem 1.25rem;
  text-decoration: none !important;
}

.ez-sidebar-brand img,
.ez-sidebar-brand svg {
  display: block;
  width: 170px;
  height: auto;
}

.ez-nav {
  list-style: none;
  margin: 0;
  padding: 0 0.35rem;
  flex: 1;
}

.ez-nav-section {
  margin-top: 0.75rem;
  padding: 0.35rem 0.75rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
}

.ez-nav-item {
  margin-bottom: 0.2rem;
}

.ez-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  color: var(--ez-text-muted);
  text-decoration: none !important;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.ez-nav-link i {
  width: 1.1rem;
  text-align: center;
  font-size: 1rem;
}

.ez-nav-link:hover {
  background: #f3f4f6;
  color: var(--ez-text);
}

.ez-nav-link.active {
  background: var(--ez-green-light);
  color: var(--ez-green-dark);
  font-weight: 600;
}

.ez-nav-link.active i {
  color: var(--ez-green);
}

.ez-nav-sub {
  list-style: none;
  margin: 0.15rem 0 0.5rem 0;
  padding: 0 0 0 2.1rem;
}

.ez-nav-sub .ez-nav-link {
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
}

.ez-sidebar-user {
  margin-top: auto;
  padding: 0.85rem 0.75rem 0.25rem;
  border-top: 1px solid var(--ez-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ez-sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c7d2fe, #a7f3d0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.ez-sidebar-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.ez-sidebar-user-email {
  font-size: 0.75rem;
  color: var(--ez-text-muted);
  word-break: break-all;
}

.ez-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1.75rem 2rem;
}

/* ---- Page header ---- */

.ez-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ez-page-title {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ez-text);
}

.ez-page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---- Cards & panels ---- */

.ez-card {
  background: var(--ez-card-bg);
  border-radius: var(--ez-radius);
  box-shadow: var(--ez-shadow-sm);
  border: 1px solid rgba(229, 231, 235, 0.8);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.ez-card-flush {
  padding: 0;
  overflow: hidden;
}

.ez-card-flush .table {
  margin-bottom: 0;
}

.ez-stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ez-stat-pill {
  background: #fff;
  border: 1px solid var(--ez-border);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  box-shadow: var(--ez-shadow-sm);
}

.ez-stat-pill strong {
  font-weight: 700;
}

.ez-stat-pill.danger strong {
  color: var(--ez-danger);
}

/* ---- Toolbar (filters / actions bar) ---- */

.ez-toolbar {
  background: #f8fafb;
  border: 1px solid var(--ez-border);
  border-radius: var(--ez-radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

/* ---- Buttons ---- */

.btn-ez-primary {
  color: #fff;
  background-color: var(--ez-green);
  border-color: var(--ez-green);
  border-radius: 999px;
  font-weight: 600;
  padding: 0.45rem 1.15rem;
}

.btn-ez-primary:hover,
.btn-ez-primary:focus {
  color: #fff;
  background-color: var(--ez-green-dark);
  border-color: var(--ez-green-dark);
}

.btn-ez-outline {
  border-radius: 999px;
  font-weight: 500;
  border-color: var(--ez-border);
  color: var(--ez-text);
  background: #fff;
}

.btn-ez-outline:hover {
  background: #f9fafb;
  color: var(--ez-text);
}

.btn-ez-download {
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--ez-border);
  color: var(--ez-text);
  font-weight: 500;
  padding: 0.45rem 1rem;
}

.btn-ez-download:hover {
  background: #f9fafb;
  color: var(--ez-text);
}

/* Bootstrap overrides */

.btn-primary {
  background-color: var(--ez-green);
  border-color: var(--ez-green);
  border-radius: 999px;
  font-weight: 600;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--ez-green-dark);
  border-color: var(--ez-green-dark);
}

.btn-secondary {
  border-radius: 999px;
}

.form-control {
  border-radius: var(--ez-radius-sm);
  border-color: var(--ez-border);
}

.form-control:focus {
  border-color: var(--ez-green);
  box-shadow: 0 0 0 0.15rem rgba(61, 158, 71, 0.15);
}

/* ---- Tables ---- */

.ez-card .table thead th,
.ez-card-flush .table thead th {
  border-top: none;
  border-bottom: 1px solid var(--ez-border);
  color: var(--ez-text-muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: none;
  background: #fafbfc;
}

.ez-card .table td,
.ez-card-flush .table td {
  vertical-align: middle;
  border-color: #f1f5f9;
}

.table-hover tbody tr.table-row:hover {
  background-color: #f8fafc;
}

/* ---- Connector tiles (dashboard) ---- */

.tilegrid {
  display: grid;
  grid-gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.tilegrid .card {
  border: none;
  border-radius: var(--ez-radius);
  box-shadow: var(--ez-shadow-sm);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tilegrid .card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ez-shadow);
}

.tilegrid .card-header {
  border-bottom: none;
  font-weight: 600;
  color: #fff;
}

.tilegrid .cp-state-offline {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  color: #fff;
}

.tilegrid .cp-state-available {
  background: linear-gradient(135deg, #4ade80, #3d9e47);
  color: #fff;
}

.tilegrid .cp-state-charging {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  color: #fff;
}

.tilegrid .cp-charging-metrics {
  font-size: 0.9rem;
  line-height: 1.45;
}

.tilegrid .cp-charging-metrics .card-text {
  margin-bottom: 0.25rem;
}

.tilegrid .cp-state-fault {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: #fff;
}

.cp-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  background: #fafbfc;
}

.btn-ez-icon {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  line-height: 1;
}

.cp-action-amps {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-right: 0.15rem;
}

.cp-action-amps select {
  width: 4.5rem;
  height: 2.1rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.78rem;
}

/* ---- Login ---- */

.ez-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.ez-login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--ez-shadow);
  padding: 2rem 2rem 1.75rem;
}

.ez-login-card .ez-sidebar-brand {
  text-align: center;
  padding-bottom: 1.5rem;
}

.ez-login-card .ez-sidebar-brand img,
.ez-login-card .ez-sidebar-brand svg {
  margin: 0 auto;
}

/* ---- Breadcrumb ---- */

.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.breadcrumb-item a {
  color: var(--ez-green);
}

/* ---- Mobile ---- */

.ez-mobile-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  border-radius: 10px;
  box-shadow: var(--ez-shadow-sm);
}

@media (max-width: 991.98px) {
  .ez-mobile-toggle {
    display: inline-flex;
  }

  .ez-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .ez-sidebar.open {
    transform: translateX(0);
  }

  .ez-main {
    padding: 3.5rem 1rem 1.5rem;
  }
}

/* ---- Legacy compatibility ---- */

body.ez-app .footer {
  display: none;
}

body.ez-app .container {
  max-width: none;
  padding: 0;
  width: 100%;
}

a {
  color: var(--ez-green-dark);
}

a:hover {
  color: var(--ez-green);
}

/* Amp dashboard charts — keep existing palette */
.amp-chart-wrap {
  position: relative;
  width: 100%;
  height: 36px;
  overflow: hidden;
}

.amp-chart-wrap-md { height: 48px; }
.amp-chart-wrap-sm { height: 32px; }
.amp-chart-wrap-xs { height: 24px; }

.amp-chart-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.site-dashboard-table .collapse-row > td {
  background-color: #f8fafc;
}

.site-dashboard-table td {
  vertical-align: middle !important;
}

.amp-legend-item {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
}

.amp-legend-item::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border-radius: 2px;
}

.amp-legend-consumed::before { background-color: #7ec8e3; }
.amp-legend-allocated-unused::before { background-color: #1e6fb8; }
.amp-legend-available::before { background-color: #28a745; }
.amp-legend-other::before { background-color: #adb5bd; }

.table-row {
  cursor: pointer;
}

.checkbox-lg {
  transform: scale(1.5);
  padding: 10px;
}

.inline-label {
  display: inline !important;
}
