/* GridPoint Energy - Utility Company Styles */

:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --primary-dark: #0e3a54;
  --accent: #27ae60;
  --accent-light: #2ecc71;
  --gray-50: #f8f9fa;
  --gray-100: #ecf0f1;
  --gray-200: #dce1e3;
  --gray-300: #bdc3c7;
  --gray-400: #95a5a6;
  --gray-500: #7f8c8d;
  --gray-700: #4a4a4a;
  --gray-800: #2c3e50;
  --danger: #e74c3c;
  --warning: #f39c12;
  --white: #ffffff;
  --sidebar-width: 240px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}

a {
  color: var(--primary-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== LOGIN PAGE ===== */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  margin: 20px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-logo h1 {
  font-size: 24px;
  color: var(--primary);
  font-weight: 700;
}

.login-logo p {
  color: var(--gray-500);
  font-size: 14px;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-accent {
  background: var(--accent);
  color: var(--white);
}

.btn-accent:hover {
  background: #219a52;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-light);
  color: var(--primary-light);
}

.btn-outline:hover {
  background: var(--primary-light);
  color: var(--white);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.login-error {
  background: #fdecea;
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}

/* ===== APP LAYOUT ===== */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary-dark);
  color: var(--white);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}

.sidebar-logo .logo-icon {
  color: var(--accent-light);
  margin-right: 6px;
}

.sidebar-logo p {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--gray-300);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border-left: 3px solid var(--accent-light);
}

.sidebar-nav a .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-400);
  font-size: 14px;
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: var(--white);
  text-decoration: none;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 0;
}

.topbar {
  background: var(--white);
  padding: 16px 32px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  font-size: 20px;
  color: var(--gray-800);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-500);
  font-size: 14px;
}

.topbar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.content-area {
  padding: 32px;
}

/* ===== CARDS & STATS ===== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--gray-100);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-800);
  margin-top: 8px;
}

.stat-card .stat-sub {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 4px;
}

.stat-card.accent .stat-value {
  color: var(--accent);
}

.stat-card.warning .stat-value {
  color: var(--warning);
}

.card {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid var(--gray-100);
  margin-bottom: 24px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: 24px;
}

/* ===== TABLES ===== */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
}

tbody td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
}

tbody tr:hover {
  background: var(--gray-50);
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.paid {
  background: #e8f8f0;
  color: var(--accent);
}

.status-badge.due {
  background: #fef3e2;
  color: var(--warning);
}

.status-badge.overdue {
  background: #fdecea;
  color: var(--danger);
}

.status-badge.active {
  background: #e8f8f0;
  color: var(--accent);
}

/* ===== DETAIL SECTIONS ===== */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 14px;
  color: var(--gray-500);
  font-weight: 500;
}

.detail-value {
  font-size: 14px;
  color: var(--gray-800);
  font-weight: 600;
}

/* ===== INVOICE DETAIL ===== */

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--gray-200);
}

.invoice-company h2 {
  font-size: 22px;
  color: var(--primary);
}

.invoice-company p {
  color: var(--gray-500);
  font-size: 13px;
}

.invoice-meta {
  text-align: right;
}

.invoice-meta h3 {
  font-size: 24px;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.invoice-meta p {
  font-size: 13px;
  color: var(--gray-500);
}

.invoice-addresses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.invoice-addresses h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.invoice-addresses p {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.7;
}

.line-items table {
  margin-bottom: 24px;
}

.line-items thead th {
  background: var(--primary);
  color: var(--white);
  padding: 12px 16px;
}

.line-items thead th:first-child {
  border-radius: 6px 0 0 0;
}

.line-items thead th:last-child {
  border-radius: 0 6px 0 0;
  text-align: right;
}

.line-items tbody td:last-child {
  text-align: right;
  font-weight: 600;
}

.invoice-totals {
  display: flex;
  justify-content: flex-end;
}

.invoice-totals table {
  width: 300px;
}

.invoice-totals td {
  padding: 10px 16px;
}

.invoice-totals td:last-child {
  text-align: right;
  font-weight: 600;
}

.invoice-totals tr.total-row {
  border-top: 2px solid var(--gray-800);
}

.invoice-totals tr.total-row td {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  padding-top: 14px;
}

/* Usage bar chart */
.usage-chart {
  margin: 24px 0;
}

.usage-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 160px;
  padding: 0 8px;
}

.usage-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.usage-bar {
  width: 100%;
  max-width: 60px;
  background: var(--primary-light);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s;
  position: relative;
}

.usage-bar.current {
  background: var(--accent);
}

.usage-bar-label {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 8px;
  text-align: center;
}

.usage-bar-value {
  font-size: 11px;
  color: var(--gray-700);
  font-weight: 600;
  margin-bottom: 4px;
}

/* ===== NOTIFICATION PREFS ===== */

.pref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

.pref-item:last-child {
  border-bottom: none;
}

.pref-label {
  font-size: 14px;
  color: var(--gray-700);
}

.pref-status {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.pref-status.on {
  background: #e8f8f0;
  color: var(--accent);
}

.pref-status.off {
  background: var(--gray-100);
  color: var(--gray-400);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .invoice-header {
    flex-direction: column;
    gap: 16px;
  }

  .invoice-meta {
    text-align: left;
  }

  .invoice-addresses {
    grid-template-columns: 1fr;
  }

  .content-area {
    padding: 16px;
  }

  .topbar {
    padding: 12px 16px;
  }
}
