/* Custom Scrollbars Minimalist */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

:root, [data-theme="dark"] {
  --bg-dark: #070a12;
  --bg-card: #0d1322;
  --bg-sidebar: #0b0f19;
  --accent-primary: #00d2ff;
  --accent-hover: #00b4d8;
  --accent-warm: #ff9f43;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #1a2234;
  --card-hover: #141c2e;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 30px -5px rgba(0,0,0,0.6);
  --radius: 10px;
}

[data-theme="light"] {
  --bg-dark: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --accent-primary: #0284c7;
  --accent-hover: #0369a1;
  --accent-warm: #d97706;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --card-hover: #f8fafc;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
}

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

/* Sidebar ERP Style */
.sidebar {
  width: 285px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.85rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.25rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}

.brand-logo img {
  width: 100%;
  max-width: 240px;
  height: auto;
  max-height: 78px;
  object-fit: contain;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

/* Category Title Accordion (ERP Style - Comfortable Spacing) */
.nav-section-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  margin-top: 0.3rem;
}

.nav-section-title:hover {
  background: var(--card-hover);
}

.nav-section-title-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.nav-section-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
}

/* Icons Colored by Section */
.icon-cyan { color: #00d2ff; }
.icon-amber { color: #ff9f43; }
.icon-pink { color: #ff4757; }
.icon-yellow { color: #ffa502; }
.icon-emerald { color: #2ed573; }
.icon-blue { color: #1e90ff; }
.icon-gold { color: #eccc68; }

.nav-section-chevron {
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.nav-section-group {
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  padding-left: 2.1rem;
  margin-top: 0.2rem;
  margin-bottom: 0.45rem;
}

.nav-section-group.open {
  display: flex;
}

.nav-section-title.open .nav-section-chevron {
  transform: rotate(180deg);
}

/* Submenu Items (Bullet Point ERP Style - Comfortable Spacing) */
.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.52rem 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.nav-sub-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-sub-item.active {
  color: #00d2ff;
  font-weight: 600;
}

.nav-sub-bullet {
  font-size: 0.65rem;
  opacity: 0.5;
}

.nav-sub-item.active .nav-sub-bullet {
  color: #00d2ff;
  opacity: 1;
}

/* Top Dashboard Item Direct Link (Comfortable Spacing) */
.nav-item-direct {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-item-direct:hover {
  background: var(--card-hover);
}

.nav-item-direct.active {
  background: var(--card-hover);
  color: #00d2ff;
  font-weight: 600;
}

/* Sidebar Footer (ERP Style) */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-user-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.65rem;
}

.sidebar-user-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  text-transform: uppercase;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sidebar-user-logout {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

.sidebar-user-logout:hover {
  color: #ff4757;
}

.sidebar-version {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: 0.65rem;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Multi-tab System */
.tab-container {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--card-hover);
  border-radius: 8px 8px 0 0;
}

.tab-btn.active {
  color: #00d2ff;
  border-bottom-color: #00d2ff;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.top-bar {
  height: 70px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-theme-toggle {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
  background: var(--card-hover);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--accent-primary);
}

.btn-logout {
  color: #ef4444;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  transition: background 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
}

.content-body {
  padding: 2rem;
  flex-grow: 1;
}

/* Cards & Components */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-primary); }
.stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-warm); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Forms & Tables */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.92rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-primary);
  color: #000;
}

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

.btn-secondary {
  background: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--card-hover);
}

.btn-warning {
  background: var(--accent-warm);
  color: #000;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.table th, .table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-main);
}

.table th {
  background: var(--bg-dark);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--accent-primary); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--accent-warm); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.badge-info { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
