/* style.css - Modern, Premium Dark Glassmorphism Styling */

:root {
  /* Color Palette (Deep Bottle Green & Emerald/Gold Accents) */
  --bg-color: #08110b;
  --panel-bg: rgba(14, 33, 23, 0.65);
  --panel-bg-hover: rgba(20, 48, 33, 0.8);
  --border-color: rgba(46, 125, 80, 0.25);
  --border-focus: rgba(46, 125, 80, 0.6);
  
  --primary: #10b981; /* Emerald */
  --primary-hover: #059669;
  --secondary: #3b82f6; /* Soft Blue */
  --secondary-hover: #2563eb;
  --accent: #f59e0b; /* Amber/Gold */
  --accent-hover: #d97706;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-danger: #f87171;
  --text-success: #34d399;
  
  --glass-blur: 16px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.3), 0 4px 20px -5px rgba(0, 0, 0, 0.2);
}

/* Reset and Core Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(8, 17, 11, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.5);
}

/* Glowing Background Blobs */
.glow-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}
.blob-1 {
  width: 400px;
  height: 400px;
  background-color: var(--primary);
  top: 10%;
  left: 5%;
}
.blob-2 {
  width: 500px;
  height: 500px;
  background-color: var(--secondary);
  bottom: 10%;
  right: 5%;
}

/* Helper Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--text-success); }
.text-danger { color: var(--text-danger); }
.text-accent { color: var(--accent); }
.badge {
  padding: 4px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.15);
  color: var(--text-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge.danger {
  background: rgba(248, 113, 113, 0.15);
  color: var(--text-danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Glassmorphism Card styling */
.card {
  background: var(--panel-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 10px 40px -5px rgba(16, 185, 129, 0.1);
}

.glass-inset {
  background: rgba(4, 10, 6, 0.4);
  border: 1px solid rgba(46, 125, 80, 0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--secondary);
  color: #fff;
}
.btn-secondary:hover {
  background: var(--secondary-hover);
  transform: translateY(-1px);
}
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-danger {
  background: rgba(248, 113, 113, 0.2);
  color: var(--text-danger);
  border: 1px solid rgba(248, 113, 113, 0.4);
}
.btn-danger:hover {
  background: rgba(248, 113, 113, 0.35);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Login Layout */
#login-container {
  max-width: 420px;
  margin: 100px auto auto;
}
.brand {
  text-align: center;
  margin-bottom: 24px;
}
.brand-logo, .logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
  margin-bottom: 12px;
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(4, 10, 6, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s ease;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--border-focus);
}

.error-msg {
  color: var(--text-danger);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
}

/* Authenticated Workspace Layout */
#main-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background: rgba(8, 17, 11, 0.85);
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
}
.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.nav-menu {
  flex: 1;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.nav-item:hover, .nav-item.active {
  background: var(--panel-bg-hover);
  color: var(--text-main);
  border-left: 3px solid var(--primary);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}
#logged-user {
  font-weight: 600;
  color: var(--text-main);
  text-transform: capitalize;
}

/* Content Area */
.content-area {
  flex: 1;
  margin-left: 260px;
  padding: 40px;
  min-height: 100vh;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
.header-actions {
  display: flex;
  gap: 10px;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.kpi-card {
  background: rgba(14, 33, 23, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-card span {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi-card h3 {
  font-size: 1.8rem;
  color: var(--text-main);
}

/* Charts and Distribution Cards */
.charts-section {
  margin-bottom: 30px;
}
.chart-card {
  padding: 20px;
}
.chart-container {
  height: 350px;
  position: relative;
}

.distribution-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}
.dist-card {
  background: rgba(14, 33, 23, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}
.dist-card h4 {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.large-number {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
}

/* Tables */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
table th, table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(46, 125, 80, 0.15);
}
table th {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
table td {
  font-size: 0.9rem;
}
table tr:hover td {
  background: rgba(16, 185, 129, 0.03);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 17, 11, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text-main);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Responsive styles */
@media (max-width: 992px) {
  .sidebar {
    width: 70px;
  }
  .sidebar .logo-text, .sidebar #role-tag, .sidebar .nav-item span:not(.icon), .sidebar-footer {
    display: none;
  }
  .content-area {
    margin-left: 70px;
    padding: 24px;
  }
  .distribution-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .header-actions {
    width: 100%;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
