/* ═══════════════════════════════════════════
   E-OS Dashboard — Shared Styles
   Palette: Aeon Energy (dark green, gold, white)
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --green-dark: #003327;
  --green-primary: #004737;
  --green-mid: #005c47;
  --green-light: #007a5e;
  --green-pale: #e6f2ee;
  --green-subtle: #f2f9f6;
  --gold: #f8ae0f;
  --gold-dark: #d4940a;
  --gold-light: #fef0cc;
  --gold-pale: #fdf8ed;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --status-green: #16a34a;
  --status-green-bg: #dcfce7;
  --status-red: #dc2626;
  --status-red-bg: #fee2e2;
  --status-orange: #ea580c;
  --status-orange-bg: #ffedd5;
  --status-blue: #2563eb;
  --status-blue-bg: #dbeafe;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.10);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.14);
}

/* ── Reset ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ═══ TOPBAR ═══ */
.topbar {
  background: var(--green-dark);
  height: 64px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--gold);
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}
.logo-aeon {
  font-size: 28px;
  font-weight: 900;
  color: var(--white);
  letter-spacing: 2px;
}
.logo-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.2);
}
.logo-eos {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1.5px;
}
.breadcrumb {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  gap: 8px;
}
.breadcrumb a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb .current { color: rgba(255,255,255,0.9); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ═══ INNER PAGE LAYOUT ═══ */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 36px 60px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-left h2 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--green-dark);
}
.page-header-left p {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-primary);
  background: var(--green-pale);
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.back-btn:hover { background: var(--green-primary); color: var(--white); }

/* ═══ STATS ROW ═══ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--green-mid);
  border-radius: 10px 0 0 10px;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: block;
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--green-dark);
  margin-top: 4px;
  letter-spacing: -1px;
  display: block;
}
.stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  display: block;
}
.stat-change.up { color: var(--status-green); }
.stat-change.down { color: var(--status-red); }
.stat-change.neutral { color: var(--gray-500); }

/* ═══ CONTENT GRID ═══ */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.content-grid.equal { grid-template-columns: 1fr 1fr; }
.content-grid.full { grid-template-columns: 1fr; }

/* ═══ PANEL ═══ */
.panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
}
.panel-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ═══ BADGES ═══ */
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.badge-live { background: var(--status-green-bg); color: var(--status-green); }
.badge-warn { background: var(--status-orange-bg); color: var(--status-orange); }
.badge-coming { background: var(--gray-100); color: var(--gray-500); }

/* ═══ DATA TABLE ═══ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 14px;
  border-bottom: 2px solid var(--gray-200);
}
.data-table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--green-subtle); }

/* ═══ BUTTONS ═══ */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.action-btn.primary { background: var(--green-primary); color: var(--white); }
.action-btn.primary:hover { background: var(--green-dark); }
.action-btn.gold { background: var(--gold); color: var(--green-dark); }
.action-btn.gold:hover { background: var(--gold-dark); }
.action-btn.danger { background: var(--status-red); color: var(--white); }
.action-btn.danger:hover { background: #b91c1c; }
.action-btn.success { background: var(--status-green); color: var(--white); }
.action-btn.success:hover { background: #15803d; }
.action-btn.outline { background: transparent; border: 1.5px solid var(--gray-200); color: var(--gray-700); }
.action-btn.outline:hover { border-color: var(--green-primary); color: var(--green-primary); }
.action-btn.whatsapp { background: #25d366; color: var(--white); }
.action-btn.whatsapp:hover { background: #1da851; }

/* ═══ CHART PLACEHOLDER ═══ */
.chart-area {
  height: 200px;
  background: linear-gradient(135deg, var(--green-subtle), var(--gray-100));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 13px;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}
.chart-area::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120'%3E%3Cpath d='M0,80 Q50,30 100,60 T200,40 T300,70 T400,35' fill='none' stroke='%2222543d' stroke-width='2' opacity='0.15'/%3E%3Cpath d='M0,95 Q60,50 120,75 T240,55 T360,80 T400,50' fill='none' stroke='%23d4a029' stroke-width='1.5' opacity='0.15'/%3E%3C/svg%3E") no-repeat bottom center;
  background-size: 100%;
}

/* ═══ ALERT ITEMS ═══ */
.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  transition: background 0.2s;
}
.alert-item:hover { background: var(--gray-100); }
.alert-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.alert-dot.critical { background: var(--status-red); }
.alert-dot.warning { background: var(--status-orange); }
.alert-dot.ok { background: var(--status-green); }
.alert-text { flex: 1; color: var(--gray-700); }
.alert-time { font-size: 11px; color: var(--gray-500); white-space: nowrap; }

/* ═══ UNDER CONSTRUCTION ═══ */
.under-construction {
  border: 2px dashed var(--gray-300);
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--gray-500);
}
.under-construction .uc-icon { font-size: 32px; margin-bottom: 10px; }
.under-construction h4 { font-size: 15px; font-weight: 700; color: var(--gray-700); }

/* ═══ INFO BOX ═══ */
.info-box {
  padding: 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 14px;
}
.info-box.warn { background: var(--status-orange-bg); }
.info-box.warn strong { color: var(--status-orange); }
.info-box.success { background: var(--status-green-bg); }
.info-box.success strong { color: var(--status-green); }

/* ═══ FOOTER ═══ */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 11px;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-200);
}

/* ═══ CHART CONTAINER ═══ */
.chart-wrap {
  position: relative;
  background: var(--white);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.chart-wrap:hover {
  box-shadow: var(--shadow-md);
}
.chart-wrap .expand-hint {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 11px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 3px 10px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.chart-wrap:hover .expand-hint { opacity: 1; }

/* ═══ CHART MODAL ═══ */
.chart-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 32px;
  backdrop-filter: blur(4px);
}
.chart-modal-overlay.open { display: flex; }
.chart-modal {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  padding: 32px;
  position: relative;
  box-shadow: 0 32px 80px rgba(0,0,0,0.3);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }
.chart-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.chart-modal-close:hover { background: var(--gray-200); }
.chart-modal h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 20px;
}
.chart-modal canvas {
  width: 100% !important;
  max-height: 60vh;
}

/* ═══ TOPOLOGY ═══ */
.topology-container {
  position: relative;
  background: var(--green-subtle);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.topology-container:hover { box-shadow: var(--shadow-md); }
.topology-container .expand-hint {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 11px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 3px 10px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 2;
}
.topology-container:hover .expand-hint { opacity: 1; }

/* ═══ PAGE ANIMATION ═══ */
.page-wrap { animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .content-grid.equal { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .page-wrap { padding: 20px 16px 40px; }
}
@media (max-width: 560px) {
  .stats-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .topbar { height: 50px; }
  .logo-aeon { font-size: 20px; }
}
