/* ============================================================
   ECOSHIELD - PROFESSIONAL STYLESHEET
   ============================================================ */

:root {
  --eco-primary:     #2e7d32;
  --eco-primary-dk:  #1b5e20;
  --eco-secondary:   #43a047;
  --eco-accent:      #f9a825;
  --eco-danger:      #c0392b;
  --eco-warning:     #f39c12;
  --eco-info:        #0288d1;
  --eco-dark:        #1a2e1c;
  --eco-sidebar:     off white;
  --eco-sidebar-lt:  off white;
  --eco-bg:          #f0f5f1;
  --eco-card:        #ffffff;
  --eco-border:      #d8e8da;
  --eco-text:        #1a2e1c;
  --eco-text-muted:  #5a7060;
  --eco-radius:      12px;
  --eco-radius-sm:   8px;
  --eco-shadow:      0 2px 16px rgba(21,87,36,.08);
  --eco-shadow-lg:   0 8px 40px rgba(21,87,36,.16);
  --sidebar-w:       260px;
  --topbar-h:        64px;
  --transition:      all .22s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--eco-bg);
  color: var(--eco-text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; transition: var(--transition); }
img { max-width: 100%; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--eco-bg);
}

.auth-left {
  flex: 0 0 45%;
  background: linear-gradient(145deg, var(--eco-sidebar) 0%, var(--eco-primary) 60%, var(--eco-secondary) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 50px;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-brand { position: relative; text-align: center; color: #fff; }
.auth-brand .brand-logo {
  width: 80px; height: 80px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
}
.auth-brand h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.auth-brand p  { font-size: 14px; opacity: .7; margin-top: 8px; }

.auth-features { position: relative; margin-top: 50px; width: 100%; }
.auth-feature-item {
  display: flex; align-items: center; gap: 14px;
  color: rgba(255,255,255,.85);
  margin-bottom: 18px;
}
.auth-feature-item .feat-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  background: rgba(255,255,255,.12);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.auth-feature-item .feat-text { font-size: 13px; }
.auth-feature-item .feat-text strong { display: block; font-size: 14px; color: #fff; }

.auth-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 40px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
}

.auth-card .auth-title {
  font-size: 26px; font-weight: 700;
  color: var(--eco-primary);
  margin-bottom: 6px;
}
.auth-card .auth-sub { color: var(--eco-text-muted); margin-bottom: 32px; }

.form-control, .form-select {
  border: 1.5px solid var(--eco-border);
  border-radius: var(--eco-radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  transition: var(--transition);
  background: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--eco-primary);
  box-shadow: 0 0 0 3px rgba(21,87,36,.12);
}

.input-group .input-group-text {
  border: 1.5px solid var(--eco-border);
  background: #f8fafc;
  color: var(--eco-text-muted);
}
.input-group .form-control { border-left: none; }

.btn-primary {
  background: var(--eco-primary);
  border-color: var(--eco-primary);
  border-radius: var(--eco-radius-sm);
  font-weight: 600;
  padding: 10px 22px;
  transition: var(--transition);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--eco-primary-dk);
  border-color: var(--eco-primary-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(21,87,36,.25);
}

.btn-success {
  background: var(--eco-secondary);
  border-color: var(--eco-secondary);
  border-radius: var(--eco-radius-sm);
  font-weight: 600;
}

.btn-outline-primary {
  color: var(--eco-primary);
  border-color: var(--eco-primary);
  border-radius: var(--eco-radius-sm);
  font-weight: 600;
}
.btn-outline-primary:hover {
  background: var(--eco-primary);
  border-color: var(--eco-primary);
}

/* ============================================================
   LAYOUT - DASHBOARD
   ============================================================ */
.dash-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--eco-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-brand {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand .brand-ico {
  width: 42px; height: 42px;
  background: var(--eco-primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; flex-shrink: 0;
}
.sidebar-brand .brand-name {
  font-size: 17px; font-weight: 700; color: black;
  line-height: 1.2;
}
.sidebar-brand .brand-role {
  font-size: 11px; color: rgba(255,255,255,.45);
  text-transform: uppercase; letter-spacing: 1px;
}

.sidebar-user {
  padding: 16px 22px;
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-user .user-av {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--eco-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.sidebar-user .user-info { overflow: hidden; }
.sidebar-user .user-name { color: black; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { color: green; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }

.sidebar-nav { flex: 1; padding: 14px 0; }

.nav-section-label {
  padding: 10px 22px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: green;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 22px;
  color: black;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: var(--transition);
  position: relative;
}
.sidebar-nav a i { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-nav a:hover {
  background: #0d2b14;
  color: #fff;
  border-left-color: rgba(255,255,255,.3);
  border-radius: 5px solid #0d2b14;
}
.sidebar-nav a.active {
  background: green;
  color: white;
  border-left-color: var(--eco-accent);
  font-weight: 600;
}
.sidebar-nav a .badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
}

.sidebar-bottom {
  padding: 14px 0;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--eco-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .page-title { font-size: 17px; font-weight: 700; color: var(--eco-text); flex: 1; }
.topbar .page-breadcrumb { font-size: 12px; color: var(--eco-text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  border: 1.5px solid var(--eco-border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--eco-text-muted);
  background: #fff;
  transition: var(--transition);
  text-decoration: none;
}
.notif-btn:hover { border-color: var(--eco-primary); color: var(--eco-primary); }
.notif-btn .badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.user-menu-btn {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--eco-border);
  border-radius: 10px;
  padding: 5px 12px 5px 6px;
  cursor: pointer;
  background: #fff;
  transition: var(--transition);
  color: var(--eco-text);
}
.user-menu-btn:hover { border-color: var(--eco-primary); }
.user-menu-btn .av {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--eco-primary); color: #fff;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.user-menu-btn .name { font-size: 13px; font-weight: 600; }

/* ---- Page Body ---- */
.page-body { padding: 24px; flex: 1; }

/* ============================================================
   CARDS & STATS
   ============================================================ */
.card {
  background: var(--eco-card);
  border: 1px solid var(--eco-border);
  border-radius: var(--eco-radius);
  box-shadow: var(--eco-shadow);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--eco-border);
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
}
.card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
  border-radius: var(--eco-radius);
  padding: 22px;
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--eco-card);
  border: 1px solid var(--eco-border);
  box-shadow: var(--eco-shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--eco-primary));
  border-radius: 0 0 2px 2px;
}
.stat-card:hover { box-shadow: var(--eco-shadow-lg); transform: translateY(-2px); }
.stat-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: var(--stat-bg, #e8f4fd);
  color: var(--stat-color, var(--eco-primary));
}
.stat-info .stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-info .stat-label { font-size: 12.5px; color: var(--eco-text-muted); margin-top: 4px; font-weight: 500; }
.stat-info .stat-sub   { font-size: 12px; color: var(--eco-text-muted); margin-top: 6px; }
.stat-info .stat-sub .up   { color: var(--eco-secondary); font-weight: 600; }
.stat-info .stat-sub .down { color: var(--eco-danger); font-weight: 600; }

/* ============================================================
   TABLES
   ============================================================ */
.table-card { background: var(--eco-card); border-radius: var(--eco-radius); border: 1px solid var(--eco-border); box-shadow: var(--eco-shadow); overflow: hidden; }
.table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--eco-border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.table-card-header h5 { font-size: 15px; font-weight: 700; margin: 0; }

.table { margin: 0; font-size: 13.5px; }
.table thead th {
  background: #f8fafc;
  border-top: none;
  border-bottom: 2px solid var(--eco-border);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--eco-text-muted);
  padding: 12px 16px;
  white-space: nowrap;
}
.table tbody td { padding: 13px 16px; vertical-align: middle; border-color: #f1f5f9; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; letter-spacing: .2px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-label { font-weight: 600; font-size: 13px; color: var(--eco-text); margin-bottom: 5px; }
.form-section { background: #f8fafc; border-radius: var(--eco-radius-sm); padding: 20px; margin-bottom: 20px; border: 1px solid var(--eco-border); }
.form-section-title { font-weight: 700; font-size: 14px; color: var(--eco-primary); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { border-radius: var(--eco-radius-sm); border: none; font-size: 13.5px; }
.alert-success { background: #d4edda; color: #155724; }
.alert-danger  { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info    { background: #d1ecf1; color: #0c5460; }

/* ============================================================
   EMERGENCY BADGE
   ============================================================ */
.emergency-pulse {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fef2f2; border: 1.5px solid #fca5a5;
  color: #dc2626; border-radius: 20px; padding: 4px 12px;
  font-size: 12px; font-weight: 700; animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); }
  50%      { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}

/* ============================================================
   ZONE CARDS
   ============================================================ */
.zone-card {
  border-radius: var(--eco-radius);
  border: 1.5px solid var(--eco-border);
  padding: 18px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.zone-card .zone-badge {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900;
}
.zone-card.zone-a { border-color: #86efac; }
.zone-card.zone-a .zone-badge { background: #dcfce7; color: #16a34a; }
.zone-card.zone-b { border-color: #fcd34d; }
.zone-card.zone-b .zone-badge { background: #fef3c7; color: #d97706; }
.zone-card.zone-c { border-color: #fca5a5; }
.zone-card.zone-c .zone-badge { background: #fee2e2; color: #dc2626; }
.zone-card.zone-d { border-color: #a78bfa; }
.zone-card.zone-d .zone-badge { background: #ede9fe; color: #7c3aed; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container { position: relative; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--eco-text-muted); }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress { border-radius: 20px; background: #f0f4f8; }
.progress-bar { border-radius: 20px; }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--eco-border); }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute; left: -20px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%; background: var(--eco-primary);
  border: 2px solid #fff;
}
.timeline-item .tl-time { font-size: 11px; color: var(--eco-text-muted); }
.timeline-item .tl-content { font-size: 13px; margin-top: 2px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.sidebar-toggle {
  display: none;
  width: 38px; height: 38px;
  border: 1.5px solid var(--eco-border);
  border-radius: 8px;
  background: #fff;
  align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px;
}

@media (max-width: 992px) {
  .sidebar {
    left: calc(-1 * var(--sidebar-w));
    transition: left .3s ease;
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 30px rgba(0,0,0,.25);
  }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .auth-left { display: none; }
  .auth-right { padding: 40px 24px; }
  .stat-card { padding: 16px; }
  .stat-info .stat-value { font-size: 22px; }
}

@media (max-width: 576px) {
  .page-body { padding: 16px; }
  .topbar { padding: 0 16px; }
  .table-responsive { overflow-x: auto; }
}

/* ============================================================
   OVERLAY (mobile sidebar)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   PAYMENT / INVOICE CARDS
   ============================================================ */
.invoice-card {
  border: 1px solid var(--eco-border);
  border-radius: var(--eco-radius);
  padding: 20px;
  background: var(--eco-card);
}
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.invoice-logo { font-size: 22px; font-weight: 800; color: var(--eco-primary); }
.invoice-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.invoice-totals td { padding: 6px 16px; }
.invoice-total-row { font-size: 16px; font-weight: 700; }

/* ============================================================
   HARDWARE STATUS CARD
   ============================================================ */
.hw-card {
  border: 1px solid var(--eco-border);
  border-radius: var(--eco-radius);
  padding: 18px;
  background: var(--eco-card);
  transition: var(--transition);
}
.hw-card:hover { box-shadow: var(--eco-shadow-lg); }
.hw-status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; margin-right: 5px;
}
.hw-status-dot.active   { background: #16a34a; animation: pulse 2.5s infinite; }
.hw-status-dot.inactive { background: #9ca3af; }
.hw-status-dot.faulty   { background: #dc2626; animation: pulse 1.5s infinite; }
.hw-status-dot.maintenance { background: #d97706; }

/* ============================================================
   DARK SIDEBAR DROPDOWN
   ============================================================ */
.has-submenu > a::after {
  content: '\F282';
  font-family: 'bootstrap-icons';
  margin-left: auto;
  transition: transform .2s;
  font-size: 12px;
}
.has-submenu.open > a::after { transform: rotate(90deg); }
.submenu { display: none; background: rgba(0,0,0,.15); }
.submenu.show { display: block; }
.submenu a { padding-left: 54px !important; font-size: 13px; }

/* ============================================================
   MISC
   ============================================================ */
.divider { height: 1px; background: var(--eco-border); margin: 16px 0; }
.text-eco { color: var(--eco-primary); }
.bg-eco   { background: var(--eco-primary); color: #fff; }
.rounded-eco { border-radius: var(--eco-radius); }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.page-header h2 { font-size: 22px; font-weight: 800; color: var(--eco-text); margin: 0; }
.page-header p  { color: var(--eco-text-muted); font-size: 13px; margin: 0; }

.filter-bar {
  background: var(--eco-card);
  border: 1px solid var(--eco-border);
  border-radius: var(--eco-radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--eco-text-muted);
}
.empty-state i { font-size: 56px; opacity: .25; display: block; margin-bottom: 16px; }
.empty-state h5 { font-size: 16px; font-weight: 600; color: var(--eco-text); margin-bottom: 6px; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card, .table-card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
