:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --accent: #0ea5e9;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text-primary); }

.sidebar { position: fixed; left: 0; top: 0; width: 260px; height: 100vh; background: var(--sidebar-bg); overflow-y: auto; z-index: 100; display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: #475569 transparent; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background-color: #475569; border-radius: 3px; }

.sidebar-logo { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.07); display: flex; flex-direction: column; gap: 4px; }
.sidebar-brand { font-size: 18px; font-weight: 800; background: linear-gradient(135deg, #60a5fa, #38bdf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: flex; align-items: center; gap: 8px;}
.sidebar-subtitle { font-size: 11px; color: #475569; text-transform: uppercase; letter-spacing: 0.05em; margin-left: 28px; }

.nav-menu { list-style: none; padding: 12px 0; flex: 1; margin: 0;}
.nav-item { position: relative; }
.nav-link { display: flex; align-items: center; padding: 11px 20px; color: #94a3b8; text-decoration: none; transition: all 0.2s ease; border-radius: 0; gap: 0; }
.nav-link:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }
.nav-item.active .nav-link { color: #fff; background: rgba(30,64,175,0.25); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 100%; background: linear-gradient(180deg, #3b82f6, #0ea5e9); border-radius: 0 2px 2px 0; }
.nav-icon { width: 18px; text-align: center; margin-right: 12px; font-size: 15px; flex-shrink: 0; }
.nav-text { font-size: 13.5px; font-weight: 500; }
.nav-section-title { padding: 20px 20px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: #475569; font-weight: 600; }
.nav-disabled .nav-link { opacity: 0.5; cursor: not-allowed; }

.sidebar-user { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.06); display: flex; gap: 10px; align-items: center; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #1e40af, #0ea5e9); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; flex-shrink: 0; }

.top-bar { position: fixed; top: 0; left: 260px; right: 0; height: 64px; background: white; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; z-index: 99; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.top-bar-left .page-title { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 0; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }

.main-content { margin-left: 260px; padding: 88px 24px 32px; min-height: 100vh; background: var(--bg); }

.page-header { margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
@media(max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media(max-width: 640px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card { background: white; border-radius: 14px; padding: 22px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid var(--border); transition: transform 0.2s, box-shadow 0.2s; cursor: default; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.stat-icon { width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.icon-blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.icon-green { background: rgba(16,185,129,0.1); color: #10b981; }
.icon-orange { background: rgba(245,158,11,0.1); color: #f59e0b; }
.icon-red { background: rgba(239,68,68,0.1); color: #ef4444; }
.icon-purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.icon-teal { background: rgba(14,165,233,0.1); color: #0ea5e9; }
.stat-info { flex: 1; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--text-primary); line-height: 1; margin: 0; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }

.loading-overlay { position: fixed; inset: 0; background: rgba(248,250,252,0.85); z-index: 9999; display: none; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.loading-overlay.show { display: flex; }
.spinner { width: 44px; height: 44px; border: 3px solid var(--border); border-top-color: var(--primary-light); border-radius: 50%; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 10px; color: white; font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.18); transform: translateX(120%); transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1); min-width: 280px; max-width: 380px; display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.toast.show { transform: translateX(0); }
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-warning { background: #f59e0b; }
.toast-info { background: #0ea5e9; }
.toast i { font-size: 16px; }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1a2744 40%, #0c1629 70%, #0f172a 100%); position: relative; overflow: hidden; }
.login-page::before { content: ''; position: absolute; width: 600px; height: 600px; background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, rgba(0,0,0,0) 70%); top: -100px; left: -100px; border-radius: 50%; z-index: 0; }
.login-card { background: white; border-radius: 20px; padding: 44px 48px; width: 100%; max-width: 440px; box-shadow: 0 32px 80px rgba(0,0,0,0.4); position: relative; z-index: 1; }
.login-logo { text-align: center; margin-bottom: 8px; }
.login-logo i { font-size: 52px; background: linear-gradient(135deg,#3b82f6,#0ea5e9); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.login-title { font-size: 26px; font-weight: 800; text-align: center; color: #0f172a; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: #64748b; text-align: center; margin-bottom: 32px; }
.login-divider { border-top: 1px solid var(--border); margin: 24px 0; }
.password-wrapper { position: relative; }
.password-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: #94a3b8; cursor: pointer; padding: 4px; }
.login-error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.login-footer { text-align: center; font-size: 11px; color: #94a3b8; margin-top: 24px; }

.activity-feed { display: flex; flex-direction: column; gap: 12px; }
.activity-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary-light); margin-top: 6px; flex-shrink: 0; }
.activity-text { font-size: 13px; color: var(--text-secondary); flex: 1; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Dashboard Collection Grid */
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; }
.collection-card { position: relative; background: #1e293b; border-radius: 10px; padding: 24px 18px; display: flex; flex-direction: column; gap: 8px; transition: transform 0.2s, box-shadow 0.2s; overflow: hidden; min-height: 140px; justify-content: flex-end; }
.collection-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.collection-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.4; transition: opacity 0.3s; z-index: 0; }
.collection-card:hover .collection-bg { opacity: 0.55; }
.collection-content { position: relative; z-index: 1; }
.collection-title { font-size: 13px; font-weight: 800; color: #ffffff; text-transform: uppercase; letter-spacing: 0.05em; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.collection-qty { font-size: 28px; font-weight: 800; color: #ffffff; display: flex; align-items: baseline; gap: 4px; line-height: 1; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.collection-unit { font-size: 14px; font-weight: 600; color: #bae6fd; text-shadow: none; }
.collection-link { font-size: 13px; font-weight: 600; color: #34d399; text-decoration: none; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
.collection-link:hover { color: #10b981; }

/* Responsive Mobile Styles */
.mobile-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 95; display: none; opacity: 0; transition: opacity 0.3s; backdrop-filter: blur(2px); }
body.sidebar-open .mobile-overlay { display: block; opacity: 1; }

@media(max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.15); }
  .top-bar { left: 0; padding: 0 16px; }
  .mobile-toggle { display: block !important; }
  .main-content { margin-left: 0; padding: 80px 16px 24px; }
  .page-title { font-size: 20px; }
  .top-bar-right .user-name, .top-bar-right .user-role { display: none; }
  .form-row { grid-template-columns: 1fr !important; gap: 16px; }
  .modal { width: 95%; margin: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
  .modal-body { overflow-y: auto; }
  .table-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .filter-group select { width: 100% !important; }
}
