/* ============================================================
   Enterprise E-Waste Tracking Dashboard — Stylesheet
   Clean Professional Enterprise Light Theme with Left Sidebar Navigation
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #f4f7f6;        /* Subtle warm off-white */
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --border-subtle: #e2e8e4;    /* Softer green-tinted border */
  --border-focus: #059669;     /* Emerald Green */
  
  --text-primary: #1c2826;      /* Deep Charcoal instead of harsh black */
  --text-secondary: #475551;    /* Slate with green tint */
  --text-muted: #64748b;       
  --text-light: #94a3b8;       

  --primary-color: #065f46;    /* Deep Forest Green */
  --primary-light: #10b981;    /* Premium Emerald Green */
  --accent-color: #059669;     /* Solid Emerald */
  --success-color: #10b981;
  --warning-color: #f59e0b;    
  --danger-color: #e11d48;     /* Rose instead of harsh red */
  --info-color: #0891b2;       /* Cyan */

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px rgba(6, 95, 70, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 24px -4px rgba(6, 95, 70, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
  
  --shadow-glow: 0 4px 14px 0 rgba(16, 185, 129, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden; /* Main app will scroll */
}

/* ---- Scrollbars ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   GRID LAYOUT
   ============================================================ */

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ======== SIDEBAR STYLING ======== */
.app-sidebar {
  width: 280px;
  background: rgba(5, 150, 105, 0.8); /* Deeper green */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #000000;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(5, 150, 105, 0.2);
  flex-shrink: 0;
  z-index: 10;
  transition: width 0.3s ease;
}

@media (min-width: 1025px) {
  .app-sidebar.collapsed {
    width: 76px;
  }
  .app-sidebar.collapsed .brand-info,
  .app-sidebar.collapsed .nav-label,
  .app-sidebar.collapsed .promo-text {
    display: none;
  }
  .app-sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 24px 0;
  }
  .app-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
  }
}

.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  font-size: 28px;
  background: rgba(255, 255, 255, 0.3);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: none;
  cursor: pointer;
  color: #000000;
}

.sidebar-promo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 10px;
}

#btnLogout {
  justify-content: center;
  width: 100%;
  margin-top: 16px;
}

.sidebar-logo svg {
  width: 24px;
  height: 24px;
  display: block;
}

.brand-info h3 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #000000;
  white-space: nowrap;
}

.brand-info span {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1; /* Allow navigation to fill remaining space */
  overflow-y: auto; /* Enable scrollbar if screen is too small */
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: none;
  border: none;
  color: #000000;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #000000;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.4);
  color: #000000;
  font-weight: 800;
  box-shadow: inset 4px 0 0 0 #000000;
}

.btn-logout {
  color: #ffffff; /* White text */
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 16px;
  height: 16px;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.05);
}

/* ======== SIDEBAR ANIMATION PROMO WIDGET ======== */
.sidebar-promo {
  padding: 14px 18px;
  margin: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: auto; /* Push to bottom */
}

.promo-graphic {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.animated-sustainability-svg {
  width: 100%;
  height: 100%;
}

.promo-text h4 {
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.promo-text p {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.35;
}

/* Keyframe SVG Animations */
.rotating-arrows {
  transform-origin: 100px 100px;
  animation: spin-clockwise 20s linear infinite;
}

.spinning-gear {
  transform-origin: 100px 100px;
  animation: spin-counter 30s linear infinite;
}

.swaying-leaf {
  transform-origin: 100px 135px;
  animation: sway-leaf 5s ease-in-out infinite alternate;
}

.glow-ring {
  animation: pulse-glow 3s ease-in-out infinite alternate;
}

.floating-particle-1 {
  animation: float-up-1 7s ease-in-out infinite;
}

.floating-particle-2 {
  animation: float-up-2 9s ease-in-out infinite;
}

@keyframes spin-clockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spin-counter {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes sway-leaf {
  0% { transform: rotate(-6deg); }
  100% { transform: rotate(6deg); }
}

@keyframes pulse-glow {
  0% { opacity: 0.2; stroke-width: 1px; }
  100% { opacity: 0.7; stroke-width: 2px; }
}

@keyframes float-up-1 {
  0% { transform: translate(0, 0) scale(0.8); opacity: 0; }
  15% { opacity: 0.7; }
  85% { opacity: 0.7; }
  100% { transform: translate(-15px, -45px) scale(1); opacity: 0; }
}

@keyframes float-up-2 {
  0% { transform: translate(0, 0) scale(0.8); opacity: 0; }
  20% { opacity: 0.8; }
  80% { opacity: 0.8; }
  100% { transform: translate(20px, -55px) scale(1); opacity: 0; }
}

/* ======== MAIN VIEW AREA ======== */
.app-main {
  flex-grow: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

/* Mobile Header (Hidden by default on desktop) */
.mobile-header {
  display: none;
  height: 60px;
  background-color: var(--primary-color);
  color: white;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.mobile-brand {
  display: flex;
  align-items: center;
}
.mobile-brand h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

/* ---- Header ---- */
.app-header {
  background: linear-gradient(to right, #ffffff, #f8fafc);
  border: none;
  border-left: 5px solid var(--accent-color);
  color: var(--text-primary);
  padding: 24px 30px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.header-container {
  display: flex;
  align-items: center;
}

.app-header__title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: -0.5px;
  margin: 0;
}

.app-header__subtitle {
  display: none;
}

/* ---- Tab Panel Toggle ---- */
.tab-panel {
  display: none;
  flex-grow: 1;
}

.tab-panel.active {
  display: block;
}

/* ---- Section Title ---- */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg {
  vertical-align: middle;
}

.section-title__icon {
  color: var(--primary-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   DATA MANAGEMENT PANEL
   ============================================================ */

.management-section {
  margin-bottom: 24px;
}

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

.management-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.card-subtitle {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ---- Upload Dropzone ---- */
.upload-dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  background: var(--bg-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-grow: 1;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--border-focus);
  background: rgba(59, 130, 246, 0.02);
}

.upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.upload-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.file-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  background: var(--border-subtle);
  padding: 2px 8px;
  border-radius: 4px;
}

.sample-info {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 10px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.sample-info code {
  color: #c2410c;
  background: rgba(0, 0, 0, 0.03);
  padding: 1px 3px;
  border-radius: 3px;
}

/* ---- Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group select {
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text-primary);
  outline: none;
  background-color: #ffffff;
  transition: border-color var(--transition-fast);
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--border-focus);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #34d399 0%, var(--primary-color) 100%);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-inline {
  background: none;
  color: var(--primary-light);
  border: none;
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
  cursor: pointer;
  display: inline;
}

.btn-inline:hover {
  color: var(--primary-color);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

/* ============================================================
   SUMMARY CARDS
   ============================================================ */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); /* More rounded */
  padding: 20px; /* Slightly more padding */
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.summary-card--primary::before { background: var(--primary-light); }
.summary-card--secondary::before { background: var(--text-muted); }
.summary-card--success::before { background: var(--success-color); }
.summary-card--warning::before { background: var(--warning-color); }
.summary-card--info::before { background: var(--info-color); }

.summary-card:hover {
  transform: translateY(-4px); /* Lift higher */
  box-shadow: var(--shadow-md);
  border-color: rgba(16, 185, 129, 0.3); /* Subtle green border glow */
}

.summary-card__icon {
  display: inline-flex;
  align-items: center;
  margin-bottom: 2px;
}

.summary-card__label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-card__value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.summary-card__sub {
  font-size: 0.72rem;
  color: var(--text-light);
}

/* ============================================================
   CHARTS GRID
   ============================================================ */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  min-height: 310px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-card canvas {
  width: 100% !important;
  max-height: 280px;
}

.chart-card--wide {
  grid-column: 1 / -1;
}

/* ============================================================
   FILTERS
   ============================================================ */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.filter-bar__search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.filter-bar__search {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.filter-bar__search:focus {
  border-color: var(--border-focus);
}

.filter-bar__search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-bar__select {
  padding: 8px 30px 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.filter-bar__select:focus {
  border-color: var(--border-focus);
}

/* ============================================================
   INVENTORY TABLE
   ============================================================ */

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-scroll {
  overflow-x: auto;
  max-height: 440px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.data-table thead {
  background: #ecfdf5; /* Subtle emerald tint */
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  padding: 10px 12px;
  font-weight: 700; /* Bolder header */
  color: var(--primary-color);
  border-bottom: 2px solid var(--border-subtle); /* Thicker border for header */
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover {
  background: #d1fae5;
}

.data-table th .sort-icon {
  margin-left: 4px;
  color: var(--text-light);
  font-size: 0.72rem;
}

.data-table th.sorted .sort-icon {
  color: var(--primary-light);
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: #f4f7f6; /* Matching global bg */
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge--reuse { background: #d1fae5; color: #065f46; }
.badge--repair { background: #dbeafe; color: #1e40af; }
.badge--recycle { background: #fef3c7; color: #92400e; }
.badge--dispose { background: #fee2e2; color: #991b1b; }

.badge--good { background: #d1fae5; color: #065f46; }
.badge--fair { background: #dbeafe; color: #1e40af; }
.badge--poor { background: #fef3c7; color: #92400e; }
.badge--hazardous { background: #fee2e2; color: #991b1b; }

.table-footer {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border-subtle);
  background: #f8fafc;
}

/* ============================================================
   IMPACT CARDS
   ============================================================ */

.impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.impact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.impact-card__title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 6px;
  display: flex;
  align-items: center;
}

.impact-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.8rem;
}

.impact-card__label {
  color: var(--text-muted);
}

.impact-card__value {
  font-weight: 600;
  color: var(--text-primary);
}

.impact-card__value--green { color: var(--success-color); }
.impact-card__value--red { color: var(--danger-color); }

.saving-highlight {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-top: 12px;
  text-align: center;
}

.saving-highlight__value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #15803d;
}

.saving-highlight__label {
  font-size: 0.7rem;
  color: #166534;
  font-weight: 500;
}

/* ============================================================
   FORMULAS & RULES
   ============================================================ */

.formulas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.formula-card__title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.formula-card__equation {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
  background: #f1f5f9;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.formula-card__vars {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.rules-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  box-shadow: var(--shadow-sm);
}

.rule-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

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

.rule-row__condition {
  flex: 1;
  color: var(--text-secondary);
}

.rule-row__arrow {
  color: var(--text-light);
}

/* ============================================================
   STAKEHOLDERS
   ============================================================ */

.stakeholders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stakeholder-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stakeholder-card__name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stakeholder-card__role {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ======== DESKTOP LOGIN VIEW STYLES ======== */
.login-form-container {
  width: 100%;
  max-width: 420px;
  padding: 50px 40px;
  background: rgba(255, 255, 255, 0.3); /* 70% transparent */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  text-align: center;
  margin-left: 55%; /* Shift more to the right */
}

.login-form-container h2 {
  color: var(--accent-color);
  margin-bottom: 25px;
  font-family: 'Dancing Script', cursive;
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.login-form-container p {
  color: var(--text-secondary);
  margin-bottom: 35px;
  font-size: 1rem;
}

.login-form-container .form-group input {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.login-form-container .form-group input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  outline: none;
}

.login-form-container .form-group label {
  text-align: left;
  display: block;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-btn {
  width: 100%;
  margin-top: 25px;
  padding: 14px;
  font-size: 1.1rem;
  font-weight: 600;
  background-color: var(--accent-color) !important; /* Force green theme */
  color: white !important;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
}

.login-btn:hover {
  transform: translateY(-2px);
  background-color: #059669 !important; /* Darker emerald */
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* ============================================================
   ANIMATIONS & RESPONSIVE
   ============================================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.4s ease forwards;
}

@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
  }
  
  .mobile-header {
    display: flex; /* Show the mobile header */
  }
  
  /* Make app-main fill remaining space under header */
  .app-main {
    height: calc(100dvh - 60px);
    padding: 16px;
    padding-bottom: 100px; /* Safe padding for mobile bottom bar */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Sidebar becomes a slide-out drawer */
  .app-sidebar {
    position: fixed;
    top: 0;
    left: -320px; /* Hidden off-screen by default */
    width: 280px;
    bottom: 0; /* Attach to bottom to fix mobile navigation bar cut-off */
    z-index: 2000;
    transition: left 0.3s ease;
    box-shadow: 4px 0 15px rgba(0,0,0,0.2);
  }
  
  /* Class to open the drawer */
  .app-sidebar.mobile-open {
    left: 0;
  }
  
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    flex: 1; /* Take up available vertical space */
    overflow-y: auto; /* Allow scrolling if screen is too small */
  }
  .sidebar-promo {
    display: flex; /* Restore tree and logout button */
    flex-shrink: 0;
  }
  .sidebar-promo .animated-sustainability-svg {
    max-height: 100px; /* Make it smaller on mobile so it doesn't take too much space */
  }
  .sidebar-footer {
    display: none;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
  .management-grid {
    grid-template-columns: 1fr;
  }
  
  /* Fix Login Form on Mobile & Tablet */
  .login-form-container {
    width: 75%;
    max-width: 260px; /* Extremely small */
    margin: 0 auto !important;
    padding: 16px 16px;
  }
  .login-form-container h2 {
    font-size: 1.1rem; /* Much smaller font */
    margin-bottom: 12px;
  }
  .login-form-container .form-group {
    margin-bottom: 10px;
  }
  .login-form-container label {
    font-size: 11px;
    margin-bottom: 4px;
  }
  .login-form-container input,
  .login-form-container button {
    padding: 8px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 12px;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid button[type="submit"],
  .form-grid .btn-primary {
    grid-column: span 1 !important;
  }
  .form-group:last-child {
    grid-column: span 1;
  }
  .management-card {
    padding: 16px;
    min-height: auto !important;
  }
  
  /* Fix impact cards on mobile */
  .impact-card__row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   LOGIN & LOADING SCREENS
   ============================================================ */

.login-view {
  display: flex;
  height: 100vh;
  width: 100vw;
  align-items: center;
  justify-content: center;
  background: url('../logo4.svg') no-repeat center center fixed;
  background-size: cover;
  background-color: #f0fdf4; /* soft green fallback */
}

.loading-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-pulse img {
  width: 200px;
  height: 200px;
  animation: pulse-logo 2s ease-in-out infinite;
}

@keyframes float-logo {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}

@keyframes pulse-logo {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* ======== SETTINGS MODAL ======== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(28, 40, 38, 0.4); /* Darker green-tinted backdrop */
  backdrop-filter: blur(8px); /* Stronger blur for glassmorphism */
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: rgba(255, 255, 255, 0.95); /* Slightly translucent */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px; /* Rounder edges */
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 50px rgba(6, 95, 70, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) inset; /* Premium shadow and inner border */
  overflow: hidden;
  animation: modal-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.4);
}

.modal-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 0;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}

.btn-close:hover {
  color: var(--danger-color);
}

.modal-body {
  padding: 32px;
}

/* Premium Form Inputs for Modal */
.modal-body .form-group {
  margin-bottom: 20px;
}
.modal-body .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.modal-body .form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #f8faf9;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.modal-body .form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); /* Green focus ring */
}

@keyframes modal-pop {
  0% { transform: scale(0.95) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ======== EASTER EGG: PEEKING CAT ======== */
.peeking-cat {
  position: fixed;
  bottom: 0;
  right: 5%; /* Slight offset from right edge */
  width: 120px;
  height: auto;
  z-index: 999;
  transform: translateY(100%); /* Hidden by default */
  pointer-events: none; /* Don't interfere with clicks */
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.peeking-cat.peek {
  transform: translateY(0); /* Pop up */
}
