/* =====================
   Reset & Base Styles
===================== */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: 'Poppins', Arial, sans-serif; 
}
:root {
  --surface: #ffffff;
  --surface-alt: #f6f7fb; /* app background */
  --text: #2b3440; /* soft dark */
  --muted: #8a99ad; /* lighter muted */
  --accent: #5b8def; /* professional blue */
  --accent-strong: #3b6fe3; /* stronger blue */
  --danger: #fda4a4; /* light red */
  --success: #6ee7b7; /* light green */
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);

  /* tints inspired by the reference style */
  --tint-blue-bg: #eef5ff;
  --tint-blue-br: #d9e7ff;
  --tint-red-bg: #fff1f1;
  --tint-red-br: #ffd9d9;
  --tint-green-bg: #eefdf4;
  --tint-green-br: #d6f5e2;
  --tint-purple-bg: #f7f1ff;
  --tint-purple-br: #e8dbff;
}
body { 
  background: var(--surface-alt);
  color: #2c2c2c;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =====================
   Sidebar
===================== */

.sidebar {
  position: fixed; 
  left: 0; top: 0; bottom: 0;
  width: 230px; padding: 22px;
  display:flex; flex-direction:column; justify-content:space-between;
  background: linear-gradient(180deg, #c7d2fe 0%, #e9d5ff 60%, #e0f2fe 100%);
  border-right: 1px solid rgba(0,0,0,0.08);

  z-index: 40;
}
.sidebar-logo { 
  width:56px; height:56px; border-radius:14px; 
  box-shadow:0 10px 30px rgba(99,102,241,0.18); 
  display:block; margin:0 auto 10px; 
  transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}
.sidebar-logo:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.05); box-shadow:0 14px 36px rgba(99,102,241,0.24); }
.sidebar-app { 
  text-align:center; color:var(--accent-yellow); 
  margin-bottom:14px; font-weight:800; letter-spacing:1px; 
}
.sidebar-nav { 
  display:flex; flex-direction:column; gap:8px; margin-top:6px; 
}
.nav-link {
  color: #334155; text-decoration:none; padding:10px 12px; border-radius:8px; 
  display:block; font-weight:600; transition: all .2s ease;
  background: rgba(255,255,255,0.7);
}
.nav-link:hover, .nav-link.active { 
  background: linear-gradient(90deg,#dbeafe,#fde68a);
  color:#1f2937; transform:translateX(4px); 
  box-shadow: 0 6px 20px rgba(2,6,23,0.08);
}
.nav-link:focus { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.25); }

/* tooltip for collapsed sidebar */
.sidebar.collapsed .nav-link[data-tooltip] { position: relative; }
.sidebar.collapsed .nav-link[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 72px;
  top: 50%;
  transform: translateY(-50%);
  background: #111827;
  color: #fff;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(15,23,42,0.22);
}

/* active indicator bar */
.sidebar .nav-link.active { position: relative; }
.sidebar .nav-link.active::before {
  content: '';
  position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 4px; background: var(--accent);
}
.sidebar-bottom { display:flex; gap:10px; flex-direction:column; margin-top:16px; }
.small { padding:10px; border-radius:8px; font-weight:700; cursor:pointer; border:none; }
.btn-ghost.small { background:transparent; border:1px solid rgba(255,255,255,0.05); color:#cfe8ff;}
.btn-danger.small { background:linear-gradient(90deg,#ef4444,#dc2626); color:white; }

/* =====================
   Main Layout
===================== */
.main-wrap { margin-left: 250px; padding: 24px 32px; min-height:100vh; }

/* =====================
   Topbar
===================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  background: #ffffff;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
  border: 1px solid #e6eaf2;
}

.topbar-left h1 {
  font-size: 1.6rem;
  color: #2563eb;
  text-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.topbar-right { display:flex; gap:12px; align-items:center; }
.clock {
  background: rgba(147, 197, 253, 0.35);
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
}
.clock-sub { color: #475569; font-weight: 600; font-size: 0.85rem; background: transparent; padding: 0 2px; }
.lang-select { background: rgba(255,255,255,0.85); color:#111827; padding:8px 10px; border-radius:8px; border:1px solid #e5e7eb; font-weight:600; }

/* =====================
   Sections & Cards
===================== */
.page-section { margin-bottom: 22px; }
.section-title { color: #fbbf24; margin-bottom:10px; font-size:1.1rem; }
/* improve readability on section titles */
.section-title { color: var(--accent); letter-spacing: .2px; }

/* Big cards */
.cards-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap:18px; margin-bottom:18px; }
.big-card {
  border-radius: 14px;
  padding: 18px;
  color: #333;
  min-height: 160px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.85); /* softer white overlay */
  border: 1px solid #e6eaf2;
}
.big-card .card-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.card-title { font-weight:800; font-size:1.05rem; }
.card-sub { font-size:0.9rem; color:rgba(0,0,0,0.65); }

/* card tints (same class names for easy swap) */
.gradient-1 { background: var(--tint-blue-bg); border: 1px solid var(--tint-blue-br); }
.gradient-2 { background: var(--tint-red-bg); border: 1px solid var(--tint-red-br); }
.gradient-3 { background: var(--tint-green-bg); border: 1px solid var(--tint-green-br); }
.gradient-4 { background: var(--tint-purple-bg); border: 1px solid var(--tint-purple-br); }


.big { border-radius:14px; padding:18px; color:white; min-height:9px; position:relative; overflow:hidden; box-shadow:0 8px 30px rgba(2,6,23,0.6); display:flex; flex-direction:column; gap:12px; }


.card-body { display:flex; gap:16px; align-items:center; }
.stat.big { font-size:1.6rem; font-weight:900; color:#1f2937; }
.big-card .stat.big { background: transparent; box-shadow: none; padding: 0; min-height: auto; }
.stat.small { font-size:0.95rem; color: rgba(0,0,0,0.75); }
.card-btn { margin-top:auto; align-self:flex-start; color:#1f3a8a; background: rgba(59,130,246,0.10); padding:8px 12px; border-radius:8px; text-decoration:none; font-weight:700; border:1px solid rgba(59,130,246,0.25); }
.card-btn:hover { background: rgba(59,130,246,0.18); }
/* aligned KPI layout in big card */
.kpi-label { display:block; font-size:0.85rem; font-weight:700; color:#64748b; }
.kpi-value { display:block; font-size:2rem; font-weight:900; line-height:1.1; margin-top:4px; color:#1f2937; }

/* Small cards */
.grid-container { display:grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap:18px; }
.card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  color: #333;
  border: 1px solid #e6eaf2;
}
.card h3 { color: var(--accent); margin-bottom:8px; }

/* =====================
   Status Lights
===================== */
#status-lights { display:flex; flex-direction:column; gap:10px; margin-top: 6px; }
#status-lights div { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.light { width:14px; height:14px; border-radius:50%; display:inline-block; margin-right:8px; }
.green { background:#22c55e; box-shadow:0 0 8px #22c55e; }
.red { background:#ef4444; box-shadow:0 0 10px #ef4444; }

/* =====================
   Alerts & Badges
===================== */
.alert { font-weight:700; padding:6px 8px; border-radius:8px; display:inline-block; }
.alert.normal {
  background: rgba(134, 239, 172, 0.35);
  color: #166534;
}

.alert.critical {
  background: rgba(252, 165, 165, 0.45);
  color: #991b1b;
}

.alert.current { background: rgba(147, 197, 253, 0.35); color:#2563eb; }
.alert.tilt { background: rgba(253, 230, 138, 0.45); color:#b45309; }
.alert-box-large { font-size:2rem; font-weight:900; }

/* =====================
   Charts & Controls
===================== */
.charts-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap:12px; }
.manual-controls { display:flex; gap:12px; margin-top:10px; flex-wrap:wrap; }
.manual-controls .btn { margin-top: 0; }
.btn { padding:10px 12px; border-radius:10px; cursor:pointer; border:1px solid transparent; font-weight:700; color:#1f2937; transition: all .2s ease; }
.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
.btn-primary { background: linear-gradient(90deg,#dbeafe,#fde68a); }
.btn-primary:hover { filter: brightness(0.97); transform: translateY(-1px); }
.btn-danger { background: linear-gradient(90deg,#fecaca,#fda4a4); }
.btn-danger:hover { filter: brightness(0.97); transform: translateY(-1px); }
.btn-ghost { background: rgba(255,255,255,0.85); color:#111827; border:1px solid #e5e7eb; }
.btn-ghost:hover { background:#fff; }
/* button sizes */
.btn.small { padding:8px 10px; border-radius:8px; font-weight:700; }
.btn.large { padding:12px 16px; border-radius:12px; font-weight:800; }

/* =====================
   Footer
===================== */
.footer { margin-top:30px; text-align:center; color: #64748b; padding:14px; }

/* =====================
   Responsive
===================== */
@media (max-width:900px){
  .main-wrap { margin-left:0; padding:16px; }
  .sidebar { position:relative; width:100%; height:auto; flex-direction:row; gap:12px; padding:10px; align-items:center; }
  .sidebar-nav { flex-direction:row; gap:8px; overflow:auto; }
  .sidebar-bottom { flex-direction:row; gap:8px; }
}

/* =====================
   Login Page
===================== */
.login-body { display:flex; align-items:center; justify-content:center; min-height:100vh; background: var(--surface-alt); }
.login-box { width:100%; max-width:420px; padding:20px; }
.login-logo { display:block; width:120px; height:auto; margin:0 auto 14px; border-radius:12px; box-shadow: var(--shadow); }
.login-logo-wrap { position: relative; width: 92px; margin: 0 auto 10px; }
.login-logo-wrap .login-logo { position: relative; z-index: 2; }
.login-thunder { position:absolute; right:-6px; top:-6px; font-size:22px; filter: drop-shadow(0 4px 10px rgba(251,191,36,0.5)); animation: bolt 1.4s ease-in-out infinite; }
@keyframes bolt { 0%, 100% { transform: translateY(0) scale(1); opacity: .8; } 50% { transform: translateY(-2px) scale(1.08); opacity: 1; } }
.login-box .card { padding:18px; }
.login-box input { width:100%; padding:10px 12px; border-radius:8px; border:1px solid #e5e7eb; margin:8px 0; font-family:'Poppins',sans-serif; }
.login-box input:focus { outline:none; box-shadow: 0 0 0 3px rgba(245,158,11,0.2); border-color:#f59e0b; }
.login-box .btn-primary { width:100%; }

/* =====================
   Poles Monitoring Alignment (scoped to Poles section only)
===================== */
#section-poles .grid-container .card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
}
#section-poles .card.graph { grid-column: 1 / -1; }

#current-values li,
#status-values li,
#tilt-values li,
#status-lights li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  font-weight: 600;
}
/* Prevent sticky header overlap for interactive elements */
.page-section .card #map { position: relative; z-index: 1; }
.topbar { z-index: 1000; }
/* =====================
   Pole Status Overview Alignment
===================== */
.status-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 10px;
}

.status-stat {
  flex: 1;
  text-align: center;
}

.status-stat .stat-value {
  font-size: 1.6rem;
  font-weight: 900;
  display: block;
  margin-bottom: 4px;
}

.status-stat .stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
}

/* --- Sidebar Toggle --- */
.menu-btn {
  font-size: 1.5rem;
  background: transparent;
  border: none;
  color: var(--accent-yellow);
  cursor: pointer;
  margin-right: 10px;
}

/* Sidebar collapse effect */
.sidebar {
  transition: width 0.3s ease, transform 0.3s ease;
}

.sidebar.collapsed {
  width: 72px;
  padding: 16px 10px;
  overflow-x: hidden;
}

/* Content expands when sidebar is collapsed */
.main-wrap {
  transition: margin-left 0.8s ease;
}
.sidebar.collapsed ~ .main-wrap {
  margin-left: 88px;
}

/* nav icon/text behavior */
.sidebar .nav-link { display:flex; align-items:center; gap:10px; }
.sidebar .nav-link i { width:20px; height:20px; }
.sidebar.collapsed .nav-text { display:none; }
.sidebar.collapsed .nav-link { justify-content:center; padding:10px; }
.sidebar.collapsed .sidebar-bottom .btn { justify-content:center; }

.pole-status-title{


  font-size: 1.6rem;

  font-weight: 900;

  display: block;

  margin-bottom: 4px;

}



.status-stat .stat-label {

  font-size: 0.9rem;

  color: rgba(255, 255, 255, 0.85);

}



/* --- Sidebar Toggle --- */

.menu-btn {

  font-size: 1.5rem;

  background: transparent;

  border: none;

  color: var(--accent-yellow);

  cursor: pointer;

  margin-right: 10px;

}



/* Sidebar collapse effect */

.sidebar {

  transition: width 0.4s ease, transform 0.4s ease;

}



.sidebar.collapsed {

  width: 0;

  padding: 0;

  overflow: hidden;

}



/* Content expands when sidebar is collapsed */

.main-wrap {

  transition: margin-left 0.8s ease;

}

.sidebar.collapsed ~ .main-wrap {

  margin-left: 0;

}


