/* ==========================================================================
   BUROB TRAVEL MARKETING DASHBOARD - PREMIUM DARK THEME
   Vanilla CSS Styling with CSS Custom Variables, Glassmorphism, and Animations
   ========================================================================== */

/* --- Import Modern Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

/* --- Design Tokens & CSS Variables --- */
:root {
  --font-primary: 'Outfit', 'Inter', 'Noto Sans KR', sans-serif;
  
  /* Color Palette */
  --bg-main: #080c14;
  --bg-sidebar: #0d121f;
  --bg-card: rgba(15, 22, 38, 0.7);
  --bg-card-hover: rgba(22, 32, 54, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-focus: rgba(3, 199, 90, 0.4);
  
  /* Brand Accent Colors */
  --color-naver: #03C75A;         /* Naver Green */
  --color-naver-glow: #10b981;    /* Glowing green */
  --color-primary: #4f46e5;      /* Travel Indigo */
  --color-secondary: #06b6d4;    /* Cyan accent */
  --color-violet: #8b5cf6;       /* Violet accent */
  
  /* Text Colors */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;
  
  /* Semantic Status Colors */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;
  --status-info: #3b82f6;

  /* Layout Constants */
  --sidebar-width: 260px;
  --header-height: 70px;
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;
  
  /* Box Shadow & Glow */
  --glow-shadow: 0 0 20px rgba(3, 199, 90, 0.15);
  --glow-shadow-primary: 0 0 20px rgba(79, 70, 229, 0.2);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  
  /* Transition curve */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-primary);
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(3, 199, 90, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(79, 70, 229, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
}

/* --- Custom Elegant Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(3, 199, 90, 0.4);
}

/* --- Layout Container --- */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* --- Left Sidebar Styling --- */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: var(--transition-smooth);
}

.sidebar-logo {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-naver), var(--color-secondary));
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-size: 18px;
  box-shadow: 0 0 15px rgba(3, 199, 90, 0.4);
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  color: var(--color-naver);
}

.sidebar-nav {
  padding: 24px 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(3, 199, 90, 0.15), rgba(6, 182, 212, 0.05));
  border-color: rgba(3, 199, 90, 0.3);
  box-shadow: 0 4px 20px -5px rgba(3, 199, 90, 0.1);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  transition: var(--transition-smooth);
}

.nav-item.active svg {
  color: var(--color-naver);
  filter: drop-shadow(0 0 5px rgba(3, 199, 90, 0.5));
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* --- Main Content Area --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  padding: 30px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.page-title h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-title p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

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

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--status-danger);
  transition: var(--transition-smooth);
}

.api-status-badge.connected {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--status-success);
}

.api-status-badge .indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.api-status-badge.connected .indicator-dot {
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- Dashboard Tab Layout --- */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-in-out forwards;
  flex-grow: 1;
}

.tab-content.active {
  display: block;
}

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

/* --- Premium Grid System --- */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.grid-main-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* --- Card Styles (Glassmorphism) --- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
}

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

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

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

/* --- KPI Summary Card Styles --- */
.kpi-card {
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--color-primary);
}

.kpi-card.naver::before { background: var(--color-naver); }
.kpi-card.secondary::before { background: var(--color-secondary); }
.kpi-card.violet::before { background: var(--color-violet); }
.kpi-card.warning::before { background: var(--status-warning); }

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

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 8px;
  letter-spacing: -0.5px;
}

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

.trend-up { color: var(--status-success); }
.trend-down { color: var(--status-danger); }

/* --- Tables Styling --- */
.table-container {
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.5px;
}

td {
  padding: 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.01);
}

/* --- Form Controls --- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-control {
  width: 100%;
  background-color: rgba(8, 12, 20, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 13px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-primary);
  transition: var(--transition-smooth);
}

.input-control:focus {
  outline: none;
  border-color: var(--color-naver);
  box-shadow: 0 0 10px rgba(3, 199, 90, 0.15);
  background-color: rgba(8, 12, 20, 0.9);
}

/* --- Sliders --- */
.slider-container {
  margin: 16px 0;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.slider-label {
  color: var(--text-muted);
  font-weight: 500;
}

.slider-value {
  font-weight: 700;
  color: var(--color-secondary);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-secondary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
  transition: var(--transition-smooth);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
  font-family: var(--font-primary);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  box-shadow: var(--glow-shadow-primary);
}

.btn-primary:hover {
  background-color: #4338ca;
  transform: translateY(-1px);
}

.btn-naver {
  background-color: var(--color-naver);
  color: white;
  box-shadow: var(--glow-shadow);
}

.btn-naver:hover {
  background-color: #02a64b;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--status-danger);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-icon-only {
  padding: 8px;
  border-radius: var(--border-radius-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* --- Switches (Toggle) --- */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 22px;
  border: 1px solid var(--border-color);
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider-switch {
  background-color: rgba(3, 199, 90, 0.2);
  border-color: rgba(3, 199, 90, 0.4);
}

input:checked + .slider-switch:before {
  transform: translateX(22px);
  background-color: var(--color-naver);
  box-shadow: 0 0 8px var(--color-naver);
}

/* --- AI / Marketing Insights Card --- */
.insight-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.insight-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.insight-item.positive {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.02);
}
.insight-item.positive .insight-icon {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--status-success);
}

.insight-item.warning {
  border-color: rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.02);
}
.insight-item.warning .insight-icon {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--status-warning);
}

.insight-content h4 {
  font-weight: 600;
  margin-bottom: 2px;
}
.insight-content p {
  color: var(--text-muted);
  font-size: 12px;
}

/* --- Loader Spinner Overlay --- */
.sync-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(8, 12, 20, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-lg);
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease-in-out;
}

.sync-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(3, 199, 90, 0.1);
  border-top-color: var(--color-naver);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 10px rgba(3, 199, 90, 0.2);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sync-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-naver);
}

/* --- Select Controls --- */
.select-control {
  width: 100%;
  background-color: rgba(8, 12, 20, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 13px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-primary);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  transition: var(--transition-smooth);
}

.select-control:focus {
  outline: none;
  border-color: var(--color-naver);
  box-shadow: 0 0 10px rgba(3, 199, 90, 0.15);
}

/* --- Price Match Visualizer --- */
.price-comparison-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.comparison-progress-track {
  flex-grow: 1;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.comparison-progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
  border-radius: 6px;
  transition: width 1s ease-in-out;
}

/* --- Modals --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-container {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 600px;
  border-radius: var(--border-radius-lg);
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  animation: modalScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  color: var(--text-main);
}

/* --- Responsive Adjustments --- */
@media (max-width: 1200px) {
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-main-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 70px;
  }
  .sidebar .logo-text, .sidebar .nav-item span {
    display: none;
  }
  .main-content {
    margin-left: 70px;
    padding: 16px;
  }
  .grid-cols-3, .grid-cols-2 {
    grid-template-columns: 1fr;
  }
}
