/* ============================
   Dashboard Lanzamiento TK
   ============================ */

:root {
  --bg: #0F0F14;
  --bg-card: #1A1A24;
  --bg-card-hover: #22223A;
  --border: #2A2A3E;
  --text: #E8E8F0;
  --text-muted: #8888A0;
  --accent: #6C5CE7;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --green: #00B894;
  --orange: #E17055;
  --blue: #0984E3;
  --pink: #FD79A8;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #16161F 0%, var(--bg) 100%);
}

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

.logo {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.refresh-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-refresh {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-refresh:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.btn-refresh.spinning svg { animation: spin 1s linear infinite; }

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

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(0, 184, 148, 0.5);
}

.status-dot.error { background: var(--orange); box-shadow: 0 0 8px rgba(225, 112, 85, 0.5); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.tab:hover { color: var(--text); background: var(--bg-card); }
.tab.active { color: white; background: var(--accent); box-shadow: 0 2px 12px var(--accent-glow); }

/* Tab Content */
.tab-content { display: none; padding: 24px 32px; }
.tab-content.active { display: block; }

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.kpi-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-content { display: flex; flex-direction: column; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.kpi-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.chart-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* Tables */
.section-header { margin-bottom: 24px; }
.section-header h2 { font-size: 22px; font-weight: 700; }
.section-header p { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow: hidden;
}

.table-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid rgba(42, 42, 62, 0.5); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(108, 92, 231, 0.05); }

.custom-utm-section { margin-top: 32px; }
.custom-utm-section h2 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }

/* Landing Pages Grid */
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.landing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s;
}

.landing-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.landing-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.landing-card .url { font-size: 12px; color: var(--accent); margin-bottom: 16px; word-break: break-all; }
.landing-card .meta { display: flex; gap: 12px; flex-wrap: wrap; }
.landing-card .meta-item { font-size: 13px; color: var(--text-muted); }
.landing-card .meta-item span { color: var(--text); font-weight: 600; }
.landing-card .badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.published { background: rgba(0,184,148,0.15); color: var(--green); }
.badge.draft { background: rgba(225,112,85,0.15); color: var(--orange); }

.loading-message { text-align: center; color: var(--text-muted); padding: 40px; }

/* Chat */
.chat-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 500px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.chat-header-icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.chat-header h2 { font-size: 18px; font-weight: 700; }
.chat-header p { font-size: 13px; color: var(--text-muted); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-message.user { flex-direction: row-reverse; }

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-message.assistant .message-avatar { background: var(--accent); color: white; }
.chat-message.user .message-avatar { background: var(--green); color: white; }

.message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.chat-message.user .message-bubble { background: rgba(108, 92, 231, 0.15); border-color: rgba(108, 92, 231, 0.3); }

.chat-suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.suggestion {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion:hover { color: var(--text); border-color: var(--accent); background: rgba(108, 92, 231, 0.1); }

.chat-input {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.chat-input input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input input:focus { border-color: var(--accent); }
.chat-input input::placeholder { color: var(--text-muted); }

.chat-input button {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-input button:hover { transform: scale(1.05); box-shadow: 0 4px 20px var(--accent-glow); }
.chat-input button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 8px 0; }
.typing-indicator span { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%; animation: typing 1.4s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 16px; }
  .tabs { padding: 10px 16px; overflow-x: auto; }
  .tab-content { padding: 16px; }
  .charts-grid, .tables-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chat-container { height: calc(100vh - 160px); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
