:root {
  --primary-color: #dc2626; /* Red */
  --secondary-color: #b91c1c; /* Darker Red */
  --bg-dark: #f1f5f9; /* Light Gray */
  --bg-card: #ffffff; /* White */
  --text-main: #0f172a; /* Dark text */
  --text-muted: #64748b;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-blue: #3b82f6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
  color: var(--text-main);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 400px;
}

.dashboard-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

input, select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.3s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

/* Buttons */
.btn {
  display: inline-block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(220, 38, 38, 0.3);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--accent-green);
  color: #fff;
}

/* Header/Nav */
header {
  background: var(--bg-card);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-4 { gap: 1rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Badges */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-active { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.badge-inactive { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }

@media (max-width: 768px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   ULTIMATE MOBILE RESPONSIVENESS OVERRIDES
   ========================================= */
@media (max-width: 900px) {
  /* Layout: Switch from row (Sidebar + Main) to column (Top Nav + Main) */
  body > div[style*="display: flex"],
  .main-content {
    flex-direction: column !important;
  }
  
  /* Sidebar becomes a scrollable top navigation bar on mobile/tabs */
  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    max-height: 120px !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0.5rem !important;
    border-right: none !important;
    border-bottom: 2px solid rgba(0,0,0,0.1) !important;
    align-items: center !important;
    white-space: nowrap !important;
    z-index: 1000 !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Hide Brand in sidebar on mobile to save space */
  .sidebar-brand {
    display: none !important;
  }
  
  /* Sidebar Items sit side-by-side */
  .sidebar-item {
    margin-bottom: 0 !important;
    margin-right: 0.5rem !important;
    padding: 0.5rem 1rem !important;
    flex: 0 0 auto !important;
    font-size: 0.9rem !important;
    border-radius: 50px !important;
  }
  
  /* Header adjustments */
  header {
    flex-direction: column !important;
    gap: 15px !important;
    padding: 1rem !important;
    align-items: flex-start !important;
  }
  
  .header-right {
    width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  
  /* Content Area */
  .content-area {
    padding: 1rem !important;
  }
  
  /* Grid Layouts to 1 column */
  .grid, .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-5 {
    grid-template-columns: 1fr !important;
  }
  
  /* Dashboard Cards / flex containers */
  .dashboard-card {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  div[style*="display: flex"][style*="gap: 20px"],
  div[style*="display: flex"][style*="gap: 1rem"],
  div[style*="display: flex"][style*="gap:10px"],
  div[style*="display: flex"][style*="gap: 10px"] {
    flex-direction: column !important;
  }
  
  /* Table Responsiveness */
  .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    border-radius: 8px !important;
  }
  
  /* Force tables to not shrink below readable size */
  table {
    min-width: 600px !important; 
  }
  
  /* Modals */
  div[id$="Modal"] > div, .modal-content, div[style*="max-width: 500px"] {
    width: 95% !important;
    margin: 10px auto !important;
    padding: 1.5rem !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }
  
  /* Fix Google Translate widget alignment on mobile */
  #google_translate_element {
    margin-right: 0 !important;
    margin-top: 5px !important;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .brand {
    font-size: 1.2rem !important;
  }
  .btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
  }
  th, td {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.85rem !important;
  }
}

/* HIDE GOOGLE TRANSLATE UI */
.goog-te-gadget, .goog-te-banner-frame { display: none !important; }
body { top: 0 !important; }
.goog-text-highlight { background-color: transparent !important; box-shadow: none !important; }

/* Digital Meter Style */
.digital-meter { font-family: 'Courier New', Courier, monospace; background: #000000; color: #39ff14; padding: 0.25rem 0.75rem; border-radius: 4px; border: 2px solid #222; font-weight: bold; font-size: 1.25rem; letter-spacing: 2px; display: inline-block; box-shadow: inset 0 0 10px rgba(57, 255, 20, 0.1); text-shadow: 0 0 8px rgba(57, 255, 20, 0.8), 0 0 15px rgba(57, 255, 20, 0.4); min-width: 150px; text-align: right; }

