.admin-body {
  min-height: 100vh;
}

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: min(420px, 100%);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--card-border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  padding: 36px;
  text-align: center;
}

.login-box h1 {
  font-size: 1.9rem;
  margin-bottom: 8px;
  letter-spacing: -0.04em;
}

.login-sub {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 0.92rem;
}

.login-box label {
  display: block;
  text-align: left;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 16px;
  font-weight: 500;
}

.login-error {
  color: #ff6b6b;
  font-size: 0.86rem;
  min-height: 1.2em;
  margin-bottom: 8px;
}

.login-note {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
  margin-top: 18px;
}

.back-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--purple-light);
  font-size: 0.86rem;
  font-weight: 600;
}

/* Form fields (shared by login + modals) */
input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 0.94rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--purple-light);
}

.full-width {
  width: 100%;
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 0.96rem;
}

/* Dashboard layout */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.side-nav {
  width: 240px;
  flex-shrink: 0;
  background: rgba(20, 4, 38, 0.6);
  border-right: 1px solid var(--card-border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-nav .logo {
  font-size: 1.2rem;
  font-weight: 800;
}

.side-nav nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: white;
  background: rgba(157, 78, 221, 0.22);
  border-color: rgba(199, 125, 255, 0.4);
}

.dashboard-content {
  flex: 1;
  padding: 40px min(5%, 48px);
  max-width: 100%;
  overflow-x: hidden;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  margin-bottom: 28px;
  position: relative;
}

.view-header h2 {
  font-size: 2rem;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}

.view-sub {
  color: var(--muted);
}

.view-header .btn {
  margin-top: 16px;
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 0.94rem;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}

.stat-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
}

.panel {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 24px;
}

.panel h3 {
  margin-bottom: 14px;
  font-size: 1.1rem;
}

.recent-orders {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-orders li {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

/* Products grid (admin) */
.admin-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.admin-product-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--card-border);
  border-radius: 22px;
  overflow: hidden;
}

.admin-product-card img,
.admin-product-card .placeholder-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.admin-product-card .placeholder-image {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  background: radial-gradient(circle, #e0aaff, #7b2cbf 55%, #240046);
  text-transform: uppercase;
}

.admin-product-info {
  padding: 16px;
}

.admin-product-info h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.admin-product-info p {
  color: var(--purple-light);
  font-weight: 700;
  margin-bottom: 12px;
}

.admin-product-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(199, 125, 255, 0.14);
  border: 1px solid rgba(199, 125, 255, 0.42);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  color: white;
  font-family: inherit;
  display: inline-block;
}

.btn-small.danger {
  background: rgba(255, 78, 78, 0.14);
  border-color: rgba(255, 78, 78, 0.42);
}

/* Tables */
.table-wrap {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 8px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th, td {
  text-align: left;
  padding: 14px 16px;
  font-size: 0.88rem;
}

th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

tbody tr {
  border-top: 1px solid var(--card-border);
}

.status-select {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.82rem;
  width: auto;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

/* Messages */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 18px 20px;
  cursor: pointer;
}

.message-card.unread {
  border-color: rgba(199, 125, 255, 0.6);
  box-shadow: 0 0 24px rgba(157, 78, 221, 0.2);
}

.message-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.message-head span {
  color: var(--muted);
}

.message-email {
  color: var(--purple-light);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.message-body {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.message-actions {
  display: flex;
  gap: 8px;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3, 0, 8, 0.72);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

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

.modal-box {
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #240046, #10002b);
  border: 1px solid var(--card-border);
  border-radius: 26px;
  padding: 32px;
  position: relative;
}

.modal-box h3 {
  margin-bottom: 18px;
  font-size: 1.3rem;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: white;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.modal-box label {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 14px;
}

.modal-sub {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: -12px;
  margin-bottom: 18px;
}

.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.image-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
}

.remove-thumb {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

#orderModalBody p {
  margin-bottom: 8px;
  font-size: 0.92rem;
}

#orderModalBody hr {
  border: none;
  border-top: 1px solid var(--card-border);
  margin: 14px 0;
}

#orderModalBody ul {
  list-style: none;
  margin-bottom: 10px;
}

#orderModalBody li {
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 860px) {
  .dashboard {
    flex-direction: column;
  }

  .side-nav {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .side-nav nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
  }

  .side-nav .full-width {
    width: auto;
  }

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