/* The Dinner Solution - Admin Portal */
:root {
  --primary: #b45309;
  --primary-light: #d97706;
  --primary-bg: #fffbeb;
  --accent: #059669;
  --accent-light: #d1fae5;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --text: #1f2937;
  --text-muted: #6b7280;
  --bg: #fafaf9;
  --white: #ffffff;
  --border: #e5e7eb;
  --border-hover: #d1d5db;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Layout */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-logo h1 {
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 700;
}

.sidebar-logo span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.sidebar nav a:hover {
  color: var(--text);
  background: var(--primary-bg);
}

.sidebar nav a.active {
  color: var(--primary);
  background: var(--primary-bg);
  border-right: 3px solid var(--primary);
}

.sidebar nav a .icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

.main {
  flex: 1;
  margin-left: 240px;
  padding: 2rem;
  max-width: 1200px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
}

.card-body {
  padding: 1.25rem;
}

/* Stat Cards */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .change {
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.stat-card .change.up { color: var(--accent); }
.stat-card .change.down { color: var(--danger); }

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

th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

tr:hover td {
  background: var(--primary-bg);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active { background: var(--accent-light); color: #065f46; }
.badge-past-due { background: var(--danger-light); color: #991b1b; }
.badge-cancelled { background: #f3f4f6; color: #6b7280; }
.badge-trialing { background: var(--warning-light); color: #92400e; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--white);
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
}

.btn:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

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

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

.btn-accent {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.btn-danger {
  background: var(--white);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-light);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-group .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Search Bar */
.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  max-width: 400px;
}

/* Detail Layout */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.detail-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

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

.detail-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 500;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 90%;
  padding: 1.5rem;
}

.modal h3 {
  margin-bottom: 0.75rem;
}

.modal p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--accent);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  display: none;
}

.toast.show { display: block; }

/* Tag chips */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Ingredient rows */
.ingredient-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.ingredient-row input {
  flex: 1;
}

.ingredient-row .btn {
  flex-shrink: 0;
}

/* User greeting in sidebar */
.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
}

.sidebar-user .name {
  font-size: 0.85rem;
  font-weight: 600;
}

.sidebar-user .email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
