/* Crusader Kitchen admin — editorial operations theme */

body {
  background: #0c1017;
  color: #ffffff;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4vw;
  background: rgba(12, 16, 23, 0.97);
  border-bottom: 1px solid #29384c;
  backdrop-filter: blur(12px);
}

.admin-header .header-left,
.admin-header .header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-header .header-logo {
  display: block;
  width: 178px;
  max-width: none;
  height: 58px;
  object-fit: contain;
  cursor: pointer;
}

.admin-header .header-title {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.admin-header .header-sub {
  color: #8a99ad;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.admin-header .deadline-mini {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.admin-header .deadline-mini-label {
  color: #8a99ad;
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.admin-header .deadline-mini-date {
  color: #40b5eb;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.admin-header .btn-back {
  padding: 10px 16px;
  border: 1px solid #40b5eb;
  color: #40b5eb;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: 180ms ease;
}

.admin-header .btn-back:hover {
  background: #40b5eb;
  color: #0c1017;
}

.admin-container {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 70px 4vw 100px;
}

.admin-intro {
  max-width: 850px;
  margin-bottom: 50px;
}

.admin-kicker {
  color: #40b5eb;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.admin-intro h2 {
  margin: 10px 0 16px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 5vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.94;
}

.admin-intro h2 em {
  color: #40b5eb;
  font-weight: 500;
}

.admin-intro > p:last-child {
  max-width: 640px;
  color: #8a99ad;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.35;
}

/* Metrics */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 26px;
  border-top: 1px solid #29384c;
  border-left: 1px solid #29384c;
}

.stat-card {
  min-height: 154px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  padding: 20px;
  background: #151c27;
  border-right: 1px solid #29384c;
  border-bottom: 1px solid #29384c;
  transition: background 180ms ease;
}

.stat-card:hover {
  background: #1c2635;
}

.stat-icon {
  align-self: flex-end;
  color: #40b5eb;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 2.45rem;
  font-weight: 500;
  line-height: 1;
}

.stat-label {
  margin-top: 6px;
  color: #8a99ad;
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

/* Filters */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 26px;
  padding: 22px;
  background: #111a26;
  border: 1px solid #29384c;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label,
.modal-status-select label {
  color: #b8c5d2;
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.filter-group select,
.filter-group input,
.modal-status-select select {
  min-width: 170px;
  height: 42px;
  padding: 0 38px 0 13px;
  background-color: #0e141d;
  border: 1px solid #29384c;
  border-radius: 0;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.78rem;
  outline: 0;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.filter-group input {
  min-width: 240px;
  padding-right: 13px;
}

.filter-group select,
.modal-status-select select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2340b5eb' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-position: right 13px center;
  background-repeat: no-repeat;
}

.filter-group select:focus,
.filter-group input:focus,
.modal-status-select select:focus {
  border-color: #40b5eb;
  box-shadow: 0 0 0 2px rgba(64, 181, 235, 0.12);
}

.filter-group select option,
.modal-status-select select option {
  background: #151c27;
}

.filter-group input::placeholder {
  color: #657387;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.filter-actions .btn,
.modal-status-select .btn {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid #40b5eb;
  border-radius: 0;
  font-family: var(--font-body);
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.btn-danger-outline {
  border-color: #b9504b !important;
  color: #df7770 !important;
}

.btn-danger-outline:hover {
  background: #b9504b !important;
  color: #ffffff !important;
}

/* Shared panels */
.prep-summary-section,
.orders-section {
  margin-bottom: 26px;
  overflow: hidden;
  background: #151c27;
  border: 1px solid #29384c;
}

.section-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  cursor: pointer;
  user-select: none;
}

.orders-section .section-header {
  cursor: default;
  border-bottom: 1px solid #29384c;
}

.section-header h2 {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 500;
}

.section-header h2 em {
  margin-left: 7px;
  color: #40b5eb;
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toggle-icon {
  color: #40b5eb;
  font-size: 0.75rem;
}

.section-content {
  padding: 0 24px 24px;
  animation: admin-slide-down 220ms ease;
}

@keyframes admin-slide-down {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.prep-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.prep-category {
  padding: 18px;
  background: #0e141d;
  border: 1px solid #29384c;
}

.prep-category h4,
.modal-section h4 {
  margin-bottom: 11px;
  color: #40b5eb;
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.prep-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  color: #dce4ec;
  font-size: 0.78rem;
}

.prep-item-count {
  min-width: 28px;
  padding: 2px 7px;
  background: #182333;
  color: #40b5eb;
  font-weight: 700;
  text-align: center;
}

/* Orders table */
.orders-table-wrapper {
  overflow-x: auto;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table thead {
  background: #0e141d;
}

.orders-table th {
  padding: 13px 16px;
  color: #8a99ad;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.orders-table td {
  padding: 15px 16px;
  border-bottom: 1px solid #222e3f;
  color: #dce4ec;
  font-size: 0.79rem;
  vertical-align: middle;
}

.orders-table tbody tr {
  transition: background 160ms ease;
}

.orders-table tbody tr:hover {
  background: #18212e;
}

.order-id {
  color: #40b5eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 700;
}

.customer-cell,
.stat-info {
  display: flex;
  flex-direction: column;
}

.customer-name { color: #ffffff; font-weight: 600; }
.customer-email { color: #8a99ad; font-size: 0.68rem; }
.meals-cell { white-space: nowrap; }

.portal-tag,
.status-badge {
  display: inline-block;
  padding: 4px 9px;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.portal-tag.prep { background: #182333; color: #79cff5; }
.portal-tag.public { background: #12303b; color: #6ed4e7; }
.status-badge { cursor: pointer; transition: transform 160ms ease; }
.status-badge:hover { transform: translateY(-1px); }
.status-pending { background: #362a16; color: #e7b556; }
.status-confirmed { background: #182333; color: #79cff5; }
.status-preparing { background: #2c203c; color: #c89bf4; }
.status-ready, .status-delivered { background: #173126; color: #75d69b; }
.status-cancelled { background: #382020; color: #df7770; }

.action-btns {
  display: flex;
  gap: 6px;
}

.action-btn {
  padding: 6px 9px;
  background: transparent;
  border: 1px solid #29384c;
  border-radius: 0;
  color: #b8c5d2;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.64rem;
  transition: 160ms ease;
  white-space: nowrap;
}

.action-btn:hover { border-color: #40b5eb; color: #40b5eb; }
.action-btn.delete:hover { border-color: #df7770; color: #df7770; }

.empty-state {
  padding: 76px 24px 82px;
  text-align: center;
}

.empty-icon {
  color: #40b5eb;
  font-family: var(--font-display);
  font-size: 2.8rem;
}

.empty-state h3 {
  margin: 5px 0;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
}

.empty-state p { color: #8a99ad; font-size: 0.8rem; }

/* Order modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 7, 11, 0.82);
  backdrop-filter: blur(5px);
}

.modal-content {
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: #151c27;
  border: 1px solid #40b5eb;
  animation: admin-modal-in 200ms ease;
}

@keyframes admin-modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: #151c27;
  border-bottom: 1px solid #29384c;
}

.modal-header h2 {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
}

.modal-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid #29384c;
  border-radius: 50%;
  color: #b8c5d2;
  cursor: pointer;
  transition: 160ms ease;
}

.modal-close:hover { border-color: #df7770; color: #df7770; }
.modal-body { padding: 24px; }
.modal-section { margin-bottom: 22px; }

.modal-detail {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 0;
  color: #ffffff;
  font-size: 0.8rem;
}

.modal-detail span:first-child { color: #8a99ad; }
.modal-status-select { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #29384c; }
.modal-status-select select { min-width: 180px; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .admin-header { align-items: flex-start; gap: 12px; }
  .admin-header .header-logo { width: 145px; }
  .admin-header .header-left > div { display: none; }
  .admin-header .deadline-mini { display: none; }
  .admin-container { padding: 48px 18px 70px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-bar { align-items: stretch; flex-direction: column; }
  .filter-group select, .filter-group input { width: 100%; min-width: 0; }
  .filter-actions { margin-left: 0; flex-wrap: wrap; min-width: 0; }
  .filter-actions .btn { flex: 1; }
  .orders-table th:nth-child(7), .orders-table td:nth-child(7) { display: table-cell; }
}

@media (max-width: 480px) {
  .admin-header .header-logo { width: 128px; height: 46px; }
  .admin-header .btn-back { padding: 9px 10px; font-size: 0.56rem; }
  .admin-intro h2 { font-size: 2.65rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 132px; padding: 16px; }
  .stat-value { font-size: 2rem; }
  .section-header { padding: 16px; }
  .section-header h2 { font-size: 1.4rem; }
  .orders-table th:nth-child(4), .orders-table td:nth-child(4),
  .orders-table th:nth-child(5), .orders-table td:nth-child(5) { display: none; }
  .modal-detail { align-items: flex-start; flex-direction: column; gap: 2px; }
  .modal-status-select { align-items: stretch; flex-direction: column; }
}

.admin-panel {
  margin-bottom: 26px;
  overflow: hidden;
  background: #151c27;
  border: 1px solid #29384c;
}

.admin-panel > .section-header { border-bottom: 1px solid #29384c; }
.paper-import { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 34px; padding: 28px; }
.paper-import-copy h2 { max-width: 720px; margin: 7px 0 10px; color: #fff; font-family: var(--font-display); font-size: clamp(1.7rem, 3vw, 2.6rem); font-weight: 500; line-height: 1; }
.paper-import-copy > p:last-child { max-width: 680px; color: #8a99ad; font-size: .8rem; line-height: 1.6; }
.paper-import-actions { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; padding: 20px; background: #0e141d; border: 1px solid #29384c; }
.paper-file-label { color: #b8c5d2; font-size: .59rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.paper-import-actions input[type="file"] { width: 100%; color: #8a99ad; font-family: var(--font-body); font-size: .72rem; }
.paper-import-actions input[type="file"]::file-selector-button { margin-right: 10px; padding: 9px 12px; background: #151c27; border: 1px solid #40b5eb; color: #40b5eb; cursor: pointer; font: inherit; font-weight: 700; text-transform: uppercase; }
.paper-import-status, .paper-contact-note { color: #8a99ad; font-size: .72rem; line-height: 1.5; }
.analytics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: #29384c; }
.analytics-card { min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end; padding: 22px; background: #0e141d; }
.analytics-card > span, .analytics-bars span { color: #8a99ad; font-size: .6rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.analytics-card strong { margin: 8px 0; color: #fff; font-family: var(--font-display); font-size: 1.55rem; font-weight: 500; line-height: 1.05; }
.analytics-card small { color: #40b5eb; font-size: .68rem; }
.analytics-bars { justify-content: center; gap: 10px; }
.analytics-bars > div { display: flex; justify-content: space-between; gap: 10px; }
.analytics-track { height: 5px; overflow: hidden; background: #29384c; }
.analytics-track i { display: block; height: 100%; background: #40b5eb; }

.settings-strip { display: flex; flex-wrap: wrap; gap: 14px; margin: 20px 0; }
.settings-strip label { display: flex; align-items: center; gap: 9px; color: #b8c5d2; font-size: .67rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.settings-strip input[type="number"] { width: 90px; padding: 9px; background: #0e141d; border: 1px solid #29384c; color: #fff; }
.settings-strip input[type="checkbox"], .menu-manager-category input { accent-color: #40b5eb; }
.setting-toggle { padding: 10px 14px; border: 1px solid #40b5eb; }
.settings-note { margin-bottom: 14px; color: #8a99ad; font-size: .75rem; }
.pickup-window-setting { display: flex; flex-direction: column; gap: 7px; margin: 4px 0 18px; color: #b8c5d2; font-size: .67rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.pickup-window-setting span { color: #657387; font-size: .58rem; }
.pickup-window-setting textarea { width: min(100%, 620px); padding: 12px; resize: vertical; background: #0e141d; border: 1px solid #29384c; color: #fff; font-family: var(--font-body); line-height: 1.5; }
.pickup-window-setting textarea:focus { border-color: #40b5eb; outline: none; }
.menu-manager-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.menu-manager-category { padding: 18px; background: #0e141d; border: 1px solid #29384c; }
.menu-manager-category h3 { margin-bottom: 12px; color: #40b5eb; font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; }
.menu-manager-category label { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; color: #dbe6f0; font-size: .74rem; border-bottom: 1px solid #1d2938; cursor: pointer; }
.settings-actions, .section-tools, .modal-contact-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-actions { margin-top: 18px; }
.section-tools { align-items: center; }
.modal-contact-actions { margin-top: 14px; }
.modal-contact-actions a { text-decoration: none; }

@media (max-width: 1000px) {
  .analytics-grid, .menu-manager-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .analytics-grid, .menu-manager-grid { grid-template-columns: 1fr; }
  .paper-import { grid-template-columns: 1fr; padding: 20px; }
  .section-tools .action-btn { font-size: .54rem; padding: 7px; }
}

@media print {
  body.printing-prep { background: #fff; color: #111; }
  body.printing-prep > * { display: none !important; }
  body.printing-prep .admin-container { display: block !important; padding: 0; }
  body.printing-prep .admin-container > * { display: none !important; }
  body.printing-prep .prep-summary-section { display: block !important; border: 0; background: #fff; }
  body.printing-prep .prep-summary-section .section-header { display: flex !important; border-bottom: 2px solid #111; }
  body.printing-prep .prep-summary-section .section-tools { display: none !important; }
  body.printing-prep #prep-summary-content { display: block !important; padding: 20px 0; }
  body.printing-prep .prep-summary-grid { display: grid !important; grid-template-columns: repeat(2, 1fr); }
  body.printing-prep .prep-category { background: #fff; border: 1px solid #bbb; color: #111; break-inside: avoid; }
  body.printing-prep .prep-category h4, body.printing-prep .prep-item { color: #111; }
}
