/* Global Theme Styles & Variables */
:root {
  /* Fonts */
  --font-family: 'Outfit', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Transition default */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --border-radius-sm: 8px;
  
  /* Light Theme Variables */
  --bg-color: #f8fafc;
  --panel-bg: #ffffff;
  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #94a3b8;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.15);
  --primary-light: #eff6ff;
  
  --success: #10b981;
  --success-hover: #059669;
  --success-light: #ecfdf5;
  --success-text: #065f46;
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --danger-text: #991b1b;
  
  --border-color: #e2e8f0;
  --border-color-focus: #3b82f6;
  --input-bg: #ffffff;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-blur: blur(12px);
  
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;
  --header-height: 70px;
}

/* Dark Theme Variables */
body.dark-mode {
  --bg-color: #0b0f19;
  --panel-bg: #151c2c;
  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #64748b;
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-glow: rgba(59, 130, 246, 0.3);
  --primary-light: #172554;
  
  --success: #34d399;
  --success-hover: #52e1a9;
  --success-light: #064e3b;
  --success-text: #a7f3d0;
  
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-light: #7f1d1d;
  --danger-text: #fca5a5;
  
  --border-color: #273142;
  --border-color-focus: #3b82f6;
  --input-bg: #1e293b;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  
  --glass-bg: rgba(21, 28, 44, 0.7);
  --glass-border: rgba(39, 49, 66, 0.4);
  --glass-blur: blur(12px);
}

/* CSS Reset & Core Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

button {
  cursor: pointer;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-grow { flex-grow: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-sub { color: var(--text-sub); }

/* Animation Utility classes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.animate-fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-shake {
  animation: shake 0.3s ease-in-out;
}

/* Glassmorphism panel */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* Custom highlights for search matches */
mark.highlight {
  background-color: rgba(251, 191, 36, 0.4);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 500;
}

body.dark-mode mark.highlight {
  background-color: rgba(245, 158, 11, 0.5);
  color: #ffffff;
}

/* Printing Media Query Optimization */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }
  
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
  
  /* Main content takes full screen */
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  
  .card {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
  }
  
  /* Tables styling for printing */
  table {
    border-collapse: collapse !important;
    width: 100% !important;
    font-size: 11px !important;
  }
  
  th, td {
    border: 1px solid #475569 !important;
    padding: 6px 8px !important;
    color: #000000 !important;
  }
  
  th {
    background-color: #f1f5f9 !important;
    font-weight: bold !important;
  }
  
  .table-totals {
    background-color: #e2e8f0 !important;
    font-weight: bold !important;
  }
  
  /* Page break rules */
  .page-break {
    page-break-before: always !important;
  }
}
