/* === El Misti Occupancy Dashboard — Styles === */
:root {
  --primary: #FD8000;
  --primary-hover: #e57300;
  --navy: #0A2540;
  --navy-light: #1a3a5c;
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
  --blue-light: rgba(59, 130, 246, 0.1);
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 40px;
}

/* HEADER */
.header {
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
  letter-spacing: 1px;
}
.header-title {
  font-size: 14px;
  opacity: 0.9;
}
.last-update {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.7;
}

/* FILTROS */
.filters-bar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.filter-group select {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  min-width: 120px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.filter-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(253, 128, 0, 0.15);
}
.btn-apply {
  padding: 6px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-apply:hover { background: var(--primary-hover); }

/* KPI CARDS */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px 24px;
}
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
}
.kpi-delta {
  font-size: 13px;
  font-weight: 600;
}
.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red); }
.kpi-delta.neutral { color: var(--text-muted); }

/* CHART */
.chart-container {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 0 24px 20px;
  box-shadow: var(--shadow);
}

/* SECTION TITLE */
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
}

/* TABLE */
.table-container {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 0 24px 20px;
  box-shadow: var(--shadow);
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.granularity-btns {
  display: flex;
  gap: 4px;
}
.gran-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.gran-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.gran-btn:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}
.table-scroll {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--bg);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tr:hover td {
  background: var(--blue-light);
}
.data-table .col-year-current { font-weight: 600; color: var(--navy); }
.data-table .col-year-compare { color: var(--text-muted); }

/* INSIGHTS */
.insights-container {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 0 24px 20px;
  box-shadow: var(--shadow);
}
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 4px solid var(--border);
}
.insight-card.positivo { border-left-color: var(--green); background: rgba(16, 185, 129, 0.04); }
.insight-card.negativo { border-left-color: var(--red); background: rgba(239, 68, 68, 0.04); }
.insight-card.neutro { border-left-color: var(--blue); background: rgba(59, 130, 246, 0.04); }
.insight-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.insight-card.positivo .insight-icon { background: rgba(16, 185, 129, 0.15); }
.insight-card.negativo .insight-icon { background: rgba(239, 68, 68, 0.15); }
.insight-card.neutro .insight-icon { background: rgba(59, 130, 246, 0.15); }
.insight-content { flex: 1; }
.insight-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}
.insight-desc {
  font-size: 13px;
  color: var(--text-muted);
}
.insight-suggestion {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin-top: 6px;
}

/* CHATBOT */
.chatbot-container {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 0 24px 20px;
  box-shadow: var(--shadow);
}
.chatbot-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.chatbot-stat {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
}
.chatbot-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}
.chatbot-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* LOADING */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* RESPONSIVE */
@media (max-width: 768px) {
  .filters-bar { padding: 12px 16px; }
  .kpi-row { padding: 16px; grid-template-columns: repeat(2, 1fr); }
  .chart-container, .table-container, .insights-container, .chatbot-container {
    margin: 0 12px 16px;
    padding: 16px;
  }
  .kpi-value { font-size: 22px; }
  .table-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}
