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

:root {
  --bg-deep: #050511;
  --bg-surface: rgba(14, 18, 34, 0.6);
  --bg-surface-hover: rgba(22, 28, 52, 0.8);
  --card-border: rgba(255, 255, 255, 0.08);
  --glow: rgba(56, 189, 248, 0.2);
  
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-glow: rgba(56, 189, 248, 0.4);
  
  --danger: #f43f5e;
  --danger-glow: rgba(244, 63, 94, 0.4);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 12px 35px rgba(0, 0, 0, 0.3);
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  
  --transition: 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  margin: 0;
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(56, 189, 248, 0.1), transparent 30%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08), transparent 30%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Outfit', system-ui, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.25rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.muted { color: var(--text-secondary); font-size: 0.9rem; }

/* Dashboard Shell */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem 2.5rem;
  background: rgba(14, 18, 34, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
  position: sticky; top: 0; z-index: 50;
}

.brand {
  font-weight: 700; font-size: 1.25rem;
  color: #fff; display: flex; align-items: center; gap: 0.75rem;
}
.brand::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 15px var(--primary-glow);
}

.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav a { color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: color var(--transition); }
.nav a:hover { color: #fff; }

.page { max-width: 1400px; margin: 0 auto; padding: 2.5rem; }

/* Panel & Card */
.panel { display: flex; justify-content: center; align-items: center; min-height: 70vh; }
.panel .card { width: 100%; max-width: 440px; padding: 3rem; text-align: center; }

.card {
  background: var(--bg-surface);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border); border-radius: var(--radius-lg);
  padding: 1.75rem; box-shadow: var(--shadow-md);
  transition: transform var(--transition), border-color var(--transition);
}

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5rem; margin-top: 1rem; }
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-4 { grid-column: span 4; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;}

/* Stats */
.stat-row { grid-column: span 12; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.stat-card {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(14, 18, 34, 0.8) 100%);
  border: 1px solid var(--card-border); border-radius: var(--radius-lg);
  padding: 2rem; position: relative; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}
.stat-card::before { content: ''; position: absolute; right: -20px; bottom: -20px; width: 100px; height: 100px; background: var(--primary); filter: blur(60px); opacity: 0.15; }
.stat-card h3 { font-size: 3rem; margin: 0.5rem 0; color: #fff; line-height: 1; }
.stat-card .eyebrow { color: var(--text-primary); opacity: 0.8; }

/* Chart */
.chart-wrap { margin-top: 1.5rem; background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.03); border-radius: var(--radius-md); padding: 1.5rem; height: 300px; display: flex; align-items: center; justify-content: center; }
#ordersChart { width: 100%; height: 100%; }

/* Forms & Inputs */
.form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; text-align: left; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
input, select {
  background: rgba(0,0,0,0.3); border: 1px solid var(--card-border); color: var(--text-primary);
  padding: 0.8rem 1.25rem; border-radius: var(--radius-md); font-family: inherit; font-size: 0.95rem;
  width: 100%; transition: all var(--transition); outline: none; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: rgba(0,0,0,0.5); }
.inline { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; color: var(--text-primary); font-weight: 500; }
.inline input[type="checkbox"] { width: 22px; height: 22px; cursor: pointer; accent-color: var(--primary); background: rgba(0,0,0,0.3); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.8rem 1.5rem; border-radius: var(--radius-pill); font-family: inherit; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; transition: all var(--transition); border: none; white-space: nowrap;
}
.btn.primary { background: var(--primary); color: #020617; box-shadow: 0 4px 15px var(--primary-glow); }
.btn.primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5); }
.btn.ghost { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); border: 1px solid rgba(255, 255, 255, 0.1); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-2px); border-color: rgba(255,255,255,0.2); }
.btn.danger { background: rgba(244, 63, 94, 0.1); color: var(--danger); border: 1px solid rgba(244, 63, 94, 0.3); }
.btn.danger:hover { background: var(--danger); color: #fff; box-shadow: 0 4px 15px var(--danger-glow); border-color: var(--danger); }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

/* Camera */
.camera-box { background: rgba(0,0,0,0.2); border: 1px dashed rgba(255,255,255,0.15); border-radius: var(--radius-md); padding: 1.25rem; }
.camera-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
#cameraPreview { width: 100%; height: 260px; border-radius: var(--radius-sm); background: #000; object-fit: cover; border: 1px solid var(--card-border); margin-bottom: 1rem; }

/* Lists & Tables (Orders) */
.order-body { max-height: 480px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; padding-right: 0.5rem; }
.order-row {
  background: rgba(255,255,255,0.03); border: 1px solid var(--card-border); border-radius: var(--radius-md);
  padding: 1.25rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  transition: all var(--transition);
}
.order-row:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); transform: translateX(4px); }
.order-row p { margin: 0; }
.order-row p:first-child { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.25rem; color: #fff; }

/* Catalog View */
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }
.product-card {
  background: rgba(0,0,0,0.2); border: 1px solid var(--card-border); border-radius: var(--radius-md);
  padding: 1.25rem; display: flex; flex-direction: column; transition: all var(--transition);
}
.product-card:hover { border-color: rgba(255,255,255,0.15); box-shadow: 0 8px 25px rgba(0,0,0,0.2); transform: translateY(-4px); }
.product-image {
  width: 100%; height: 180px; border-radius: var(--radius-sm); background-size: cover; background-position: center;
  background-color: rgba(0,0,0,0.4); margin-bottom: 1rem; border: 1px solid rgba(255,255,255,0.05);
}
.product-image.placeholder { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.06) 100%); color: var(--text-tertiary); }
.product-card .btn-row { margin-top: auto; padding-top: 1rem; }
.product-card .btn { padding: 0.6rem 1rem; flex: 1; min-width: 80px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(5, 5, 17, 0.85); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; z-index: 100; transition: opacity 0.3s ease; }
.modal-content { background: rgba(14, 18, 34, 0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-lg); padding: 2.5rem; width: 90%; max-width: 550px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.1); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; border-bottom: 1px solid var(--card-border); padding-bottom: 1rem; }

.hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; border: 2px solid var(--bg-deep); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

@media (max-width: 1024px) {
  .span-8, .span-4, .span-12 { grid-column: span 12; }
}

@media (max-width: 640px) {
  .topbar { padding: 1rem; }
  .nav { gap: 1rem; }
  .page { padding: 1.5rem; }
  .card { padding: 1.5rem; }
  .stat-card { padding: 1.5rem; }
  .stat-card h3 { font-size: 2.5rem; }
  .split { grid-template-columns: 1fr; }
  .btn-row .btn { flex: 1; }
  .order-row { flex-direction: column; align-items: stretch; }
  .modal-content { padding: 1.5rem; }
}
