/* ============ BASE & TYPOGRAPHY ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.4); }

/* ============ CARDS ============ */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08), 0 1px 3px rgba(0,0,0,0.04);
}

/* ============ TAB CONTENT ============ */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ NAVIGATION ============ */
.nav-btn {
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.nav-btn:hover {
  color: #374151;
  background: #f3f4f6;
}
.nav-btn.active {
  color: #4f46e5;
  background: #eef2ff;
  font-weight: 500;
}
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: linear-gradient(to bottom, #6366f1, #8b5cf6);
  border-radius: 0 3px 3px 0;
}

/* ============ PULSE ANIMATION ============ */
@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse-slow {
  animation: pulse-slow 3s ease-in-out infinite;
}

/* ============ GRADIENT TEXT ============ */
.gradient-text {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============ CHART CONTAINER ============ */
canvas {
  max-width: 100%;
}

/* ============ TABLE STYLES ============ */
table {
  border-collapse: collapse;
}
thead th {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  z-index: 10;
}

/* ============ TOOLTIP ============ */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 6px;
  font-size: 11px;
  color: #f3f4f6;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1023px) {
  #sidebar {
    transform: translateX(-100%);
  }
}

@media (max-width: 640px) {
  .card { border-radius: 12px; }
  #dashboardContent { padding: 12px; }
}

/* ============ SELECTION ============ */
::selection {
  background: rgba(99, 102, 241, 0.2);
  color: #312e81;
}

/* ============ LOADING SKELETON ============ */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============ CUSTOM SCROLLBAR FOR TABLES ============ */
.overflow-x-auto::-webkit-scrollbar { height: 4px; }
.overflow-x-auto::-webkit-scrollbar-track { background: transparent; }
.overflow-x-auto::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.15); border-radius: 2px; }

/* ============ NUMBER ANIMATION ============ */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.count-up {
  animation: countUp 0.5s ease-out;
}

/* ============ MODAL ============ */
.animate-fade-in {
  animation: modalFadeIn 0.25s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.clickable-card {
  cursor: pointer;
  transition: all 0.15s ease;
}
.clickable-card:hover {
  box-shadow: 0 4px 12px rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.3);
}
.clickable-card:active {
  transform: scale(0.98);
}

/* ============ SIDEBAR OVERLAY (MOBILE) ============ */
@media (max-width: 1023px) {
  #sidebar:not(.-translate-x-full) ~ #mainContent::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 40;
  }
}
