/* public/static/dashboard.css */

/* ===== Base ===== */

:root {
  --bg-body: #f4f5f7;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --border-subtle: #dde1e7;
  --text-main: #222;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.08);
  --success: #16a34a;
  --shadow-soft: 0 14px 35px rgba(15, 23, 42, 0.12);
  --radius-lg: 18px;
  --radius-pill: 999px;
}

body.super-dashboard {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #e0ecff 0, #f5f7fb 48%, #fdfdfd 100%);
  margin: 0;
  padding: 0;
  color: var(--text-main);
}

/* ===== Topbar / Shell ===== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: linear-gradient(
    90deg,
    rgba(15, 23, 42, 0.92),
    rgba(30, 64, 175, 0.96)
  );
  color: #f9fafb;
  padding: 1.25rem 1.75rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.topbar-main {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-left h1 {
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: 0.03em;
}

.topbar-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: rgba(226, 232, 240, 0.9);
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.6rem;
  margin-left: 0.3rem;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.7);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(191, 219, 254, 0.65);
  background: rgba(15, 23, 42, 0.6);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ===== Layout ===== */

.dashboard-layout {
  max-width: 1120px;
  margin: 1.75rem auto 2.5rem;
  padding: 0 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ===== Cards ===== */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.4rem 1.5rem 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card h2 {
  margin: 0 0 0.15rem;
  font-size: 1.15rem;
}

.card-subtitle {
  margin: 0;
  font-size: 0.87rem;
  color: var(--text-muted);
}

/* ===== Metrics ===== */

.metrics-card {
  padding-bottom: 1.3rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.metric {
  position: relative;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at top left, #f9fafb 0, #f3f4f6 46%, #e5e7eb 100%);
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  inset: -40%;
  opacity: 0.12;
  background: radial-gradient(
    circle at top right,
    rgba(37, 99, 235, 0.9),
    transparent 60%
  );
  pointer-events: none;
}

.metric-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.metric-value {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.metric-users-active .metric-value {
  color: var(--success);
}

.metric-users-deleted .metric-value {
  color: var(--danger);
}

/* ===== Forms ===== */

.inline-form {
  margin-top: 0.8rem;
  margin-bottom: 1.1rem;
  padding: 0.85rem 0.9rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #f9fafb, #eef2ff);
  border: 1px dashed rgba(148, 163, 184, 0.7);
}

.form-title {
  margin: 0 0 0.65rem;
  font-size: 0.96rem;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.inline-form input,
.inline-form select {
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  padding: 0.45rem 0.6rem;
  font-size: 0.88rem;
  background: rgba(248, 250, 252, 0.9);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  width: 100%;
  box-sizing: border-box;
}

.inline-form input:focus,
.inline-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
  background: #ffffff;
}

.form-actions {
  margin-top: 0.8rem;
  display: flex;
  justify-content: flex-end;
}

/* ===== Buttons ===== */

button {
  font-family: inherit;
}

.primary-btn {
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: none;
  background: radial-gradient(circle at top left, #3b82f6, #1d4ed8);
  color: #f9fafb;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
  transition:
    transform 0.1s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
}

.primary-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.55);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.4);
}

.data-table button {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: none;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.08s ease, box-shadow 0.12s ease;
}

.edit-user-btn,
.edit-restaurant-btn {
  background: rgba(37, 99, 235, 0.06);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.5);
}

.edit-user-btn:hover,
.edit-restaurant-btn:hover {
  background: rgba(37, 99, 235, 0.16);
  transform: translateY(-0.5px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.delete-user-btn,
.delete-restaurant-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(225, 29, 72, 0.6);
}

.delete-user-btn:hover,
.delete-restaurant-btn:hover {
  background: rgba(225, 29, 72, 0.16);
  transform: translateY(-0.5px);
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.3);
}

/* ===== Tables ===== */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: linear-gradient(180deg, #ffffff 0, #f9fafb 45%, #f3f4f6 100%);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 0.86rem;
}

.data-table thead {
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.55);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(249, 250, 251, 0.9);
}

.data-table tbody tr:hover {
  background: rgba(219, 234, 254, 0.55);
}

.data-table input,
.data-table select {
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 0.25rem 0.35rem;
  font-size: 0.8rem;
  width: 100%;
  box-sizing: border-box;
  background: rgba(248, 250, 252, 0.9);
}

.data-table input:focus,
.data-table select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.35);
  background: #ffffff;
}

.data-table input[type="checkbox"] {
  width: auto;
}

/* ===== Responsive ===== */

@media (max-width: 900px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout {
    padding: 0 1rem 2rem;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding-inline: 1rem;
  }

  .topbar-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .metrics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .inline-form {
    padding-inline: 0.8rem;
  }

  .card {
    padding-inline: 1rem;
  }

  .table-wrapper {
    border-radius: 10px;
  }
}

/* === Table filters / controls === */

.card-controls {
  margin: 0.75rem 0 0.5rem;
}

.table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 150px;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
}

.filter-group input[type="search"],
.filter-group select {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 0.85rem;
  background: #ffffff;
  color: #111827;
}

.filter-group input[type="search"]::placeholder {
  color: #9ca3af;
}

@media (max-width: 768px) {
  .table-filters {
    flex-direction: column;
    align-items: stretch;
  }
}


/* ======================================================
   Moorish-Cyber Tag Chips 
   ====================================================== */

.chip-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin: 6px 0 12px;
}

.chip {
    padding: 6px 10px;
    border: 1px solid var(--tw-accent-gold, #facc15);
    border-radius: 6px;
    background: var(--tw-bg-soft, #050510);
    color: var(--tw-text-main, #e5e7eb);
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    transition: box-shadow 0.2s, background 0.2s;
}

.chip:hover {
    box-shadow: 0 0 6px rgba(250, 204, 21, 0.4);
}

.chip.selected {
    background: linear-gradient(135deg, var(--tw-accent-gold, #facc15), #0f172a);
    color: #000;
    font-weight: 600;
}

.chip-delete {
    margin-left: 6px;
    font-weight: bold;
    cursor: pointer;
    color: #000;
}

.chip-input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--tw-line-soft, rgba(148,163,184,0.25));
    background: var(--tw-bg-elevated, #050818);
    color: var(--tw-text-main, #e5e7eb);
    margin-top: 6px;
}

/* ===== Owner menu shell ===== */

body.owner-shell {
  margin: 0;
  min-width: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: #f4f5f7;
}

.owner-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  color: #f9fafb;
  background: #0f172a;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.22);
}

.owner-topbar-left,
.owner-topbar-right {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.owner-brand {
  font-weight: 700;
}

.owner-section-label,
.owner-meta {
  color: rgba(226, 232, 240, 0.86);
  font-size: 0.88rem;
}

body.owner-shell .dashboard-container {
  width: min(100% - 2rem, 1120px);
  margin: 1.25rem auto 2rem;
  display: grid;
  gap: 1rem;
}

body.owner-shell .card {
  min-width: 0;
}

body.owner-shell h1,
body.owner-shell h2 {
  margin-top: 0;
}

body.owner-shell .form-row {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

body.owner-shell .form-row label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

body.owner-shell .form-row input,
body.owner-shell .form-row textarea,
body.owner-shell .form-row select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  font: inherit;
  color: var(--text-main);
  background: #ffffff;
}

body.owner-shell .form-row textarea {
  resize: vertical;
}

body.owner-shell .checkbox-row label {
  flex-direction: row;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

body.owner-shell .checkbox-row input {
  width: auto;
}

body.owner-shell .menu-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

body.owner-shell .menu-table th,
body.owner-shell .menu-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.45);
  text-align: left;
  vertical-align: top;
}

body.owner-shell .menu-table th {
  color: #475569;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.owner-shell .primary-btn,
body.owner-shell .secondary-btn,
body.owner-shell .ghost-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

body.owner-shell .secondary-btn,
body.owner-shell .ghost-btn {
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #ffffff;
  color: #0f172a;
}

body.owner-shell .ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f9fafb;
}

@media (max-width: 640px) {
  .owner-topbar {
    align-items: stretch;
    padding: 0.8rem 0.9rem;
  }

  .owner-topbar,
  .owner-topbar-left,
  .owner-topbar-right {
    flex-direction: column;
  }

  body.owner-shell .dashboard-container {
    width: min(100% - 1rem, 1120px);
    margin-top: 0.75rem;
    gap: 0.8rem;
  }

  body.owner-shell .menu-table {
    min-width: 520px;
  }

  body.owner-shell .chip-group {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  }

  body.owner-shell .primary-btn,
  body.owner-shell .secondary-btn,
  body.owner-shell .ghost-btn {
    width: 100%;
  }
}
