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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #222222;
  --text: #ffffff;
  --text-muted: #666666;
  --accent: #ffffff;
  --error: #ff4444;
  --success: #22c55e;
  --sidebar-w: 220px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ── LOGIN ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-box {
  width: 100%;
  max-width: 380px;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-logo {
  height: 20px;
  width: auto;
  display: block;
  margin: 0 auto;
}

.login-subtitle {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── FIELDS ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input, input[type="text"], input[type="number"], input[type="email"],
input[type="password"], select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}

.field input:focus, input:focus, select:focus, textarea:focus {
  border-color: #444;
}

select option { background: var(--surface2); }

textarea { resize: vertical; min-height: 80px; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 11px 24px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  transition: opacity 0.2s;
  width: 100%;
}

.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 10px 24px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s;
}

.btn-secondary:hover { color: var(--text); border-color: #555; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 12px;
  transition: color 0.2s, border-color 0.2s;
}

.btn-icon:hover { color: var(--error); border-color: var(--error); }

/* ── ERROR / SUCCESS ── */
.error-msg, .form-error {
  font-size: 12px;
  color: var(--error);
  min-height: 16px;
}

.form-success {
  font-size: 12px;
  color: var(--success);
  min-height: 16px;
}

/* ── DASHBOARD LAYOUT ── */
.dashboard-page {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar__logo {
  padding: 28px 24px;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo img { height: 18px; width: auto; }

.sidebar__nav {
  flex: 1;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}

.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active { color: var(--text); background: var(--surface2); }

.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  transition: color 0.2s;
  width: 100%;
  text-align: left;
}

.sidebar__logout:hover { color: var(--error); }

/* MAIN */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 40px;
  max-width: 1000px;
}

/* SECTION */
.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.section-header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-header .btn-primary { width: auto; }

/* ── PRODUCTS TABLE ── */
.products-table-wrap {
  overflow-x: auto;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
}

.products-table th {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}

.products-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.products-table tr:hover td { background: var(--surface2); }

.prod-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  background: var(--surface2);
  display: block;
}

.prod-img-placeholder {
  width: 44px;
  height: 44px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 10px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge--in { background: rgba(34,197,94,0.15); color: var(--success); }
.badge--out { background: rgba(255,68,68,0.12); color: var(--error); }

.shopier-link {
  font-size: 11px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.shopier-link:hover { color: var(--text); }

/* ── PRODUCT FORM ── */
.product-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 700px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hint {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

/* IMAGE UPLOAD */
.image-upload-area {
  border: 1px dashed var(--border);
  padding: 8px;
  min-height: 120px;
}

.image-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
}

.image-upload-placeholder:hover { color: var(--text); }

.image-upload-placeholder p { font-size: 13px; }
.image-upload-placeholder span { font-size: 11px; }

.image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.preview-item {
  position: relative;
  width: 80px;
  height: 80px;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-item .remove-img {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  border: none;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* SIZES */
.size-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.size-check {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.05em;
  transition: border-color 0.2s;
}

.size-check:has(input:checked) {
  border-color: #555;
  color: var(--text);
}

.size-check input { accent-color: var(--text); }

/* PROGRESS */
.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar {
  height: 2px;
  background: var(--surface2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--text);
  width: 0%;
  transition: width 0.3s;
}

#progressText {
  font-size: 12px;
  color: var(--text-muted);
}

/* FORM ACTIONS */
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-actions .btn-primary { width: auto; }

/* LOADING */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--text-muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--surface2);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

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

@media (max-width: 640px) {
  .main { padding: 24px 16px; margin-left: 0; }
  .sidebar { display: none; }
  .form-row { grid-template-columns: 1fr; }
}
