@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap");

:root {
  --bg-gradient-start: var(--bg);
  --bg-gradient-end: var(--bg);
  --card-bg-color: var(--surface);
  --card-border-color: var(--border);
  --text-primary-color: var(--text);
  --text-secondary-color: var(--muted);
  --accent-color: var(--primary);
}

body {
  font-family: "Inter", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text-primary-color);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  box-sizing: border-box;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 6vw 60px;
}

/* Control Panel / Search Section */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.input-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.pill-input {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 12px 24px;
    font-size: 1rem;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.pill-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 106, 167, 255), 0.1);
}

/* .pill-btn uses shared styles from styles.css */

/* Results Area */
.is-hidden {
  display: none !important;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 24px;
    border: 2px dashed var(--border);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Feature Card (Map) */
.featured-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 25px;
  overflow: hidden;
  box-shadow: var(--shadow);
  height: 400px;
  position: relative;
}

.map-view {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Overview Card */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}

/* Hover effects handled continuously */

.stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.stat-value-large {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.flag-img {
    width: 48px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: help; /* Indicates tooltip available */
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.card-title {
    margin: 0 0 20px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

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

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.95rem;
}

.detail-item:not(:last-child) {
    border-bottom: 1px solid var(--surface-2);
    padding-bottom: 12px;
}

.detail-label {
    color: var(--muted);
    flex-shrink: 0;
}

.detail-value {
    font-weight: 500;
    color: var(--text);
    text-align: right;
    word-break: break-all;
    margin-left: 16px;
}

/* Leaflet Dark Mode */
[data-theme="dark"] .leaflet-layer,
[data-theme="dark"] .leaflet-control-zoom-in,
[data-theme="dark"] .leaflet-control-zoom-out,
[data-theme="dark"] .leaflet-control-attribution {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

@media (max-width: 768px) {
    .input-row {
        flex-direction: column;
    }
    
    .pill-btn {
        justify-content: center;
    }
}

/* Flag Tooltip */
.flag-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  transform: translate(10px, 10px); /* Offset to avoid cursor overlap */
}

.flag-tooltip.is-visible {
  opacity: 1;
}

.flag-tooltip img {
  display: block;
  max-width: 150px;
  height: auto;
  border-radius: 4px;
}
