/* ==========================================================
   RBE Utilities Unified Styling â€” Billing & Dashboard
   Version: 2.0 â€” RBE Utilities
   ========================================================== */

/* ------------------ Root Theme ------------------ */
:root {
  --bg: linear-gradient(180deg, #041622 0%, #071b2c 100%);
  --bg-light: #0a1e2d;
  --card: #0e2538;
  --card-grad: linear-gradient(180deg, #0d2538 0%, #091b2a 100%);
  --accent: #7ed957;
  --accent2: #00ccff;
  --text: #e6f5ff;
  --muted: #b5cbe0;
  --danger: #ff5b5b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --glow: 0 0 18px rgba(0, 204, 255, 0.20);
  --transition: 0.25s ease;
  --font-main: 'Inter', 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ------------------ Global Layout ------------------ */
body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--muted);
  min-height: 100vh;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1, h2, h3 {
  color: var(--text);
  margin-top: 0;
  font-weight: 700;
  letter-spacing: 0.3px;
}
h2 { font-size: 22px; margin-bottom: 14px; color: var(--accent2); }
h3 { font-size: 18px; color: var(--accent); margin-bottom: 10px; }

p { color: var(--muted); line-height: 1.6; }

a {
  color: var(--accent2);
  text-decoration: none;
  transition: var(--transition);
}
a:hover { color: var(--accent); }

/* ------------------ Navbar ------------------ */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1100px;
  padding: 18px 28px;
  background: linear-gradient(90deg, rgba(6,34,53,0.9), rgba(8,49,77,0.9));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 30px;
}
.navbar h1 {
  font-size: 18px;
  color: var(--accent2);
  font-weight: 600;
}
.navbar button {
  font-size: 14px;
  padding: 8px 14px;
  background: linear-gradient(90deg, #7ed957, #00ccff);
  border-radius: 30px;
  font-weight: 600;
  color: #0a1b25;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.navbar button:hover { transform: translateY(-2px); box-shadow: 0 0 18px rgba(0,204,255,0.35); }

/* ------------------ Tabs ------------------ */
.tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin: 10px auto 25px auto;
}
.tab {
  padding: 10px 18px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  border-radius: 30px;
  transition: var(--transition);
  position: relative;
}
.tab:hover { color: var(--accent2); background: rgba(0,255,255,0.08); box-shadow: var(--glow); }
.tab.active {
  color: var(--accent);
  background: rgba(0,255,255,0.08);
  border: 1px solid rgba(0,204,255,0.25);
  box-shadow: 0 0 18px rgba(0,204,255,0.25);
  transform: translateY(-1px);
  transition: all 0.3s ease-in-out;
}
.tab.active::after {
  content: "";
  position: absolute;
  left: 10%; right: 10%; bottom: -8px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7ed957, #00ccff);
  box-shadow: 0 0 18px rgba(126,217,87,0.35);
}

/* ------------------ Cards ------------------ */
.card {
  background: var(--card-grad);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin: 0 auto 25px auto;
  max-width: 1100px;
  transition: var(--transition);
  border: 1px solid rgba(255,255,255,0.04);
}
.card:hover { box-shadow: 0 0 20px rgba(0,255,255,0.18); transform: translateY(-2px); }
.card h2 { color: var(--accent2); margin-bottom: 16px; font-weight: 700; }

/* ------------------ Inputs ------------------ */
label {
  display: block;
  color: var(--accent2);
  margin: 10px 0 5px;
}
input, select {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid rgba(126,217,87,0.25);
  background: #0b2234;
  color: var(--text);
  font-size: 15px;
  transition: var(--transition);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 5px rgba(126,217,87,0.4);
}

/* ------------------ Buttons ------------------ */
button, .btn {
  display: inline-block;
  background: linear-gradient(90deg, #7ed957, #00ccff);
  color: #0a1b25;
  font-weight: 600;
  border: none;
  border-radius: 30px;
  padding: 10px 24px;
  cursor: pointer;
  transition: var(--transition);
}
button:hover, .btn:hover { transform: translateY(-2px); box-shadow: 0 0 18px rgba(0,204,255,0.35); }
.btn.secondary {
  background: transparent;
  color: var(--accent2);
  border: 1px solid rgba(0,204,255,0.6);
}
.btn.secondary:hover { background: rgba(0,255,255,0.08); box-shadow: var(--glow); }

/* CTA pulse */
.btn.cta { animation: pulseGlow 2.6s ease-in-out infinite; }

/* ------------------ Tables ------------------ */
table {
  width: 100%;
  border-collapse: collapse;
  background: #0b1f33;
  color: #fff;
  margin-top: 12px;
  font-size: 0.95em;
}
th, td {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
th {
  background: #1b3a4d;
  color: var(--accent);
  font-weight: 600;
}
tr:nth-child(even) { background: rgba(255,255,255,0.03); }

/* ------------------ Fee Lists ------------------ */
.fee-list {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}
.fee-item {
  background: #0b1f30;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  border: 1px solid rgba(126,217,87,0.15);
  transition: 0.2s;
}
.fee-item:hover { box-shadow: 0 0 14px rgba(0,255,255,0.18); transform: translateY(-1px); }
.fee-item strong { color: var(--accent); font-size: 15px; }
.fee-item span.type { color: var(--accent2); font-weight: 600; }

/* Rate pill for tier values */
.rate-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 0 12px rgba(0,204,255,0.18);
}

/* Utility color accents */
.util-electricity .tier-badge, .util-electricity .rate-pill { box-shadow: 0 0 12px rgba(0,204,255,0.25); border-color: rgba(0,204,255,0.35); color: #9be8ff; }
.util-water .tier-badge, .util-water .rate-pill { box-shadow: 0 0 12px rgba(0,132,255,0.22); border-color: rgba(0,132,255,0.35); color: #a9d1ff; }
.util-generator .tier-badge, .util-generator .rate-pill { box-shadow: 0 0 12px rgba(255,153,51,0.22); border-color: rgba(255,153,51,0.35); color: #ffd0a6; }
.util-solar .tier-badge, .util-solar .rate-pill { box-shadow: 0 0 12px rgba(126,217,87,0.28); border-color: rgba(126,217,87,0.35); color: #c9f5b8; }

/* Capsule filters */
.tier-filter { border: 1px solid rgba(255,255,255,0.06); }
.tier-filter.active { box-shadow: 0 0 10px rgba(126,217,87,0.25), 0 0 10px rgba(0,204,255,0.2) inset; }

/* Navbar ambient shadow */
.navbar { box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 18px rgba(0,204,255,0.08) inset; }

/* ------------------ Tier List & Rows ------------------ */
.tier-list { display: grid; gap: 14px; }
.tier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #0b1f30;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: var(--transition);
}
.tier-row:hover { box-shadow: 0 0 16px rgba(0,204,255,0.22); }
.tier-row .left { display: flex; align-items: center; gap: 12px; }
.tier-actions { display:flex; gap:6px; align-items:center; }
.edit-btn { background:none; border:none; color: var(--accent2); cursor:pointer; font-size:16px; transition: var(--transition); }
.edit-btn:hover { color: var(--accent); transform: scale(1.1); }

.tier-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(126,217,87,0.12);
  color: var(--accent);
  border: 1px solid rgba(126,217,87,0.25);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.tier-range { color: var(--muted); font-size: 14px; }
.tier-rate { color: var(--accent2); font-weight: 700; }

/* ------------------ Delete Button ------------------ */
.delete-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
}
.delete-btn:hover { color: #ff8888; transform: scale(1.05); }

/* ------------------ Modal ------------------ */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.modal-content {
  background: #10283f;
  border-radius: 16px;
  padding: 24px;
  color: var(--text);
  max-width: 700px;
  margin: auto;
  box-shadow: 0 0 24px rgba(0,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.06);
}
.modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.modal-body { display:grid; gap:12px; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); }
.close {
  float: right;
  cursor: pointer;
  color: var(--accent);
  font-size: 22px;
}

/* ------------------ Utilities ------------------ */
.status {
  margin: 10px 0;
  font-weight: 600;
  color: var(--accent);
}
.section {
  display: none;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}
.section.active { display: block; animation: fadeIn 0.25s ease; }

/* ------------------ Animations ------------------ */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(0,204,255,0); }
  50% { box-shadow: 0 0 18px rgba(0,204,255,0.35); }
}

/* ------------------ Responsive ------------------ */
@media (max-width: 768px) {
  body { padding: 20px; }
  .navbar { flex-direction: column; gap: 10px; padding: 14px 18px; }
  .card { padding: 20px; }
  .tab { padding: 8px 12px; font-size: 14px; }
  label { font-size: 14px; }
  input, select { font-size: 14px; }
  button, .btn { padding: 8px 16px; }
  .tier-row { flex-wrap: wrap; gap: 8px; }
}

/* Card min-heights for utility groups */
#tierList .card { min-height: 120px; }
.util-generator.card, .util-solar.card { min-height: 140px; }

.tier-actions { display:flex; gap:6px; align-items:center; }
.edit-btn { background:none; border:none; color: var(--accent2); cursor:pointer; font-size:16px; transition: var(--transition); }
.edit-btn:hover { color: var(--accent); transform: scale(1.1); }

