/* EMISICARBON - Custom Styles */
:root {
  --primary: #2E7D32;
  --primary-dark: #1B5E20;
  --primary-light: #4CAF50;
  --bg: #F5F7F4;
  --text: #263238;
  --success: #43A047;
  --white: #ffffff;
  --sidebar-width: 250px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* AlpineJS x-cloak */
[x-cloak] { display: none !important; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  width: var(--sidebar-width);
  bottom: 0;
  background: var(--white);
  border-right: 1px solid #e0e0e0;
  z-index: 1020;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease, transform 0.3s ease;
}

.sidebar-closed {
  width: 0 !important;
  overflow: hidden !important;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.sidebar-brand a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
}

.sidebar-brand small {
  display: block;
  color: #666;
  font-size: 0.75rem;
  font-weight: 400;
}

.sidebar-nav {
  padding: 0.75rem 0;
}

.sidebar-nav .nav-item {
  display: block;
  padding: 0.625rem 1.5rem;
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-item:hover,
.sidebar-nav .nav-item.active {
  background: #e8f5e9;
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-nav .nav-item i {
  width: 22px;
  text-align: center;
  margin-right: 10px;
}

.sidebar-nav .nav-section {
  padding: 1rem 1.5rem 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #999;
  font-weight: 600;
  letter-spacing: 1px;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid #e0e0e0;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.topbar .sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #555;
  cursor: pointer;
}

.content-area {
  flex: 1;
  padding: 1.5rem;
}

/* KPI Cards */
.kpi-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid #e8e8e8;
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.kpi-card .kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.kpi-card .kpi-icon.green {
  background: #e8f5e9;
  color: var(--primary);
}

.kpi-card .kpi-icon.blue {
  background: #e3f2fd;
  color: #1565c0;
}

.kpi-card .kpi-icon.orange {
  background: #fff3e0;
  color: #ef6c00;
}

.kpi-card .kpi-icon.purple {
  background: #f3e5f5;
  color: #7b1fa2;
}

.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.kpi-card .kpi-label {
  font-size: 0.85rem;
  color: #777;
  margin-top: 0.25rem;
}

/* Cards */
.card-custom {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  overflow: hidden;
}

.card-custom .card-header {
  background: transparent;
  border-bottom: 1px solid #e8e8e8;
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-custom .card-body {
  padding: 1.25rem;
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

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

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

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

/* Tables */
.table-custom {
  width: 100%;
  border-collapse: collapse;
}

.table-custom th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #e8e8e8;
}

.table-custom td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
  font-size: 0.9rem;
}

.table-custom tr:hover {
  background: #fafafa;
}

/* Badge */
.badge-success {
  background: #e8f5e9;
  color: var(--primary);
}

.badge-danger {
  background: #fbe9e7;
  color: #c62828;
}

/* Landing Page */
.landing-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--white);
  padding: 6rem 0 4rem;
  text-align: center;
}

.landing-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.landing-hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.landing-hero .tagline {
  font-size: 1rem;
  opacity: 0.8;
  font-style: italic;
}

.landing-stats {
  padding: 3rem 0;
  background: var(--white);
}

.landing-stats .stat-item {
  text-align: center;
}

.landing-stats .stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
}

.landing-stats .stat-label {
  color: #777;
  font-size: 0.9rem;
}

.landing-features {
  padding: 4rem 0;
}

.landing-features .feature-card {
  background: var(--white);
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid #e8e8e8;
  text-align: center;
  height: 100%;
  transition: transform 0.2s;
}

.landing-features .feature-card:hover {
  transform: translateY(-4px);
}

.landing-features .feature-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #e8f5e9;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
}

/* Landing page nav */
.landing-nav {
  background: var(--white);
  border-bottom: 1px solid #e0e0e0;
  padding: 0.75rem 1.5rem;
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f5e9 0%, #f5f7f4 100%);
  padding: 1rem;
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.login-card .brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .brand h2 {
  color: var(--primary);
  font-weight: 700;
}

.login-card .brand small {
  color: #999;
}

/* Forms */
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(46, 125, 50, 0.15);
}

/* Pagination */
.pagination .page-link {
  color: var(--primary);
  border-color: #ddd;
}

.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* Category tabs */
.category-tabs .btn {
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  transition: all 0.2s;
}

.category-tabs .btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 250px !important;
  }

  .sidebar:not(.sidebar-closed) {
    transform: translateX(0);
  }

  .sidebar-closed {
    transform: translateX(-100%) !important;
    width: 250px !important;
  }

  main, footer {
    margin-left: 0 !important;
  }

  .topbar .sidebar-toggle {
    display: inline-block;
  }

  .landing-hero h1 {
    font-size: 1.75rem;
  }
}

/* Fix for d-flex sidebar layout */
.sidebar .nav-item .nav-link:hover {
  background-color: #e8f5e9;
  color: #2E7D32;
}

.sidebar .nav-item .active-sidebar {
  background-color: #e8f5e9;
  color: #2E7D32;
  font-weight: 600;
}
