/* ==========================================================================
   Seoul Bike Dashboard Design System & Styles
   ========================================================================== */

:root {
  /* Color Palette - Dark Theme (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: #1f293d;
  --bg-card-hover: #27354f;
  --bg-table-stripe: #172133;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #10b981;

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Accent Colors */
  --accent-teal: #10b981;
  --accent-teal-glow: rgba(16, 185, 129, 0.25);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.25);
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;
  --accent-rose: #f43f5e;

  /* UI Components */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  --shadow-glow-teal: 0 0 20px rgba(16, 185, 129, 0.3);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
[data-theme="light"] {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f9fafb;
  --bg-table-stripe: #f8fafc;
  --border-color: #e5e7eb;
  --border-focus: #10b981;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --accent-teal: #059669;
  --accent-teal-glow: rgba(5, 150, 105, 0.15);
  --accent-blue: #2563eb;
  --accent-blue-glow: rgba(37, 99, 235, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-glow-teal: 0 4px 15px rgba(5, 150, 105, 0.15);
  --shadow-glow-blue: 0 4px 15px rgba(37, 99, 235, 0.15);
}

/* Reset & Global Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px;
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 28px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-teal), #047857);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-glow-teal);
}

.header-title h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--text-primary) 60%, var(--accent-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-teal);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-teal);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.5;
    transform: scale(0.95);
  }

  50% {
    opacity: 1;
    transform: scale(1.15);
  }

  100% {
    opacity: 0.5;
    transform: scale(0.95);
  }
}

.theme-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition-fast);
}

.theme-btn:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-teal);
  color: var(--accent-teal);
}

/* ==========================================================================
   Hero KPI Section (총 이용건수 & 운영 대여소 수)
   ========================================================================== */
.kpi-hero-section {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-hero-card {
  position: relative;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
}

.kpi-hero-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
}

.kpi-hero-card.primary-kpi {
  border-left: 4px solid var(--accent-teal);
}

.kpi-hero-card.secondary-kpi {
  border-left: 4px solid var(--accent-blue);
}

.card-glow {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.3;
  pointer-events: none;
}

.glow-teal {
  background-color: var(--accent-teal);
}

.glow-blue {
  background-color: var(--accent-blue);
}

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

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.kpi-icon.teal {
  background-color: var(--accent-teal-glow);
  color: var(--accent-teal);
}

.kpi-icon.blue {
  background-color: var(--accent-blue-glow);
  color: var(--accent-blue);
}

.kpi-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.kpi-title {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.kpi-value-wrapper {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 18px;
}

.kpi-number {
  font-family: 'Outfit', 'Pretendard', sans-serif;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-unit {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breakdown-item strong {
  color: var(--text-primary);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.weekday-dot {
  background-color: var(--accent-teal);
}

.weekend-dot {
  background-color: var(--accent-purple);
}

.station-dot {
  background-color: var(--accent-blue);
}

.top-dot {
  background-color: var(--accent-orange);
}

.kpi-footer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Sub Cards Stack */
.kpi-sub-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition-fast);
}

.sub-card:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.sub-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--accent-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.sub-info {
  display: flex;
  flex-direction: column;
}

.sub-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.sub-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   Charts Section
   ========================================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.charts-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dashboard-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.chart-card {
  padding: 22px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

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

.card-title i {
  color: var(--accent-teal);
}

.chart-controls {
  display: flex;
  gap: 6px;
  background-color: var(--bg-secondary);
  padding: 4px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.filter-chip {
  background: none;
  border: none;
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-chip.active,
.filter-chip:hover {
  background-color: var(--accent-teal);
  color: #fff;
}

.card-body {
  position: relative;
  width: 100%;
}

.card-body canvas {
  display: block;
  max-width: 100%;
}

.large-chart .card-body {
  height: 380px;
}

.charts-column .chart-card .card-body {
  height: 185px;
}

/* ==========================================================================
   Data Table Section
   ========================================================================== */
.table-card {
  margin-bottom: 30px;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 16px;
}

.count-badge {
  font-size: 12px;
  background-color: var(--accent-teal-glow);
  color: var(--accent-teal);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.search-box input {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 36px 8px 38px;
  color: var(--text-primary);
  font-size: 13px;
  width: 300px;
  outline: none;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px var(--accent-teal-glow);
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}

.sort-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sort-selector select {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.p-0 {
  padding: 0 !important;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.text-right {
  text-align: right;
}

.rank-badge {
  display: inline-block;
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.rank-1 {
  background-color: #f59e0b;
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.rank-2 {
  background-color: #94a3b8;
  color: #fff;
}

.rank-3 {
  background-color: #b45309;
  color: #fff;
}

.station-id {
  font-family: monospace;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--accent-teal);
}

.usage-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 14px;
}

.share-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-bar-bg {
  flex: 1;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.share-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-teal));
  border-radius: 4px;
  transition: width 0.6s ease-out;
}

.share-percent {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  width: 45px;
  text-align: right;
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: 6px;
}

.page-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition-fast);
}

.page-btn.active {
  background-color: var(--accent-teal);
  border-color: var(--accent-teal);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-btn:hover:not(:disabled):not(.active) {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-teal);
}

/* Footer */
.dashboard-footer {
  text-align: center;
  padding: 24px 0 12px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

.data-source {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.7;
}

/* Animation Utilities */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .kpi-hero-section {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-sub-cards {
    grid-column: span 2;
    flex-direction: row;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .kpi-hero-section {
    grid-template-columns: 1fr;
  }

  .kpi-sub-cards {
    grid-column: span 1;
    flex-direction: column;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-box input {
    width: 100%;
  }
}

/* ==========================================================================
   Feature 3: Time Window Preset Section
   ========================================================================== */
.time-preset-section {
  margin-bottom: 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  box-shadow: var(--shadow-sm);
}

.preset-container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.preset-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.preset-label i {
  color: var(--accent-teal);
}

.preset-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.preset-btn:hover {
  border-color: var(--accent-teal);
  color: var(--text-primary);
  background-color: var(--bg-card-hover);
}

.preset-btn.active {
  background: linear-gradient(135deg, var(--accent-teal), #047857);
  border-color: var(--accent-teal);
  color: #ffffff;
  box-shadow: var(--shadow-glow-teal);
}

.preset-insight-banner {
  background-color: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent-teal);
  display: flex;
  align-items: center;
  gap: 10px;
}

.preset-insight-banner i {
  font-size: 16px;
}

/* ==========================================================================
   Feature 1: Station Detail Analytics Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.active .modal-dialog {
  transform: translateY(0) scale(1);
}

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

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-station-id {
  font-family: monospace;
  background-color: var(--accent-teal-glow);
  color: var(--accent-teal);
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}

.modal-station-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-rank-badge {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

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

.modal-body {
  padding: 24px;
}

.modal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.modal-kpi-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.m-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.m-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.tag-val {
  color: var(--accent-teal);
}

.modal-chart-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.modal-chart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.modal-chart-title i {
  color: var(--accent-teal);
}

.modal-chart-wrapper {
  position: relative;
  height: 220px;
  width: 100%;
}

.modal-breakdown-box {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.modal-breakdown-item {
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.b-label {
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.b-val {
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Outfit', sans-serif;
}

/* Clickable table rows */
.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover td {
  background-color: var(--bg-card-hover);
}

@media (max-width: 768px) {
  .modal-kpi-grid, .modal-breakdown-box {
    grid-template-columns: repeat(2, 1fr);
  }
}