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

:root {
  --font-sans: 'Pretendard', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --bg-deep: #050811;
  --bg-surface: #0a0f1d;
  --bg-card: rgba(13, 20, 36, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(56, 189, 248, 0.25);
  
  --gold-primary: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.35);
  --cyan-primary: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.35);
  --emerald-primary: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  --indigo-primary: #6366f1;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: #f1f5f9;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(245, 158, 11, 0.08) 0px, transparent 50%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 48px 48px, 48px 48px;
}

/* Neo-Glass Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.glass-nav {
  background: rgba(8, 12, 24, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Custom 3D Logo Emblem */
.logo-emblem {
  position: relative;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4, #f59e0b);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

.logo-emblem::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: #080c1a;
  border-radius: 10px;
  z-index: 1;
}

.logo-emblem i {
  position: relative;
  z-index: 2;
  color: #38bdf8;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
}

/* Metric Pulse Card */
.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-color, #38bdf8), transparent);
}

/* 360 Domain Entity Card */
.domain-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.domain-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.6), 0 0 24px -6px var(--glow-color, rgba(56, 189, 248, 0.2));
  border-color: var(--glow-border, rgba(56, 189, 248, 0.4));
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(5, 8, 17, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.5);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.7);
}

/* Diff Highlighting */
.diff-del {
  background-color: rgba(244, 63, 94, 0.12);
  color: #fca5a5;
  border-left: 3px solid #f43f5e;
}
.diff-add {
  background-color: rgba(16, 185, 129, 0.12);
  color: #86efac;
  border-left: 3px solid #10b981;
}

/* Status Badges with Glow */
.badge-active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}
.badge-pending {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}
.badge-rejected {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.15);
}
.badge-merged {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
}

/* Luxury Credit Grade Badges */
.grade-aaa {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.1));
  color: #fef08a;
  border: 1px solid rgba(245, 158, 11, 0.4);
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
.grade-aa {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(2, 132, 199, 0.1));
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.grade-a {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(5, 150, 105, 0.1));
  color: #a7f3d0;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

/* Table Responsive Container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Table & Action Buttons Wrap Protection (No Single Letter Line Breaks) */
table th, table td {
  white-space: nowrap !important;
  word-break: keep-all !important;
}

table button, .btn-action, nav button {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  min-width: fit-content !important;
}

/* Responsive Text & Word Protection */
* {
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* Mobile & Multi-Device Responsive Safeguards */
@media (max-width: 640px) {
  .glass-panel {
    border-radius: 1.25rem !important;
    padding: 1rem !important;
  }
  
  #modal-container > div {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 1rem auto !important;
    padding: 1.25rem !important;
    max-height: 88vh !important;
    border-radius: 1.25rem !important;
  }

  .grid-responsive-stack {
    grid-template-columns: 1fr !important;
  }

  /* Compact padding for tables on small screens */
  table th, table td {
    padding-left: 0.625rem !important;
    padding-right: 0.625rem !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    font-size: 11px !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .glass-panel {
    border-radius: 1.5rem !important;
  }
  #modal-container > div {
    max-width: 90vw !important;
  }
}

@media (min-width: 1025px) {
  .glass-panel {
    border-radius: 1.5rem;
  }
}

/* Cockpit Metric Circular Progress */
.circular-chart {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 100px;
}
.circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 3.8;
}
.circle {
  fill: none;
  stroke-width: 3.8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}

/* ========================================================================= */
/* 📱 Mobile-First Responsive & Premium Touch Safeguards                     */
/* ========================================================================= */
* {
  -webkit-tap-highlight-color: transparent;
}

/* 터치 가로 스크롤 스와이프 바 (스크롤바 숨김) */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* 모바일 바텀 플로팅 네비게이션 */
.mobile-bottom-nav {
  background: rgba(7, 11, 22, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.5);
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

/* 모바일 뷰포트 여백 최적화 */
@media (max-width: 640px) {
  #main-content {
    padding-bottom: 5.5rem !important; /* 바텀 네비게이션 여백 확보 */
  }
  
  /* 모달 바텀 시트 트랜지션 */
  #modal-container .glass-panel {
    border-radius: 1.5rem 1.5rem 0 0 !important;
    max-height: 90vh;
  }
}
