/* ============================================================
   LAYOUT
   ============================================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-md); }
.stack { display: flex; flex-direction: column; gap: var(--space-md); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-sm); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-lg); }
.row { display: flex; align-items: center; gap: var(--space-md); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.grid { display: grid; gap: var(--space-md); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); font-weight: 700; }
.text-3xl { font-size: var(--text-3xl); font-weight: 700; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.hidden { display: none !important; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  padding: 0.5rem 1rem; border-radius: var(--radius-md); border: 1px solid var(--color-border);
  background: var(--color-surface); cursor: pointer; font-size: var(--text-sm); font-weight: 500;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: #f3f4f6; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary); color: white; border-color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(45, 106, 79, 0.3), 0 1px 2px rgba(45, 106, 79, 0.2);
}
.btn-primary:hover { background: var(--color-primary-light); border-color: var(--color-primary-light); box-shadow: 0 2px 6px rgba(45, 106, 79, 0.35), 0 1px 3px rgba(45, 106, 79, 0.2); }
.btn-outline {
  background: transparent; color: var(--color-primary); border-color: var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary); color: white; }
.btn-danger {
  background: var(--color-error); color: white; border-color: var(--color-error);
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3), 0 1px 2px rgba(220, 38, 38, 0.2);
}
.btn-danger:hover { background: #b91c1c; box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35), 0 1px 3px rgba(220, 38, 38, 0.2); }
.btn-sm { padding: 0.25rem 0.75rem; font-size: var(--text-sm); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: var(--text-lg); }
.btn-block { width: 100%; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header {
  padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--color-border);
  font-weight: 600;
}
.card-body { padding: var(--space-lg); }
.card-footer {
  padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--color-border);
  background: #f9fafb;
}
.card-image { width: 100%; aspect-ratio: 16/10; object-fit: cover; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); }
.label { font-size: var(--text-sm); font-weight: 500; color: var(--color-text); }
.input, .textarea, .select {
  padding: 0.5rem 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); font-size: var(--text-base); width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}
.input[readonly] { background: var(--color-bg); color: var(--color-text-muted); cursor: default; }
.input[readonly]:focus { border-color: var(--color-border); box-shadow: none; }
.textarea { resize: vertical; min-height: 80px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }
.form-error { color: var(--color-error); font-size: var(--text-sm); }
.form-hint { color: var(--color-text-muted); font-size: var(--text-sm); }
.checkbox-label {
  display: flex; align-items: center; gap: var(--space-xs);
  font-size: var(--text-sm); cursor: pointer; padding: var(--space-xs) 0;
}

/* CO2 info */
.co2-display { display: inline-flex; align-items: center; gap: var(--space-xs); }
.co2-info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text-muted);
  font-size: 10px; font-weight: 600; cursor: pointer; line-height: 1;
  flex-shrink: 0;
}
.co2-info-btn:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.co2-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.co2-table th { text-align: left; padding: var(--space-xs) var(--space-sm); border-bottom: 2px solid var(--color-border); font-weight: 600; }
.co2-table td { padding: var(--space-xs) var(--space-sm); border-bottom: 1px solid var(--color-border); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; padding: 0.125rem 0.5rem;
  border-radius: 9999px; font-size: 0.75rem; font-weight: 500;
  background: #e5e7eb; color: var(--color-text);
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: var(--space-md);
}
.modal-content {
  background: var(--color-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--color-border);
  font-weight: 600; font-size: var(--text-lg);
}
.modal-body { padding: var(--space-lg); }
.modal-footer {
  padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--color-border);
  display: flex; justify-content: flex-end; gap: var(--space-sm);
}
.modal-close {
  background: none; border: none; cursor: pointer; font-size: var(--text-xl);
  color: var(--color-text-muted); padding: 0.25rem;
}
.modal-close:hover { color: var(--color-text); }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 200; display: flex; align-items: center; justify-content: center; }
.lightbox-img { max-width: 90vw; max-height: 85vh; object-fit: contain; user-select: none; }
.lightbox-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; z-index: 201; line-height: 1; padding: 4px 10px; }
.lightbox-close:hover { color: #ccc; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.15); border: none; border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.8rem; color: #fff; z-index: 201; transition: background 0.15s; }
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-counter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.7); font-size: 0.9rem; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  display: flex; align-items: center; gap: var(--space-sm);
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  padding: 0 var(--space-lg); height: 56px;
}
.nav-brand {
  margin-right: auto; cursor: pointer; display: flex; align-items: center; gap: var(--space-xs);
}
.nav-logo {
  height: 28px; width: auto;
}
.beta-badge {
  display: inline-block; padding: 1px 6px; border-radius: var(--radius-sm);
  background: #fbbf24; color: #78350f;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.05em;
  line-height: 1.4; align-self: flex-start; margin-top: 2px;
}
.nav-item {
  padding: 0.5rem 0.75rem; border-radius: var(--radius-md); font-size: var(--text-sm);
  color: var(--color-text-muted); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: #f3f4f6; color: var(--color-text); }
.nav-active { color: var(--color-primary); font-weight: 500; }
@media (max-width: 768px) {
  .nav { flex-wrap: wrap; height: auto; padding: var(--space-sm) var(--space-md); }
  .nav-links { display: none; width: 100%; flex-direction: column; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}
@media (min-width: 769px) {
  .nav-toggle { display: none; }
}

/* ============================================================
   TABLE
   ============================================================ */
.table { width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.table th, .table td {
  padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border);
}
.table th { background: #f9fafb; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.table-striped tr:nth-child(even) { background: #f9fafb; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: var(--space-md); border-radius: var(--radius-md); font-size: var(--text-sm);
  border: 1px solid var(--color-border); background: #f3f4f6;
}
.alert-success { background: #dcfce7; border-color: #86efac; color: #15803d; }
.alert-error { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.alert-info { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.alert-warning { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

/* ============================================================
   SKELETON / LOADING
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; border-bottom: 2px solid var(--color-border); gap: 0;
}
.tab {
  padding: 0.75rem 1.25rem; cursor: pointer; font-size: var(--text-sm);
  color: var(--color-text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--color-text); }
.tab-active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 500; }

/* ============================================================
   STAT CARD
   ============================================================ */
.stat-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-lg); text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-card-value {
  font-size: var(--text-3xl); font-weight: 700; color: var(--color-primary);
  line-height: 1.2;
}
.stat-card-label {
  font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-xs);
}
.stat-card-icon {
  margin-bottom: var(--space-sm); display: flex; justify-content: center; align-items: center;
}
.stat-card-icon svg {
  width: 1.25rem; height: 1.25rem; color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  padding: 0.5rem; border-radius: 50%; box-sizing: content-box;
}

/* ============================================================
   FILTER SIDEBAR
   ============================================================ */
.filter-sidebar {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}
.filter-sidebar h3 { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-md); }
.filter-group { margin-bottom: var(--space-lg); }
.filter-group label { display: flex; align-items: center; gap: var(--space-sm); cursor: pointer; padding: 0.25rem 0; font-size: var(--text-sm); }
.filter-group input[type="checkbox"] { accent-color: var(--color-primary); }

/* Range slider */
.filter-group .slider-wrapper {
  display: flex; flex-direction: column; gap: var(--space-xs); padding-top: var(--space-xs);
}
.filter-group .slider-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--text-sm); color: var(--color-text-muted);
}
.filter-group .slider-value {
  font-weight: 600; color: var(--color-text); font-size: var(--text-sm);
}
.filter-group input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px;
  background: var(--color-border); outline: none;
  cursor: pointer;
}
.filter-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-primary); border: 2px solid var(--color-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.filter-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.35);
}
.filter-group input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-primary); border: 2px solid var(--color-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
}
.filter-group input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 3px; background: var(--color-border);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: var(--space-xs);
  margin-top: var(--space-lg);
}
.pagination button {
  padding: 0.375rem 0.75rem; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface);
  cursor: pointer; font-size: var(--text-sm);
}
.pagination button:hover { background: #f3f4f6; }
.pagination button.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--color-primary-light); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: var(--text-sm); flex-shrink: 0;
}
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: var(--text-lg); }

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: 100%; right: 0; margin-top: var(--space-xs);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  min-width: 300px; z-index: 50; display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: block; padding: 0.5rem 1rem; font-size: var(--text-sm);
  cursor: pointer; transition: background 0.1s;
}
.dropdown-item:hover { background: #f3f4f6; }
.dropdown-label {
  display: block; padding: 0.5rem 1rem; font-size: var(--text-sm);
  font-weight: 500; color: var(--color-text);
}
.dropdown-label-sub {
  font-weight: 400; font-size: var(--text-xs); color: var(--color-text-muted);
  margin-top: 0.125rem;
}
.dropdown-divider { border-top: 1px solid var(--color-border); margin: var(--space-xs) 0; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed; bottom: var(--space-lg); right: var(--space-lg); z-index: 200;
  display: flex; flex-direction: column-reverse; gap: var(--space-sm);
}
.toast {
  padding: var(--space-md) var(--space-lg); border-radius: var(--radius-md);
  background: var(--color-surface); border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md); font-size: var(--text-sm);
  animation: toast-in 0.3s ease;
  display: flex; align-items: center; gap: var(--space-sm);
  max-width: 360px;
}
.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-error); }
.toast-info { border-left: 4px solid var(--color-primary); }
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   EQUIPMENT CARD (listing card)
   ============================================================ */
.equipment-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}
.equipment-card-badge {
  position: absolute; top: var(--space-sm); right: var(--space-sm);
  background: var(--color-primary); color: white;
  font-size: var(--text-xs); font-weight: 600;
  padding: 0.2rem 0.5rem; border-radius: var(--radius-md);
}
.equipment-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.equipment-card-image {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #e5e7eb;
}
.equipment-card-body { padding: var(--space-md); }
.equipment-card-title { font-weight: 600; font-size: var(--text-base); margin-bottom: var(--space-xs); }
.equipment-card-meta { font-size: var(--text-sm); color: var(--color-text-muted); }
.equipment-card-available-to {
  padding: var(--space-xs) var(--space-md); font-size: var(--text-sm); color: var(--color-text-muted);
}
.equipment-card-footer {
  padding: var(--space-sm) var(--space-md); border-top: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm);
}

/* ============================================================
   IMAGE UPLOAD
   ============================================================ */
.image-upload-area {
  border: 2px dashed var(--color-border); border-radius: var(--radius-md);
  padding: var(--space-xl); text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.image-upload-area:hover { border-color: var(--color-primary); background: #f0fdf4; }
.image-upload-area.dragover { border-color: var(--color-primary); background: #f0fdf4; }
.image-preview-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: var(--space-sm);
  margin-top: var(--space-md);
}
.image-preview {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-remove {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  background: rgba(0,0,0,0.6); color: white; border: none; border-radius: 50%;
  cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: var(--space-2xl);
  color: var(--color-text-muted);
}
.empty-state-icon { margin-bottom: var(--space-md); display: flex; justify-content: center; align-items: center; color: var(--color-text-muted); }
.empty-state-title { font-size: var(--text-lg); font-weight: 600; color: var(--color-text); margin-bottom: var(--space-sm); }
