/* ============================================
   RESET & BASE
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --black: #080808;
  --dark: #111111;
  --darker: #1a1a1a;
  --red: #d71920;
  --red-hover: #b3131a;
  --white: #ffffff;
  --light-bg: #f5f5f5;
  --border: #e5e5e5;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --radius: 4px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--light-bg);
  color: #222;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

/* ===== BADGE ===== */
.badge {
  background: var(--red);
  color: var(--white);
  padding: 2px 10px;
  border-radius: 30px;
  font-size: 0.7rem;
  font-weight: 700;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ===== AUTH SCREEN ===== */
#auth-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
}

.auth-box {
  background: var(--white);
  padding: 2.5rem;
  border-radius: var(--radius);
  width: 340px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-box h2 {
  margin-bottom: 1.5rem;
  color: var(--black);
  font-weight: 800;
}

.auth-box label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.auth-box input {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-box button {
  width: 100%;
  margin-top: 1.5rem;
  background: var(--red);
  color: var(--white);
  border: none;
  padding: 0.8rem;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.auth-box button:hover {
  background: var(--red-hover);
}

.error {
  color: var(--red);
  margin-top: 0.5rem;
}

/* ===== HEADER ===== */
header {
  background: var(--black);
  color: var(--white);
  padding: 0.8rem 0;
  border-bottom: 1px solid #2a2a2a;
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-logo {
  height: 40px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}
header h1 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 1px;
}
#logout-btn {
  background: var(--red);
  border: none;
  color: var(--white);
  padding: 0.4rem 1.2rem;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
#logout-btn:hover {
  background: var(--red-hover);
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
}

.sidebar {
  width: 220px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 0;
  box-shadow: var(--shadow);
  height: fit-content;
  transition: max-height 0.3s ease, padding 0.3s ease;
  overflow: hidden;
}
.sidebar ul {
  list-style: none;
}
.sidebar li a {
  display: block;
  padding: 0.7rem 1.5rem;
  color: #1e293b;
  text-decoration: none;
  border-left: 4px solid transparent;
  font-weight: 500;
  transition: all 0.2s;
}
.sidebar li a.active,
.sidebar li a:hover {
  background: #f1f5f9;
  border-left-color: var(--red);
  color: var(--black);
}

#admin-content {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
  min-height: 500px;
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--light-bg);
  padding: 1.2rem;
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--border);
}
.stat-card .number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--black);
}
.stat-card .label {
  color: #64748b;
  font-size: 0.85rem;
}

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: #f8fafc;
  font-weight: 600;
}
tr:hover td {
  background: #f8fafc;
}

/* ===== BUTTONS ===== */
.btn-sm {
  padding: 0.25rem 0.8rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: background 0.2s, transform 0.1s;
}
.btn-sm:hover {
  transform: translateY(-1px);
}
.btn-confirm { background: #22c55e; color: white; }
.btn-confirm:hover { background: #16a34a; }
.btn-cancel { background: #e11d48; color: white; }
.btn-cancel:hover { background: #be123c; }
.btn-complete { background: #0ea5e9; color: white; }
.btn-complete:hover { background: #0284c7; }
.btn-edit { background: #f59e0b; color: white; }
.btn-edit:hover { background: #d97706; }
.btn-delete { background: var(--red); color: white; }
.btn-delete:hover { background: var(--red-hover); }
.btn-detail { background: var(--black); color: white; }
.btn-detail:hover { background: var(--dark); }

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.form-group input[type="file"] {
  padding: 0.3rem;
}
.full-width {
  grid-column: 1 / -1;
}

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}
.toolbar input,
.toolbar select {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-content.wide {
  max-width: 800px;
}
.close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.8rem;
  cursor: pointer;
  color: #94a3b8;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--black);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease;
}
.toast.success {
  background: #22c55e;
}
.toast.error {
  background: #e11d48;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== LOW STOCK WARNING ===== */
.low-stock-warning {
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  margin: 0.4rem 0;
  list-style: none;
}

/* ===== CATEGORY TAGS ===== */
.category-tag {
  display: inline-block;
  background: #e2e8f0;
  padding: 2px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
}

/* ===== CATEGORY CARDS ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.card-grid .category-card {
  background: #f8fafc;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-grid .category-card .cat-actions button {
  margin-left: 6px;
}

/* ===== MOBILE TOGGLE ===== */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  .dashboard-grid {
    flex-direction: column;
    gap: 1rem;
  }
  .sidebar {
    width: 100%;
    max-height: 0;
    padding: 0;
  }
  .sidebar.open {
    max-height: 400px;
    padding: 0.5rem 0;
  }
  .sidebar ul {
    display: flex;
    flex-direction: column;
  }
  .sidebar li a {
    padding: 0.5rem 1rem;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar li a.active {
    border-left: 4px solid var(--red);
    background: #f1f5f9;
  }
  #admin-content {
    padding: 1rem;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar input,
  .toolbar select {
    width: 100%;
  }
  .table-wrap {
    overflow-x: auto;
  }
  table {
    font-size: 0.75rem;
  }
  th, td {
    padding: 0.3rem 0.4rem;
  }
  .btn-sm {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
  }
  .modal-content {
    max-width: 95%;
    padding: 1rem;
  }
  .modal-content.wide {
    max-width: 95%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .stat-card .number {
    font-size: 1.2rem;
  }
  .stat-card .label {
    font-size: 0.7rem;
  }
  header h1 {
    font-size: 1rem;
  }
  .auth-box {
    width: 90%;
    padding: 1.5rem;
  }
  .admin-logo {
    height: 28px;
  }
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.pagination .page-btn {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--black);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  min-width: 40px;
}
.pagination .page-btn:hover:not(:disabled) {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}
.pagination .page-btn.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}
.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination .page-dots {
  padding: 0 6px;
  color: #999;
}
@media (max-width: 480px) {
  .pagination .page-btn {
    padding: 4px 10px;
    font-size: 0.8rem;
    min-width: 34px;
  }
}