:root {
  --saffron: #ff9933;
  --navy: #001f3f;
  --paper: #f5f8fc;
  --ink: #1e293b;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Lora", "Segoe UI", serif;
  color: var(--ink);
  background: linear-gradient(150deg, #edf4fb, #fff6ea);
}

.admin-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: linear-gradient(170deg, var(--navy), #0f3e6c);
  color: var(--white);
  padding: 1.2rem;
}

.admin-sidebar h1 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: 1.1rem;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.admin-brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: contain;
}

.admin-nav {
  margin-top: 1.3rem;
  display: grid;
  gap: 0.6rem;
}

.admin-nav button {
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  padding: 0.62rem;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}

.admin-content {
  padding: 1.3rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--white);
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid rgba(0, 31, 63, 0.12);
  box-shadow: 0 8px 20px rgba(0, 31, 63, 0.08);
}

.card {
  background: var(--white);
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid rgba(0, 31, 63, 0.12);
  box-shadow: 0 8px 20px rgba(0, 31, 63, 0.08);
  margin-bottom: 1rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

.grid-2 {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field {
  display: grid;
  gap: 0.3rem;
}

.form-field > span {
  font-size: 0.9rem;
  color: #3f4e5e;
  font-weight: 600;
}

.toggle-row {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.toggle-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: #243447;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.55rem;
  border-bottom: 1px solid #e5e7eb;
}

.idea-description-preview {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.idea-description-btn {
  border: 0;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
  padding: 0;
}

.product-image-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-height: 0;
}

.product-image-preview-strip.is-empty {
  color: #5a6a7a;
}

.product-image-preview-item {
  width: 78px;
  height: 78px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 31, 63, 0.14);
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(0, 31, 63, 0.08);
}

.product-image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-image-preview-item {
  position: relative;
  cursor: grab;
}

.product-image-preview-item.dragging {
  opacity: 0.55;
}

.product-image-preview-remove,
.product-image-remove-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 31, 63, 0.8);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  font-size: 0.8rem;
}

.product-image-manager-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.product-image-manager-item {
  position: relative;
  border: 1px solid rgba(0, 31, 63, 0.14);
  border-radius: 14px;
  overflow: hidden;
  background: #f8fafc;
  cursor: grab;
}

.product-image-manager-item.dragging {
  opacity: 0.55;
}

.product-image-manager-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.product-image-manager-meta {
  padding: 0.45rem 0.55rem 0.55rem;
  display: grid;
  gap: 0.35rem;
}

.product-image-manager-meta small {
  color: #5a6a7a;
  font-size: 0.78rem;
}

.product-image-manager-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.9rem;
}

.order-details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.order-details-block {
  background: rgba(0, 31, 63, 0.03);
  border: 1px solid rgba(0, 31, 63, 0.08);
  border-radius: 14px;
  padding: 0.85rem;
}

.order-details-block h4 {
  margin: 0 0 0.55rem;
  color: var(--navy);
}

.order-details-block p {
  margin: 0 0 0.35rem;
  color: #243447;
}

.order-items-list {
  display: grid;
  gap: 0.75rem;
}

.order-item-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
}

.order-item-row img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
}

.order-item-total {
  font-weight: 700;
  color: var(--navy);
}

.admin-modal-dialog-wide {
  width: min(920px, calc(100vw - 32px));
}

.admin-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1100;
  overflow-y: auto;
  padding: 3vh 0;
}

.admin-modal.open {
  display: block;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 23, 43, 0.45);
}

.admin-modal-dialog {
  position: relative;
  width: min(680px, calc(100vw - 32px));
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(0, 31, 63, 0.25);
  overflow: visible;
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.admin-modal-header h3 {
  margin: 0;
}

.admin-modal-close {
  border: 0;
  background: rgba(0, 31, 63, 0.08);
  color: var(--navy);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
}

.admin-modal-body {
  padding: 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.58rem 0.95rem;
  cursor: pointer;
}

.btn-primary {
  color: var(--white);
  background: linear-gradient(140deg, var(--saffron), #f97316);
}

.btn-secondary {
  color: var(--white);
  background: var(--navy);
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    padding: 0.95rem;
  }

  .admin-content {
    padding: 1rem;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-nav button {
    text-align: center;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .admin-content {
    padding: 0.8rem;
  }

  .card,
  .stat-card {
    padding: 0.8rem;
  }

  th,
  td {
    font-size: 0.88rem;
    padding: 0.45rem;
    white-space: nowrap;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .admin-modal-dialog {
    width: calc(100vw - 16px);
    margin: 0 auto;
  }

  .admin-modal-dialog-wide {
    width: calc(100vw - 16px);
  }

  .order-details-grid {
    grid-template-columns: 1fr;
  }
}
