﻿/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --sidebar-icon-w: 80px;
  --sidebar-menu-w: 200px;
  --header-h: 48px;
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-bg: #ffffff;
  --sidebar-hover: #f1f5f9;
  --sidebar-active: #eff6ff;
  --sidebar-active-color: #3b82f6;
}
html, body { height: 100%; font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 18px; color: var(--gray-800); background: var(--gray-100); }

/* ===== LAYOUT ===== */
#app { display: flex; height: 100vh; overflow: hidden; max-width: 1920px; margin: 0; background: var(--gray-50); }

/* ===== ICON SIDEBAR ===== */
.sidebar-icons {
  width: var(--sidebar-icon-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0;
  flex-shrink: 0;
  z-index: 100;
}
.sidebar-logo {
  width: 100%;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-800);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.icon-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 4px;
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.15s;
  position: relative;
  border: none;
  background: transparent;
  text-decoration: none;
}
.icon-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-active-color); }
.icon-btn.active { background: var(--sidebar-active); color: var(--sidebar-active-color); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn span { font-size: 17px; font-weight: 500; }
.icon-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  background: var(--red);
  color: white;
  font-size: 12px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== SUB SIDEBAR ===== */
.sidebar-sub {
  width: 0;
  background: white;
  border-right: 1px solid var(--gray-200);
  overflow: hidden;
  transition: width 0.2s ease;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-sub.open { width: var(--sidebar-menu-w); }
.sidebar-sub-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 16px;
  color: var(--gray-400);
  white-space: nowrap;
}
.sidebar-sub input.search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 16px;
  margin: 8px 10px;
  width: calc(100% - 20px);
  outline: none;
}
.sidebar-sub input.search:focus { border-color: var(--blue); }

.menu-section { padding: 8px 0; }
.menu-label {
  padding: 6px 14px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-400);
  white-space: nowrap;
  letter-spacing: 0.5px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--gray-700);
  white-space: nowrap;
  font-size: 17px;
  transition: all 0.1s;
  border-radius: 0;
  position: relative;
}
.menu-item:hover { background: var(--gray-100); color: var(--blue); }
.menu-item.active { color: var(--blue); font-weight: 600; background: #eff6ff; }
.menu-item svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.7; }
.menu-item.active svg { opacity: 1; }
.menu-badge {
  background: var(--red);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: auto;
}

/* ===== MAIN AREA ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ===== TOP HEADER ===== */
.topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 8px;
  flex-shrink: 0;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: var(--gray-500);
  flex: 1;
}
.breadcrumb span { color: var(--gray-400); }
.breadcrumb .current { color: var(--gray-800); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-btn {
  width: 32px; height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.topbar-btn:hover { background: var(--gray-100); color: var(--gray-800); }
.topbar-btn svg { width: 18px; height: 18px; }

/* ===== CONTENT ===== */
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  font-weight: 700;
  color: var(--gray-800);
}
.page-title svg { width: 20px; height: 20px; color: var(--blue); }
.badge-tag {
  font-size: 14px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: #dbeafe;
  color: var(--blue-dark);
}
.badge-count {
  font-size: 17px;
  color: var(--gray-500);
  font-weight: 400;
}
.page-actions { display: flex; gap: 8px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-100); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-sm { padding: 4px 10px; font-size: 16px; }
.btn-icon { padding: 6px; }

/* ===== CARDS ===== */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-700);
  gap: 8px;
}
.card-header svg { width: 16px; height: 16px; color: var(--blue); }
.card-body { padding: 18px; }

/* ===== ALERT BANNERS ===== */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 17px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===== FORM ===== */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 4px;
}
.required {
  background: #fee2e2;
  color: #dc2626;
  font-size: 13px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.form-control {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 17px;
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.15s;
  background: white;
  width: 100%;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 2px #dbeafe; }
.form-control:disabled { background: var(--gray-100); color: var(--gray-400); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ===== TOGGLE SWITCH ===== */
.toggle-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toggle-item { display: flex; align-items: center; gap: 8px; }
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 11px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--blue); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: 17px; color: var(--gray-700); }

/* ===== BRAND LIST ===== */
.brand-list {
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.brand-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 17px;
  transition: 0.1s;
}
.brand-item:hover { background: #eff6ff; color: var(--blue); }
.brand-item.selected { background: var(--blue); color: white; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 12px;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-600);
  text-align: left;
  white-space: nowrap;
}
thead th.center { text-align: center; }
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 17px;
  color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }
.td-center { text-align: center; }

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}
.status-issued { background: #dcfce7; color: #15803d; }
.status-cancel { background: #fee2e2; color: #dc2626; }
.status-pending    { background: #fef9c3; color: #854d0e; }
.status-processing { background: #dbeafe; color: #1d4ed8; }

/* ===== SEARCH FILTERS ===== */
.filter-bar {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 14px; color: var(--gray-500); font-weight: 500; }
.filter-actions { display: flex; gap: 6px; align-items: flex-end; }

/* ===== DASHBOARD STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 18px;
}
.stat-label { font-size: 17px; color: var(--gray-500); margin-bottom: 12px; font-weight: 500; }
.stat-row { display: flex; gap: 20px; margin-bottom: 6px; }
.stat-item { display: flex; flex-direction: column; gap: 2px; }
.stat-sublabel { font-size: 14px; color: var(--gray-400); }
.stat-value { font-size: 29px; font-weight: 700; color: var(--gray-800); }
.stat-change { font-size: 16px; font-weight: 600; }
.stat-up { color: var(--green); }
.stat-down { color: var(--red); }

/* ===== ORDER PAGE ===== */
.order-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.product-table img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--gray-100); }
.qty-input { width: 56px; padding: 4px 8px; border: 1px solid var(--gray-300); border-radius: 4px; text-align: center; font-size: 17px; }
.cart-panel {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  height: fit-content;
  position: sticky;
  top: 0;
}
.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-700);
}
.cart-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--gray-400);
  font-size: 17px;
}
.cart-mileage { padding: 12px 16px; border-top: 1px solid var(--gray-200); }
.cart-mileage-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  color: var(--gray-600);
  padding: 3px 0;
}
.cart-note { padding: 12px 16px; border-top: 1px solid var(--gray-200); }
.cart-footer { padding: 12px 16px; border-top: 1px solid var(--gray-200); display: flex; gap: 8px; }

/* ===== DASHBOARD TABS ===== */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}
.tab-item {
  padding: 10px 16px;
  font-size: 17px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-item:hover { color: var(--blue); }
.tab-item.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.tab-item svg { width: 14px; height: 14px; }

/* ===== PPF OPTIONS ===== */
.ppf-options { display: flex; flex-wrap: wrap; gap: 10px; }
.ppf-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  cursor: pointer;
  font-size: 17px;
  transition: all 0.15s;
}
.ppf-option input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--blue); }
.ppf-option:has(input:checked) { border-color: var(--blue); background: #eff6ff; color: var(--blue); }

/* ===== FILM PARTS TABLE ===== */
.film-table { width: 100%; }
.film-table th {
  background: var(--gray-50);
  padding: 8px 12px;
  font-size: 16px;
  color: var(--gray-500);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-200);
}
.film-table td { padding: 8px 12px; border-bottom: 1px solid var(--gray-100); font-size: 17px; }
.film-table tr:last-child td { border-bottom: none; }
.film-total-row td { font-weight: 600; background: var(--gray-50); }

/* ===== USER INFO CHIP ===== */
.user-chip {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
}
.user-avatar svg { width: 22px; height: 22px; }
.user-name { font-size: 21px; font-weight: 700; }
.user-role { font-size: 16px; color: var(--gray-500); margin-top: 2px; }

/* ===== CHART PLACEHOLDER ===== */
.chart-area {
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
  border-radius: 8px;
  height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 16px 12px 0;
  gap: 4px;
}
.chart-bar { background: #bfdbfe; border-radius: 4px 4px 0 0; min-width: 18px; transition: 0.2s; }
.chart-bar:hover { background: var(--blue); }
.chart-bar.highlight { background: var(--blue); }

/* ===== HIDDEN ===== */
.page-section { display: none; }
.page-section.active { display: block; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .order-layout { grid-template-columns: 1fr; }
}

/* ===== PRINT ===== */
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  color: var(--gray-500);
  background: white;
  transition: all 0.1s;
}
.action-icon:hover { background: var(--gray-100); color: var(--gray-800); }
.action-icon svg { width: 14px; height: 14px; }

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