/* ==========================================================================
   EVA — AGENTE IA PROKARTING RITOQUE
   Design System: Monocromático de Lujo (Negro Grafito, Negro Profundo y Plata)
   Header despegado del margen superior con barra de acciones horizontal continua.
   ========================================================================== */

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

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --bg-app: #f4f4f5;
  --bg-sidebar: #09090b;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-graphite: #18181b;
  --bg-graphite-light: #27272a;
  
  --border-color: #e4e4e7;
  --border-dark: #27272a;
  --border-subtle: #f4f4f5;

  --text-main: #09090b;
  --text-muted: #71717a;
  --text-light: #a1a1aa;

  --brand-black: #09090b;
  --brand-graphite: #18181b;
  --brand-border: #27272a;
  --brand-accent: #e11d48;
  --brand-green: #10b981;

  --sidebar-width: 260px;
  --header-height: 68px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  
  --transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* App Shell */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Monocromático Oscuro Grafito */
.sidebar {
  width: var(--sidebar-width);
  background: #09090b;
  border-right: 1px solid #27272a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 40;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.collapsed {
  width: 68px !important;
  min-width: 68px !important;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-item span:nth-child(2),
.sidebar.collapsed .pill-test,
.sidebar.collapsed .annual-badge,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .nav-api-badges {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  padding: 1.25rem 0.5rem;
  justify-content: center;
}

.sidebar.collapsed .brand-badge-box {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.8rem 0.4rem;
}

.sidebar.collapsed .nav-item-left {
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed .nav-item-left span:first-child {
  font-size: 1.25rem;
  margin: 0 auto;
}

.sidebar-header {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #27272a;
}

.brand-badge-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon-sq {
  width: 32px;
  height: 32px;
  background: #18181b;
  border: 1px solid #27272a;
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.brand-name {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: #a1a1aa;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-item:hover {
  background: #18181b;
  color: #ffffff;
  border-color: #27272a;
}

.nav-item.active {
  background: #18181b;
  color: #ffffff;
  border-color: #3f3f46;
  font-weight: 700;
}

.pill-test {
  background: #27272a;
  color: #d4d4d8;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.sidebar-footer {
  padding: 1.1rem 1.25rem;
  border-top: 1px solid #27272a;
  background: #09090b;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.4rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #a1a1aa;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

/* Main Workspace */
.main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   HEADER / TOPBAR — Despegado del margen superior y alineado en UNA sola línea
   ========================================================================== */
.topbar-wrapper {
  padding: 0.85rem 1.5rem 0 1.5rem;
  flex-shrink: 0;
}

.topbar {
  background: #09090b;
  border: 1px solid #27272a;
  border-radius: 12px;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.page-headline h2 {
  font-size: 0.98rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.page-headline p {
  font-size: 0.72rem;
  color: #a1a1aa;
}

/* Acciones en UNA sola línea horizontal elegante */
.topbar-actions-strip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: 3px 5px;
}

.topbar-action-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #e4e4e7;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
  white-space: nowrap;
}

.topbar-action-btn:hover {
  background: #27272a;
  color: #ffffff;
  border-color: #3f3f46;
}

.topbar-action-btn.active {
  background: #27272a;
  color: #ffffff;
  border-color: #52525b;
}

.topbar-divider {
  width: 1px;
  height: 18px;
  background: #27272a;
  margin: 0 2px;
}

.topbar-select {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.topbar-select option {
  background: #18181b;
  color: #ffffff;
}

/* Content Area */
.content-area {
  flex: 1;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  background: var(--bg-app);
}

.view-panel {
  display: none;
  animation: fadeIn 0.15s ease-in-out;
}

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

/* Cards & Layout */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

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

.card-title {
  font-size: 0.92rem;
  font-weight: 750;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Notice Box Monocromático */
.notice-box {
  background: #18181b;
  border: 1px solid #27272a;
  color: #e4e4e7;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.45;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

/* Chat Simulator */
.chat-window {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fafafa;
  height: 380px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.chat-bubble {
  max-width: 80%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  position: relative;
}

.chat-bubble-eva {
  align-self: flex-start;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
  box-shadow: var(--shadow-sm);
}

.chat-bubble-user {
  align-self: flex-end;
  background: #18181b;
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-time {
  font-size: 0.65rem;
  color: var(--text-light);
  margin-top: 0.35rem;
  text-align: right;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.quick-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.quick-btn:hover {
  background: #18181b;
  color: #ffffff;
  border-color: #18181b;
}

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
}

.input-text {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
  background: #ffffff;
}

.input-text:focus {
  border-color: #09090b;
  box-shadow: 0 0 0 2px rgba(9, 9, 11, 0.1);
}

.btn-primary {
  background: #09090b;
  color: white;
  border: 1px solid #27272a;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  background: #18181b;
  border-color: #3f3f46;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline:hover {
  background: #f4f4f5;
  color: var(--text-main);
  border-color: #cbd5e1;
}

/* Telemetry Box */
.telemetry-card {
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.telemetry-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.telemetry-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.progress-bar-bg {
  width: 100%;
  height: 5px;
  background: #e4e4e7;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.45rem;
}

.progress-bar-fill {
  height: 100%;
  background: #18181b;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ==========================================================================
   SISTEMA DE RESERVAS OFICIAL & SLOTS — Monocromático Grafito
   ========================================================================== */
.booking-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
}

.date-tabs-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.date-tab-btn {
  background: #f4f4f5;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.date-tab-btn.active {
  background: #09090b;
  color: #ffffff;
  border-color: #09090b;
}

.slot-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.slot-item-btn {
  background: #09090b;
  color: #ffffff;
  border: 1px solid #27272a;
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.slot-item-btn:hover {
  background: #18181b;
  border-color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.slot-item-btn.slot-selected {
  background: #18181b;
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #ffffff;
}

.slot-item-btn.slot-soldout {
  background: #18181b;
  opacity: 0.35;
  cursor: not-allowed;
  border-color: #27272a;
}

.slot-time {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.slot-cupos {
  font-size: 0.68rem;
  color: #a1a1aa;
  font-weight: 600;
}

.slot-cupos.avail-green {
  color: #10b981;
}

.slot-cupos.avail-amber {
  color: #f59e0b;
}

/* ==========================================================================
   SELECTOR DE PILOTOS ([-] [ 1 ] [+]) — Replicando https://prokarting.cl/reservar/
   ========================================================================== */
.pilot-step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.65rem;
}

.pilot-step-badge {
  background: #ef171d;
  color: #ffffff;
  font-weight: 900;
  font-size: 0.85rem;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pilot-step-title {
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.pilot-counter-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #09090b;
  padding: 0.85rem 1.15rem;
  border-radius: 10px;
  border: 1px solid #27272a;
  color: white;
}

.pilot-btn-ctrl {
  width: 38px;
  height: 38px;
  background: #18181b;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.pilot-btn-ctrl:hover {
  background: #27272a;
  border-color: #ffffff;
}

.pilot-display-badge {
  width: 65px;
  height: 38px;
  background: #ffffff;
  color: #09090b;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Barra de Navegación Anual */
.annual-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #18181b;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #27272a;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.annual-month-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #a1a1aa;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.annual-month-btn:hover {
  color: #ffffff;
  background: #27272a;
}

.annual-month-btn.active {
  background: #ffffff;
  color: #09090b;
  font-weight: 800;
}

.slot-item-btn.slot-selected {
  border-color: #10b981 !important;
  background: #0f231c !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4) !important;
}

.annual-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 540px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  border: 1px solid #27272a;
}

.modal-dialog-header {
  padding: 1.15rem 1.5rem;
  background: #09090b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #27272a;
}

.modal-dialog-body {
  padding: 1.5rem;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
}

.modal-dialog-footer {
  padding: 1rem 1.5rem;
  background: #fafafa;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Learning Memory Cards */
.learning-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 0.85rem;
  transition: var(--transition);
}

.learning-card:hover {
  border-color: #a1a1aa;
}

.learning-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.45rem;
  background: #18181b;
  color: #ffffff;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  background: #fafafa;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.data-table tr:hover td {
  background: #fafafa;
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #09090b;
  border: 1px solid #27272a;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: fadeIn 0.15s ease;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #a1a1aa;
  border-radius: 999px;
}
