/* Eureka and Olive Grove Marketing Platform (static prototype) */

:root {
  /* Main: white; Accent: EUREKA GREEN; Buttons/accents: SALE RED */
  --bg: #ffffff;
  --surface: #fff;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e5e5e5;
  --primary: #485F4C;       /* EUREKA GREEN - main accent */
  --primary-hover: #3a4d3e;
  --accent: #E40D0D;        /* SALE RED - buttons, cart badge */
  --accent-hover: #c00b0b;
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #E40D0D;        /* SALE RED for destructive/alert */
  --hover-bg: #f5f5f5;    /* subtle hover on white */
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --nav-height: 72px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top nav */
.top-nav {
  height: var(--nav-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  text-decoration: none;
}

.nav-logo-img {
  display: block;
  height: 48px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.nav-logo-text {
  /* Fallback when no logo image is present */
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.5rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.nav-link:hover {
  background: var(--hover-bg);
}

.nav-link.active {
  background: var(--primary);
  color: #fff;
}

.cart-badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.75rem;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  margin-left: 0.25rem;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nav-label select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: var(--surface);
}

.nav-user-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main content */
main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.page-description {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Catalog grid */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filters-bar input[type="search"],
.filters-bar select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.filters-bar input[type="search"] {
  min-width: 200px;
}

.catalog-breadcrumb {
  margin-bottom: 1rem;
}

.catalog-breadcrumb .btn-back {
  font-size: 0.9rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: #fff;
}

.card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.category-card-admin {
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.category-card-admin:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

.category-images-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.category-thumb-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.category-thumb-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.category-thumb {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg);
}

.category-thumb-empty {
  width: 100%;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.category-buttons-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.category-card-add {
  cursor: pointer;
  transition: box-shadow 0.2s;
  border-style: dashed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.category-card-add:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  color: var(--primary);
}

.add-category-icon {
  font-size: 3rem;
  font-weight: 300;
  line-height: 1;
}

.category-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.2s;
}

.category-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.card .sku {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.category-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  background: rgba(72, 95, 76, 0.12);
  color: var(--primary);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.card p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.stock-info {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.stock-info.low {
  color: var(--warning);
}

.stock-info.out {
  color: var(--danger);
}

.supplied-quantity-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.card-add-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.card-qty-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.card-qty-input {
  width: 4rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

a.btn {
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--hover-bg);
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

/* Cart */
.cart-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.cart-line-info {
  flex: 1;
}

.cart-line-info strong {
  display: block;
  margin-bottom: 0.25rem;
}

.cart-line-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.qty-stepper button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.qty-stepper button:hover {
  background: var(--bg);
}

.qty-stepper span {
  min-width: 2rem;
  text-align: center;
  font-weight: 500;
}

.cart-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.cart-delivery-row {
  margin-bottom: 1rem;
}

.cart-delivery-row label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.cart-delivery-row .required {
  color: var(--danger);
}

.cart-delivery-row input[type="date"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

/* Orders */
.orders-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  cursor: pointer;
  gap: 0.5rem;
}

.order-header:hover {
  background: var(--bg);
}

.order-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.order-number {
  font-weight: 600;
}

.order-date {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-badge {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 4px;
  font-weight: 500;
}

.status-badge.new { background: #dbeafe; color: #1d4ed8; }
.status-badge.sent { background: #dcfce7; color: #16a34a; }
.status-badge.declined { background: #fee2e2; color: #dc2626; }

.btn-sent {
  background: #16a34a;
  color: white;
  border-color: #16a34a;
  cursor: default;
}

.order-lines {
  padding: 0 1.25rem 1rem;
  border-top: 1px solid var(--border);
}

.order-lines summary {
  cursor: pointer;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.order-line {
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

/* Admin */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.summary-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-card .value {
  font-size: 1.75rem;
  font-weight: 700;
}

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: center;
}

.admin-filters select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.orders-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table th,
.orders-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.orders-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
}

.orders-table tr:last-child td {
  border-bottom: none;
}

.orders-table .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Admin items */
.items-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
}

.items-table th,
.items-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.items-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
}

.items-table .stock-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.items-table .stock-cell input {
  width: 4rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.form-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* Modal / form panel */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-group-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.form-check-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
  align-items: center;
  justify-content: flex-start;
}

.form-check-group .form-check-label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  font-weight: 400;
  cursor: pointer;
  line-height: 1.4;
  flex: 0 0 auto;
}

.form-check-group .form-check-label input[type="radio"],
.form-check-group .form-check-label input[type="checkbox"] {
  width: 1.1rem !important;
  min-width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  flex-shrink: 0;
  vertical-align: middle;
}

.form-hint {
  margin: 0.35rem 0 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.item-image-preview {
  margin-top: 0.5rem;
}

.item-image-preview-img {
  display: block;
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* Admin user view */
.user-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.user-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.user-header .email {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.user-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.user-stats span {
  color: var(--text-muted);
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Order detail (admin) */
.order-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.order-detail .detail-lines {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.order-detail .detail-line {
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

/* Utility */
.hidden {
  display: none !important;
}

.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
