/* Admin Dashboard Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --black: #0A0A0A;
  --caramel: #C47C3A;
  --caramel-light: #FFF3E4;
  --cream: #F5EDD8;
  --offwhite: #FDFAF7;
  --text: #1A1209;
  --muted: #7A6A52;
  --border: #E8DCC8;
  --white: #FFFFFF;
  --sidebar: 240px;
  --status-new: #1565C0;
  --status-making: #E65100;
  --status-ready: #2E7D32;
  --status-shipped: #6A1B9A;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #F7F4F0; color: var(--text); display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar); background: var(--black); color: white;
  display: flex; flex-direction: column; min-height: 100vh; position: fixed; top: 0; left: 0;
}
.admin-logo {
  padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px;
}
.admin-logo img { height: 36px; border-radius: 4px; filter: invert(1); }
.admin-logo-text { font-size: .85rem; font-weight: 600; color: white; }
.admin-logo-sub { font-size: .68rem; color: rgba(255,255,255,.4); }

.admin-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.admin-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: rgba(255,255,255,.65); font-size: .875rem;
  font-weight: 500; cursor: pointer; transition: all .15s; text-decoration: none;
}
.admin-nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.admin-nav-item.active { background: var(--caramel); color: white; }
.admin-nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.admin-signout {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1);
}
.admin-signout button {
  width: 100%; padding: 10px; border-radius: 8px;
  background: rgba(255,255,255,.06); color: rgba(255,255,255,.6);
  font-size: .85rem; font-weight: 500; cursor: pointer; border: none;
  transition: all .15s;
}
.admin-signout button:hover { background: rgba(255,255,255,.12); color: white; }

/* Main */
.admin-main { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; }
.admin-header {
  background: white; border-bottom: 1px solid var(--border);
  padding: 0 32px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.admin-page-title { font-size: 1.1rem; font-weight: 600; }
.admin-header-right { display: flex; align-items: center; gap: 16px; }
.admin-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--caramel); color: white;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem;
}

.admin-content { padding: 32px; flex: 1; }

/* Stats Bar */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: white; border-radius: 12px; padding: 24px;
  border: 1px solid var(--border);
}
.stat-card-label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.stat-card-value { font-size: 2rem; font-weight: 700; color: var(--black); }
.stat-card-sub { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* Orders Table */
.table-card {
  background: white; border-radius: 12px;
  border: 1px solid var(--border); overflow: hidden;
}
.table-card-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.table-card-title { font-size: 1rem; font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 12px 16px; font-size: .75rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border-bottom: 1px solid var(--border); background: #FAFAF8;
}
td { padding: 14px 16px; font-size: .875rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFAF8; }

.status-badge {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.status-new { background: #E3F2FD; color: var(--status-new); }
.status-making { background: #FFF3E0; color: var(--status-making); }
.status-ready { background: #E8F5E9; color: var(--status-ready); }
.status-shipped { background: #F3E5F5; color: var(--status-shipped); }

.order-actions select {
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: .8rem; cursor: pointer; background: white;
}
.expand-btn { cursor: pointer; color: var(--caramel); font-weight: 600; font-size: .8rem; }
.order-detail-row { display: none; background: var(--offwhite); }
.order-detail-row.visible { display: table-row; }
.order-detail-inner { padding: 16px 20px; font-size: .875rem; color: var(--muted); }
.order-items-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.order-item-line { display: flex; justify-content: space-between; padding: 4px 0; }

/* Products Tab */
.products-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-admin-card {
  background: white; border-radius: 12px; border: 1px solid var(--border);
  overflow: hidden;
}
.product-admin-img { height: 160px; overflow: hidden; }
.product-admin-img img { width: 100%; height: 100%; object-fit: cover; }
.product-admin-body { padding: 16px; }
.product-admin-name { font-weight: 600; margin-bottom: 4px; }
.product-admin-price { color: var(--muted); font-size: .875rem; margin-bottom: 12px; }
.stock-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 500;
}
.toggle-switch { position: relative; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: #ddd; border-radius: 22px;
  cursor: pointer; transition: .3s;
}
.toggle-slider:before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: .3s;
}
input:checked + .toggle-slider { background: var(--caramel); }
input:checked + .toggle-slider:before { transform: translateX(18px); }

/* Login */
.admin-login {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--black); flex-direction: column; gap: 0;
}
.admin-login-card {
  background: white; border-radius: 16px; padding: 48px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.admin-login-logo { text-align: center; margin-bottom: 32px; }
.admin-login-logo img { height: 64px; margin: 0 auto 12px; border-radius: 8px; }
.admin-login-logo h1 { font-size: 1.4rem; font-weight: 700; }
.admin-login-logo p { color: var(--muted); font-size: .875rem; margin-top: 4px; }
.login-error {
  background: #FFEBEE; color: #C62828; padding: 12px 16px;
  border-radius: 8px; font-size: .875rem; margin-bottom: 16px; display: none;
}

/* Tabs */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 28px; }
.admin-tab {
  padding: 10px 20px; font-size: .9rem; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .2s;
}
.admin-tab.active { color: var(--caramel); border-bottom-color: var(--caramel); }

/* Responsive */
@media (max-width: 900px) {
  .admin-sidebar { width: 60px; }
  .admin-logo-text, .admin-nav-item span { display: none; }
  .admin-main { margin-left: 60px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
}
