/* ========================================
   BakeryOS — Base Styles
   Variables, Reset, Layout, Sidebar, Header
   ======================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  --primary: #1e293b;
  --primary-light: #334155;
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-light: #fef3c7;
  --accent-bg: #fffbeb;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #2563eb;
  --info-light: #dbeafe;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 260px;
  --header-height: 64px;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--primary);
}
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
p { color: var(--text-secondary); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Layout ---------- */
.app-layout { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff; font-weight: 700;
}

.sidebar-logo .logo-text {
  font-size: 1.15rem; font-weight: 700; color: var(--primary); letter-spacing: -0.3px;
}

.sidebar-logo .logo-sub {
  font-size: 0.65rem; color: var(--text-muted); font-weight: 400;
  letter-spacing: 0.5px; text-transform: uppercase;
}

.sidebar-nav {
  flex: 1; padding: 12px 10px; overflow-y: auto;
}

.sidebar-nav-label {
  font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1px; font-weight: 600; padding: 16px 12px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition-fast);
  color: var(--text-secondary); font-size: 0.875rem;
  font-weight: 500; user-select: none;
  border: none; background: none; width: 100%; text-align: left;
  font-family: var(--font);
}

.nav-item:hover { background: var(--bg-subtle); color: var(--primary); }

.nav-item.active {
  background: var(--accent-light); color: var(--accent-hover); font-weight: 600;
}

.nav-item .nav-icon { font-size: 1.15rem; width: 24px; text-align: center; flex-shrink: 0; }

.nav-item .nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 0.65rem; padding: 2px 7px; border-radius: var(--radius-full); font-weight: 600;
}

/* ---------- Sidebar Overlay (mobile) ---------- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.3); z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ---------- Main Content ---------- */
.main-content {
  flex: 1; margin-left: var(--sidebar-width);
  min-height: 100vh; background: var(--bg-subtle);
}

/* ---------- Top Header ---------- */
.top-header {
  height: var(--header-height);
  background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 16px; }

.menu-toggle {
  display: none; background: none; border: none;
  font-size: 1.4rem; cursor: pointer; color: var(--primary); padding: 4px;
}

.page-title { font-size: 1.1rem; font-weight: 600; color: var(--primary); }

.header-right { display: flex; align-items: center; gap: 12px; }

.branch-selector {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.8rem; font-family: var(--font); color: var(--text);
  background: var(--bg); cursor: pointer; outline: none; transition: var(--transition-fast);
}

.branch-selector:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.header-avatar {
  width: 34px; height: 34px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 0.8rem;
}

/* ---------- Page Container ---------- */
.page { display: none; padding: 24px; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Utility Classes ---------- */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }
