@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
  /* Diversified Harmony Palette */
  --bg-dark-slate: #020617; /* Very Deep Slate for contrast */
  --bg-panel: rgba(15, 23, 42, 0.6); /* Neutral Glass */
  --glass-border: rgba(255, 255, 255, 0.1);
  
  --color-emerald: #10B981;
  --color-gold: #F59E0B;
  --color-indigo: #6366F1;
  --color-sky: #0EA5E9;
  
  --text-main: #F8FAFC;
  --text-muted: #94A3B8; /* Neutralized */
  --accent-glow: rgba(52, 211, 153, 0.4);
  
  --map-base: #1e293b;
  --map-stroke: rgba(255, 255, 255, 0.15);
  --map-hover-glow: var(--color-emerald);

  --font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark-slate);
  background-image: 
    linear-gradient(rgba(2, 6, 23, 0.85), rgba(2, 6, 23, 0.95)),
    url('./bg_vegetable.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}


.dashboard-container {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  gap: 2rem;
  min-height: 100vh;
}

.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Login Screen */
.login-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: #0f172a;
  background-image: 
    linear-gradient(rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.95)),
    url('landing_bg.png');
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.login-box {
  padding: 3rem;
  width: 400px;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-box h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #fff;
}


.login-box p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.login-input-group {
  width: 100%;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.login-input-group input {
  flex: 1;
  padding: 0.8rem 1rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-input-group input:focus {
  border-color: #A855F7;
}

.login-input-group button {
  padding: 0 1.5rem;
  border-radius: 0.5rem;
  border: none;
  background: var(--color-emerald);
  color: #fff;
  font-weight: 700;

  cursor: pointer;
  transition: opacity 0.2s;
}

.login-input-group button:hover {
  opacity: 0.8;
}

.login-error {
  color: #F87171 !important;
  font-size: 0.85rem;
  margin-bottom: 0 !important;
  text-align: left;
  width: 100%;
  opacity: 0;
  transition: opacity 0.2s;
}

.login-error.show {
  opacity: 1;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 50;
}

.title-container h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}


.title-container .subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

.bgm-toggle {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #fff;
  padding: 0.3rem 0.8rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 600;
  white-space: nowrap;
}

.bgm-toggle:hover {
  background: rgba(16, 185, 129, 0.4);
}

.bgm-toggle.off {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
}

.summary-stats {
  display: flex;
  gap: 1.5rem;
}

.stat-card {
  padding: 1rem 1.75rem;
  border-left: 4px solid var(--color-emerald);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 140px;
}

.stat-card:nth-child(2) {
  border-left-color: var(--color-sky);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

/* Search Bar */
.search-container {
  position: relative;
  flex: 1;
  max-width: 800px;
  margin: 0 2rem;
  z-index: 200;
}

#company-search {
  width: 100%;
  padding: 1.5rem 2.5rem;
  border-radius: 3rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: inherit;
  font-size: 1.3rem;
  outline: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
}


#company-search:focus {
  border-color: #34D399;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px rgba(52, 211, 153, 0.3);
}

#company-search::placeholder {
  color: var(--text-muted);
}

.search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.search-results.active {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.search-results::-webkit-scrollbar {
  width: 6px;
}
.search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.search-item {
  padding: 0.8rem 1.2rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.2s;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.search-item-name {
  color: #fff;
  font-weight: 600;
}

.search-item-region {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Map Section */
.map-section {
  position: relative;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 600px;
  overflow: hidden;
  animation: fadeIn 0.8s ease-out 0.2s both;
}

.map-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.map-wrapper svg {
  width: 100%;
  height: auto;
  max-height: 700px;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.4));
}

.province {
  fill: var(--map-base);
  stroke: var(--map-stroke);
  stroke-width: 0.8;
  stroke-linejoin: round;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  transform-origin: center;
}

.province:hover {
  filter: drop-shadow(0 0 12px var(--map-hover-glow));
  stroke: #FFFFFF;
  stroke-width: 1.5;
  z-index: 10;
}

/* Tooltip */
.tooltip {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(10px) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 100;
  min-width: 140px;
}

.tooltip.active {
  opacity: 1;
  transform: translate(-50%, -120%) scale(1);
}

.tooltip-region {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
}

.tooltip-data {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.tooltip-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.tooltip-value {
  color: #A855F7;
  font-weight: 800;
  font-size: 1.25rem;
}

/* Sidebar */
.sidebar-section {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
  overflow: hidden;
  max-height: 750px;
}

.sidebar-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.ranking-list::-webkit-scrollbar {
  width: 6px;
}
.ranking-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}
.ranking-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.ranking-item {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  padding: 1rem;
  align-items: center;
  transition: var(--transition-smooth);
}

.ranking-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-gold);
  transform: translateX(8px);
}

.rank-number {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-gold);
  width: 2.5rem;
  flex-shrink: 0;
}

.rank-item-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
}

.rank-region {
  font-weight: 600;
}

.rank-count {
  font-weight: 800;
  color: #fff;
  background: rgba(168, 85, 247, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
}

.ranking-item .bar-bg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(99,102,241,0.1), rgba(236,72,153,0.15));
  z-index: 1;
  transform-origin: left;
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Detail Panel */
.detail-panel {
  position: absolute;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 100%;
  height: 100%;
  max-height: 750px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
  background: rgba(15, 23, 42, 0.95);
}

.detail-panel.open {
  right: 0;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.detail-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #EC4899;
}

.detail-stats {
  margin-bottom: 1rem;
  font-weight: 600;
  color: #60A5FA;
}

.company-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 0.5rem;
}

.company-list::-webkit-scrollbar {
  width: 6px;
}
.company-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.company-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.company-card {
  background: rgba(255,255,255, 0.03);
  border: 1px solid rgba(255,255,255, 0.08);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: all 0.2s;
}

.company-card:hover {
  border-color: rgba(168, 85, 247, 0.5);
  background: rgba(255,255,255, 0.06);
}

.company-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

.company-tag-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.company-offline, .company-online {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: #CBD5E1;
}

.badge {
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.2);
  color: #A5B4FC;
  white-space: nowrap;
}
.badge.offline {
  background: rgba(236, 72, 153, 0.2);
  color: #F9A8D4;
}

/* 3-Step Modal */
.company-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.company-modal-content {
  width: 900px;
  max-width: 90vw;
  max-height: 90vh;
  padding: 2.5rem;
  position: relative;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.company-modal-overlay.active .company-modal-content {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: #EC4899;
}

.modal-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1rem;
}

.modal-header h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  margin-right: 1rem;
}

.modal-product {
  color: #A855F7;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  overflow-y: auto;
  padding-right: 1rem;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.modal-left h3, .modal-right h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: #E2E8F0;
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.info-list li {
  display: flex;
  gap: 1rem;
  font-size: 1rem;
  line-height: 1.4;
  word-break: keep-all;
}

.l-label {
  min-width: 110px;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-section {
  margin-bottom: 2rem;
}

.progress-section h4 {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  border-bottom: 1px dashed rgba(255,255,255,0.1);
  padding-bottom: 0.5rem;
}

.progress-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.prog-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255, 0.03);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255,255,255,0.05);
}

.prog-label {
  font-weight: 600;
  color: #CBD5E1;
}

.status-badge {
  padding: 0.3rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
}

.status-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
}

.status-error {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
}

.status-default {
  background: rgba(100, 116, 139, 0.2);
  color: #94A3B8;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .sidebar-section {
    max-height: 400px;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
}
