@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
  /* Ultra-Premium SaaS Theme Palette (Light) */
  --bg-main: #f8fafc;
  --bg-panel: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-card-hover: #f8fafc;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;
  --border-focus: #3b82f6;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.1);
  --primary-contrast: #ffffff;
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);
  
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);
  
  --info: #0ea5e9;
  --info-bg: rgba(14, 165, 233, 0.12);
  --info-border: rgba(14, 165, 233, 0.3);

  --sidebar-bg: #ffffff;
  --sidebar-width: 260px;
  --header-height: 64px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

html.dark {
  /* Ultra-Premium SaaS Theme Palette (Dark) */
  --bg-main: #090d16;
  --bg-panel: #111827;
  --bg-subtle: #1e293b;
  --bg-card-hover: #162032;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --border-color: #334155;
  --border-light: #1e293b;
  --border-focus: #60a5fa;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.2);
  --primary-contrast: #ffffff;

  --sidebar-bg: #111827;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6);
}

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.25px;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
}

/* ==========================================================================
   Layout Structure
   ========================================================================== */
.layout-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.global-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}

.sidebar-logo .brand-badge {
  background: var(--primary);
  color: white;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-nav {
  flex-grow: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 4px;
}

/* Accordion Sidebar */
.menu-group {
  margin-bottom: 2px;
}

.menu-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.menu-parent:hover {
  color: var(--text-main);
  background-color: var(--bg-subtle);
}

.menu-group.open .menu-parent {
  color: var(--text-main);
  background-color: transparent;
  font-weight: 700;
}

.menu-children {
  display: none;
  flex-direction: column;
  padding-left: 18px;
  margin-top: 2px;
  gap: 2px;
  position: relative;
}

.menu-children::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 4px;
  bottom: 8px;
  width: 2px;
  background-color: var(--border-light);
  border-radius: 1px;
}

.menu-group.open .menu-children {
  display: flex;
}

.sub-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

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

.sub-nav-item.active {
  color: var(--primary);
  font-weight: 700;
  background-color: var(--primary-glow);
}

.sub-nav-bullet {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--text-subtle);
  flex-shrink: 0;
}

.sub-nav-item.active .sub-nav-bullet {
  background-color: var(--primary);
  box-shadow: 0 0 6px var(--primary);
}

/* Global Footer */
.global-footer {
  height: 48px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

/* Content Area */
.content-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top Header */
.top-header, .global-header {
  height: var(--header-height);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-light);
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 24px !important;
  z-index: 900;
  flex-shrink: 0;
  width: 100%;
}

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

.header-icon-btn, .icon-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 7px;
  border-radius: 8px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease;
}

.header-icon-btn:hover, .icon-button:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-light);
}

.user-profile-badge, .user-profile {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 4px 12px 4px 4px !important;
  border-radius: 24px !important;
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border-light) !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-profile-badge:hover, .user-profile:hover {
  border-color: var(--primary);
}

.user-avatar {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: var(--primary) !important;
  color: white !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  flex-shrink: 0;
}

/* Page Header & Breadcrumbs */
.page-header {
  padding: 20px 24px 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.breadcrumb-separator {
  color: var(--text-subtle);
  font-size: 11px;
}

.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.main-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0 24px 24px 24px;
}

.content-body {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   KPI Summary Grids & Cards (Supports both .kpi-grid & standalone .kpi-card)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card.horizontal {
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  width: 100%;
}

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.2;
  white-space: nowrap !important;
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 4px 0 6px 0;
}

.kpi-footer {
  font-size: 12px;
  color: var(--text-subtle);
}

/* ==========================================================================
   Cards Container (For Dashboard and other pages)
   ========================================================================== */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-panel);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* ==========================================================================
   Data Tables (Both .table and .premium-table)
   ========================================================================== */
.table-container, .table-responsive {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.table, .premium-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.table thead, .premium-table thead {
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
}

.table th, .premium-table th {
  padding: 12px 18px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: none;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.table td, .premium-table td {
  padding: 14px 18px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  background-color: var(--bg-panel);
}

.table tbody tr:hover td, .premium-table tbody tr:hover td {
  background-color: var(--bg-subtle);
}

.table tbody tr:last-child td, .premium-table tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   Buttons (All variants supported: .btn, .btn-primary, .btn-secondary, etc.)
   ========================================================================== */
.btn {
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap !important;
}

.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--text-subtle);
}

.btn-primary, .btn.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap !important;
}

.btn-primary:hover, .btn.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary {
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap !important;
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--text-subtle);
}

.btn-danger, .btn.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border: 1px solid var(--danger);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap !important;
}

.btn-danger:hover, .btn.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.btn-sm, .btn.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-panel);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap !important;
}

.action-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--text-subtle);
}

.action-btn.delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* ==========================================================================
   Badges (Both class formats supported: .badge.success and .badge-success)
   ========================================================================== */
.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1.3;
}

.badge-primary, .badge.primary {
  background-color: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.badge-success, .badge.success {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-danger, .badge.danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge-warning, .badge.warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-info, .badge.info {
  background-color: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.badge-neutral, .badge.neutral {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

/* ==========================================================================
   Forms & Search Controls
   ========================================================================== */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0 12px;
  height: 38px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-size: 13.5px;
  width: 200px;
}

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

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

.form-input, .form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input:disabled {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ==========================================================================
   SweetAlert2 Custom Styling & Top Positioning
   ========================================================================== */
.swal2-container {
  z-index: 99999999 !important;
}

.swal2-popup {
  border-radius: 16px !important;
  background: var(--bg-panel) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-light) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4) !important;
}

.swal2-top {
  margin-top: 30px !important;
}

.swal2-title {
  color: var(--text-main) !important;
}

.swal2-html-container {
  color: var(--text-muted) !important;
}

/* ==========================================================================
   Modals & Dialogs
   ========================================================================== */
.modal-backdrop, .modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
  padding: 20px !important;
}

.modal-backdrop.hidden, .modal-overlay.hidden, .hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.modal-container, .modal-content {
  background: var(--bg-panel) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35) !important;
  width: 100% !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
  animation: modalScaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative !important;
  margin: auto !important;
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.modal-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-backdrop.hidden, .modal-overlay.hidden, .hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
