:root {
  --primary: #1B5E20;
  --primary-light: #2E7D32;
  --primary-bg: #E8F5E9;
  --secondary: #8BC34A;
  --accent: #FF6F00;
  --bg: #F5F5F5;
  --card: #FFFFFF;
  --text: #212121;
  --text-secondary: #757575;
  --border: #E0E0E0;
  --error: #D32F2F;
  --success: #388E3C;
  --warning: #FFA726;
  --info: #42A5F5;
  --sidebar-width: 240px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page { display: none; }
.page.active { display: flex; }

.login-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 20px;
}

.login-logo {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 16px;
  width: 100px;
  height: 100px;
  background: white;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.logo-icon.small {
  width: 40px;
  height: 40px;
  font-size: 20px;
  border-radius: 10px;
  margin: 0;
}

.login-logo h1 {
  font-size: 28px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.login-logo p { opacity: 0.8; font-size: 14px; }

.form {
  background: var(--card);
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 420px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

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

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-light); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover { background: var(--primary-bg); }

.btn-full { width: 100%; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { opacity: 0.9; }

.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }

.error-text { color: var(--error); font-size: 13px; margin-top: 12px; text-align: center; }

#dashboard-page {
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-menu {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.sidebar-menu li {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.2s;
  font-size: 14px;
  border-radius: 0;
}

.sidebar-menu li:hover { background: rgba(255,255,255,0.1); }
.sidebar-menu li.active { background: rgba(255,255,255,0.2); font-weight: 600; }
.sidebar-menu li .icon { font-size: 18px; }

.sidebar-footer { padding: 20px; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.topbar {
  background: var(--card);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h2 { font-size: 20px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.content-section { display: none; padding: 24px; }
.content-section.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.orders { background: #E3F2FD; }
.stat-icon.pending { background: #FFF3E0; }
.stat-icon.revenue { background: #E8F5E9; }
.stat-icon.products { background: #F3E5F5; }
.stat-icon.warning { background: #FFF8E1; }
.stat-icon.danger { background: #FFEBEE; }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-secondary); }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.card h3 { margin-bottom: 16px; font-size: 16px; }

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

.section-header h3 { font-size: 18px; }

.filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

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

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover { background: var(--primary-bg); }

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-pending { background: #FFF3E0; color: #E65100; }
.status-confirmed { background: #E3F2FD; color: #1565C0; }
.status-processing { background: #F3E5F5; color: #7B1FA2; }
.status-shipped { background: #E0F2F1; color: #00695C; }
.status-delivered { background: #E8F5E9; color: #2E7D32; }
.status-cancelled { background: #FFEBEE; color: #C62828; }

.stock-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.stock-ok { background: #E8F5E9; color: #2E7D32; }
.stock-low { background: #FFF3E0; color: #E65100; }
.stock-out { background: #FFEBEE; color: #C62828; }

.empty-text { text-align: center; color: var(--text-secondary); padding: 40px; }

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
  background: var(--card);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { margin: 0; }

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-content .form { box-shadow: none; max-width: none; border-radius: 0; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.actions-cell {
  display: flex;
  gap: 6px;
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.filter-bar select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  min-width: 200px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.page-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.page-btn:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.table-container {
  overflow-x: auto;
}

code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}
