/* =====================
   ADMIN PANEL STYLES
   ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #fdf6ec;
  --beige: #f5e6d0;
  --gold: #c9973a;
  --gold-light: #e8b85a;
  --gold-dark: #a07828;
  --brown: #5c3d1e;
  --brown-light: #7a5230;
  --text: #3a2a1a;
  --text-muted: #7a6a58;
  --white: #fff;
  --shadow: rgba(90, 55, 20, 0.12);
  --shadow-lg: rgba(90, 55, 20, 0.2);
  --danger: #d9534f;
  --danger-light: #fdecea;
  --success: #5cb85c;
  --success-light: #edf7ed;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
}

body {
  font-family: 'Arial', sans-serif;
  background: #f0ebe3;
  color: var(--text);
  min-height: 100vh;
}

/* =====================
   LOGIN OVERLAY
   ===================== */
#login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--brown) 0%, #3a2210 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  background: var(--white);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}

.login-logo {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
}

.login-box h1 {
  font-family: 'Georgia', serif;
  font-size: 1.6rem;
  color: var(--brown);
  margin-bottom: 0.3rem;
}

.login-box p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.login-box input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--beige);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: 'Arial', sans-serif;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
  background: var(--cream);
}

.login-box input:focus {
  outline: none;
  border-color: var(--gold);
}

.login-btn {
  width: 100%;
  padding: 0.9rem;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.login-btn:hover { background: var(--gold-dark); transform: translateY(-1px); }

.login-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin-top: 0.8rem;
  display: none;
}

/* =====================
   ADMIN LAYOUT
   ===================== */
#admin-app { display: none; min-height: 100vh; }

.admin-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--brown);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1.2rem;
}

.sidebar-brand h2 {
  color: #fff;
  font-family: 'Georgia', serif;
  font-size: 1.2rem;
}

.sidebar-brand span {
  font-size: 0.78rem;
  color: var(--gold-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active { background: var(--gold); color: #fff; }
.nav-item .nav-icon { font-size: 1.1rem; }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: rgba(255,255,255,0.5);
  font-size: 0.88rem;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0.5rem 1rem;
}

.back-btn:hover { color: rgba(255,255,255,0.85); }

/* =====================
   MAIN CONTENT
   ===================== */
.admin-main {
  margin-left: var(--sidebar-w);
  padding: 2.5rem;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-family: 'Georgia', serif;
  font-size: 1.8rem;
  color: var(--brown);
}

.page-header p {
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-size: 0.92rem;
}

.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 2px 16px var(--shadow);
  margin-bottom: 1.5rem;
}

.card h3 {
  font-family: 'Georgia', serif;
  font-size: 1.15rem;
  color: var(--brown);
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--beige);
}

/* Forms */
.form-group {
  margin-bottom: 1.4rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brown-light);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--beige);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: 'Arial', sans-serif;
  color: var(--text);
  background: var(--cream);
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 151, 58, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: 'Arial', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: var(--gold-dark); transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.9); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
}
.btn-outline:hover { background: var(--gold); color: #fff; }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

/* File Upload */
.file-drop {
  border: 2px dashed var(--beige);
  border-radius: var(--radius-sm);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--cream);
}

.file-drop:hover, .file-drop.drag-over {
  border-color: var(--gold);
  background: rgba(201, 151, 58, 0.05);
}

.file-drop input { display: none; }
.file-drop .drop-icon { font-size: 2rem; margin-bottom: 0.5rem; display: block; }
.file-drop p { font-size: 0.88rem; color: var(--text-muted); }
.file-drop p span { color: var(--gold); cursor: pointer; }

.upload-preview {
  margin-top: 1rem;
  max-width: 200px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: none;
}
.upload-preview img { width: 100%; height: 140px; object-fit: cover; }

/* Products Table */
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.products-list { display: flex; flex-direction: column; gap: 1rem; }

.product-item {
  background: var(--cream);
  border: 1px solid var(--beige);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  transition: box-shadow 0.2s;
}

.product-item:hover { box-shadow: 0 4px 16px var(--shadow); }

.product-item img {
  width: 72px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.product-item-info { flex: 1; min-width: 0; }
.product-item-info h4 { font-size: 0.98rem; color: var(--brown); margin-bottom: 0.2rem; }
.product-item-info p { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.product-item-price {
  font-size: 1rem;
  font-weight: bold;
  color: var(--gold);
  white-space: nowrap;
  margin: 0 1rem;
}

.product-item-actions { display: flex; gap: 0.5rem; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  display: none;
}

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

.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-family: 'Georgia', serif;
  font-size: 1.2rem;
  color: var(--brown);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.2rem;
}

.modal-close:hover { color: var(--danger); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--beige);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--brown);
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 12px var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon { font-size: 2rem; }
.stat-num { font-size: 1.8rem; font-weight: bold; color: var(--brown); font-family: 'Georgia', serif; }
.stat-label { font-size: 0.82rem; color: var(--text-muted); }

/* Hero preview */
.hero-preview {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .admin-sidebar { width: 100%; position: relative; }
  .admin-main { margin-left: 0; padding: 1.5rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
