/* ===================================================
   META ADS DASHBOARD — Antigravity
   Dark Mode Design System
   =================================================== */

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2333;
  --bg-card: #161b22;
  --bg-card-hover: #1c2333;
  --bg-input: #0d1117;

  --border-primary: rgba(88, 166, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(88, 166, 255, 0.3);

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --text-accent: #58a6ff;

  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-emerald: #2ea043;
  --accent-red: #f85149;
  --accent-yellow: #d29922;
  --accent-purple: #bc8cff;
  --accent-cyan: #39d2c0;

  --gradient-blue: linear-gradient(135deg, #58a6ff 0%, #1f6feb 100%);
  --gradient-green: linear-gradient(135deg, #3fb950 0%, #2ea043 100%);
  --gradient-red: linear-gradient(135deg, #f85149 0%, #da3633 100%);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(88, 166, 255, 0.15);

  --sidebar-width: 240px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow), width var(--transition-slow);
}

/* Sidebar Collapsed State (Mini Mode) */
.sidebar.collapsed {
  width: 60px;
  transform: none;
}

.sidebar.collapsed~.main-content {
  margin-left: 60px;
}

/* Hide text in mini mode */
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .data-status span,
.sidebar.collapsed #sidebar-brand-name {
  display: none;
}

/* Center icons */
.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 20px 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 14px 0;
}

.sidebar.collapsed .sidebar-footer {
  padding: 12px;
}

.sidebar.collapsed .data-status {
  justify-content: center;
}

/* Rotate toggle button */
.sidebar.collapsed .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

/* Floating reopen button — visible only when sidebar collapsed */
.sidebar-reopen {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 150;
  width: 28px;
  height: 56px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.sidebar-reopen:hover {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-blue);
  width: 36px;
}

.sidebar-reopen svg {
  width: 16px;
  height: 16px;
}

body.sidebar-collapsed .sidebar-reopen {
  display: flex;
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
}

.brand-icon svg,
.brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-name {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 2px;
  background: var(--gradient-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(88, 166, 255, 0.06);
}

.nav-item.active {
  color: var(--accent-blue);
  background: rgba(88, 166, 255, 0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent-blue);
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  margin-bottom: 10px;
  background: rgba(88, 166, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all var(--transition-fast);
}

.sidebar-toggle-btn:hover {
  background: rgba(88, 166, 255, 0.12);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.sidebar-toggle-btn svg {
  transition: transform var(--transition-normal);
}

.data-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left var(--transition-slow);
}

/* ===== HEADER ===== */
.top-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(22, 27, 34, 0.85);
}

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--gradient-blue);
  border-radius: var(--radius-sm);
  font-weight: 900;
  font-size: 1rem;
  color: white;
}

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

.date-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-dates {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-separator {
  color: var(--text-muted);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent-blue);
  border-color: var(--border-accent);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== FORM CONTROLS ===== */
.select-control,
.text-input,
.date-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  outline: none;
}

.select-control:focus,
.text-input:focus,
.date-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.select-control {
  cursor: pointer;
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ===== VIEWS ===== */
.view {
  display: none;
  padding: 24px;
  height: 100%;
  overflow-y: auto;
  padding-bottom: 80px;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

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

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

.view-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
}

/* ===== DASHBOARD LAYOUT ===== */
.budget-card {
  margin-bottom: 24px;
}

.top-ads-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 16px;
}

.top-ads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.top-ads-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-ads-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.select-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
  min-width: auto;
}

.top-ads-list {
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
}

/* Budget Card */
.budget-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(88, 166, 255, 0.05) 100%);
  width: fit-content;
  margin-left: auto;
  min-width: 320px;
}

.budget-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.budget-amount {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1.1;
}

.budget-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  margin-top: 4px;
}

.budget-sparkline {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#sparkline-chart {
  width: 140px !important;
  height: 60px !important;
  max-width: 140px;
  max-height: 60px;
}

.sparkline-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-top: 4px;
}

/* Chart Card */
.chart-card {
  flex: 1;
  margin-top: 32px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* KPI Row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-blue);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.kpi-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-blue);
}

/* ===== TOP ADS ===== */
.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-left: 4px;
}

.top-ads-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}

.top-ad-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 14px;
  transition: all var(--transition-normal);
  cursor: default;
  position: relative;
}

.top-ad-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateX(4px);
}

.top-ad-card.winner {
  border-color: rgba(63, 185, 80, 0.3);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(63, 185, 80, 0.05) 100%);
}

.top-ad-rank {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 166, 255, 0.1);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-blue);
  flex-shrink: 0;
  align-self: center;
}

.top-ad-card.winner .top-ad-rank {
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-green);
}

.top-ad-info {
  flex: 1;
  min-width: 0;
}

.top-ad-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-ad-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.top-ad-stat {
  font-size: 0.78rem;
}

.top-ad-stat-label {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.68rem;
}

.top-ad-stat-value {
  color: var(--text-primary);
  font-weight: 600;
}

.top-ad-stat-value.good {
  color: var(--accent-green);
}

.top-ad-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-winner {
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.badge-fatigue {
  background: rgba(210, 153, 34, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.badge-loser {
  background: rgba(248, 81, 73, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

/* ===== FOOTER ===== */
.dash-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.footer-updated {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--gradient-blue);
  border-radius: 6px;
  font-weight: 900;
  font-size: 0.75rem;
  color: white;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 300px;
}

/* ===== ADS EXPLORER ===== */
.explorer-header {
  margin-bottom: 20px;
}

.explorer-filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for table */
.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(88, 166, 255, 0.3);
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(88, 166, 255, 0.5);
}

.data-table {
  min-width: 900px;
}

.data-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.data-table th:hover {
  background: rgba(88, 166, 255, 0.08);
}

.data-table th .th-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.data-table th .sort-icon {
  width: 14px;
  height: 14px;
  opacity: 0.3;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.data-table th:hover .sort-icon {
  opacity: 0.6;
}

.data-table th.sort-active .sort-icon {
  opacity: 1;
  color: var(--accent-blue);
}

.data-table th.sort-active {
  color: var(--accent-blue);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover td {
  background: rgba(88, 166, 255, 0.04);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.status-active {
  color: var(--accent-green);
}

.status-inactive {
  color: var(--text-muted);
}

.btn-table {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.btn-table:hover {
  color: var(--accent-red);
  background: rgba(248, 81, 73, 0.1);
}

.btn-table svg {
  width: 16px;
  height: 16px;
}

/* ===== COLUMN CONFIG PANEL ===== */
.filter-group--btn {
  align-self: flex-end;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.col-config-panel {
  margin-bottom: 16px;
  animation: fadeIn 0.2s ease;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.col-config-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 45vh;
  flex: 1;
}

.col-config-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.col-config-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* col-config-list already defined above with scroll */

.col-config-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: all var(--transition-fast);
  user-select: none;
}

.col-config-item:active {
  cursor: grabbing;
}

.col-config-item:hover {
  border-color: var(--border-accent);
  background: rgba(88, 166, 255, 0.04);
}

.col-config-item.dragging {
  opacity: 0.5;
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow);
}

.col-config-item .drag-handle {
  color: var(--text-muted);
  font-size: 1rem;
  cursor: grab;
  flex-shrink: 0;
  line-height: 1;
}

.col-config-item input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

.col-config-item .col-label {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.col-config-item .col-label.disabled {
  color: var(--text-muted);
  text-decoration: line-through;
}

.col-config-arrows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.col-config-arrows button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  font-size: 0.7rem;
  transition: color var(--transition-fast);
}

.col-config-arrows button:hover {
  color: var(--accent-blue);
}

.col-config-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ===== IMPORT VIEW ===== */
.import-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.import-card:last-child {
  grid-column: 1 / -1;
}

.import-card:last-child .manual-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.import-card:last-child .btn-block {
  grid-column: 1 / -1;
}

/* Post-import action buttons */
.post-import-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.post-import-actions .btn {
  flex: 1;
}

.import-card {
  display: flex;
  flex-direction: column;
}

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

.import-card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.import-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-blue);
}

.import-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-accent);
  border-radius: var(--radius-md);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: rgba(88, 166, 255, 0.02);
}

.dropzone:hover,
.dropzone.drag-over {
  background: rgba(88, 166, 255, 0.06);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow);
}

.dropzone-icon {
  width: 40px;
  height: 40px;
  color: var(--accent-blue);
  margin-bottom: 12px;
  opacity: 0.6;
}

.dropzone p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.dropzone strong {
  color: var(--accent-blue);
}

.dropzone-formats {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  margin-top: 6px;
}

/* Upload Progress */
.upload-status {
  margin-top: 16px;
}

.upload-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-blue);
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
}

#upload-message {
  font-size: 0.8rem;
  color: var(--accent-green);
}

/* Sheets Form */
.sheets-form {
  display: flex;
  gap: 8px;
}

.sheets-form .text-input {
  flex: 1;
}

/* Manual Form */
.manual-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-blue);
  color: white;
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(88, 166, 255, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(248, 81, 73, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(248, 81, 73, 0.2);
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.2);
}

.btn-block {
  width: 100%;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
}

.mapping-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mapping-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
}

.mapping-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ===== WINNERS VIEW ===== */
.winners-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.winners-grid .full-width {
  grid-column: 1 / -1;
}

/* Heatmap */
.heatmap-container {
  height: auto;
  min-height: 200px;
}

.heatmap {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  gap: 4px;
  font-size: 0.75rem;
}

.hmap-header {
  padding: 8px 4px;
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.68rem;
}

.hmap-label {
  padding: 8px 4px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}

.hmap-cell {
  padding: 12px 4px;
  text-align: center;
  border-radius: 6px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  cursor: default;
}

.hmap-cell:hover {
  transform: scale(1.05);
}

/* ===== SETTINGS ===== */
.settings-grid {
  display: grid;
  gap: 20px;
  max-width: 640px;
}

.settings-card .card-title {
  margin-bottom: 12px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.setting-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.setting-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.about-info {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.about-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  max-width: 360px;
}

.toast-success {
  background: linear-gradient(135deg, #2ea043, #3fb950);
}

.toast-error {
  background: linear-gradient(135deg, #da3633, #f85149);
}

.toast-info {
  background: linear-gradient(135deg, #1f6feb, #58a6ff);
}

@keyframes slideInRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }

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

/* ===== BRANDING SETTINGS ===== */
.brand-upload-area {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.brand-logo-preview {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 2px dashed var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.brand-logo-preview:hover {
  border-color: var(--accent-blue);
  background: rgba(88, 166, 255, 0.06);
}

.brand-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-logo-preview svg {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}

.brand-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand-fields .text-input {
  width: 100%;
}

.brand-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.brand-color-row label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.color-input {
  width: 36px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px;
  cursor: pointer;
  background: transparent;
}

/* (dash-top-table removed — integrated into top-ads-card) */

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .top-ads-list {
    max-height: 300px;
  }

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

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .header-title {
    font-size: 0.9rem;
    letter-spacing: 1px;
  }

  .budget-amount {
    font-size: 1.8rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

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

  .import-card:last-child .manual-form {
    grid-template-columns: 1fr;
  }

  .explorer-filters {
    flex-direction: column;
  }

  .sheets-form {
    flex-direction: column;
  }

  .col-config-panel {
    max-height: 55vh;
  }

  .col-config-list {
    max-height: 35vh;
  }

  .brand-upload-area {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-profile-save-row {
    flex-direction: column;
  }
}

/* ===== BRAND PROFILES ===== */
.brand-profiles-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.brand-profiles-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.brand-profile-save-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.brand-profile-save-row .text-input {
  flex: 1;
  min-width: 0;
}

.brand-profile-save-row .btn {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.brand-profiles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.brand-profiles-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 24px 12px;
  opacity: 0.7;
}

.brand-profile-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  animation: profileSlideIn 0.25s ease;
}

@keyframes profileSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

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

.brand-profile-item:hover {
  border-color: var(--border-accent);
  background: rgba(88, 166, 255, 0.04);
}

.brand-profile-color {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.brand-profile-info {
  flex: 1;
  min-width: 0;
}

.brand-profile-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-profile-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.brand-profile-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.brand-profile-actions .btn-profile-action {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brand-profile-actions .btn-profile-load:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  background: rgba(88, 166, 255, 0.1);
}

.brand-profile-actions .btn-profile-delete:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: rgba(248, 81, 73, 0.1);
}

.brand-profile-actions .btn-profile-action svg {
  width: 13px;
  height: 13px;
}