/* ============================================================
   🌙 Ausry Core – CSS limpio y funcional (sidebar + dock + notas)
   ============================================================ */

/* ---------- Variables ---------- */
:root { --sidebar-w: 264px; }

/* ---------- Reset base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  min-height: 100vh;
  background: #0e0f10;
  color: #e7e7ea;
  font-family: system-ui, Segoe UI, Roboto, Helvetica, Arial;
  overscroll-behavior-y: none; /* suaviza rebote móvil */
}

/* Contenedor app */
.app { display: flex; flex: 1; min-height: 100vh; }

/* ============================================================
   HEADER (opcional) + botón menú
   ============================================================ */
.fixed-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3.5rem;
  background: #0e0f10;
  
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem;
  z-index: 1002;
}
.menu-button{
  position: fixed; top: .75rem; left: .75rem;
  z-index: 1003;
  background: #1b1c1f; color: #fff;
  border: 0; border-radius: .5rem;
  padding: .5rem .65rem; font-size: 1.25rem;
  cursor: pointer;
}

/* ============================================================
   SIDEBAR: fijo a la izquierda, con estados open/closed
   ============================================================ */
.sidebar{
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100%;
  background: #121316;
 
  padding: 1rem;
  display: flex; flex-direction: column; gap: 1rem;
  overflow: auto;
  z-index: 1001;
  transform: translateX(0);
  transition: transform .25s ease;
}

/* Estado cerrado (desktop o mobile) */
.sidebar.closed{ transform: translateX(-100%); }
.sidebar.open{ transform: translateX(0); }

.sidebar header{ padding: 1rem 1rem .5rem; font-weight: 600; opacity: .85; }

.menu{ display: flex; flex-direction: column; padding: .25rem; }
.menu .item, .sidebar .menu-item{
  padding: .75rem 1rem; border-radius: .5rem; cursor: pointer; color: #ccc;
  transition: background .2s ease;
}
.menu .item:hover, .sidebar .menu-item:hover{ background: #1a1b1f; }
.menu .item.active, .sidebar .menu-item.active{ background: #22242a; color: #fff; }

/* ============================================================
   OVERLAY: sólo visible cuando abrimos menú en mobile
   ============================================================ */
.overlay{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: saturate(140%) blur(2px);
  display: none;
  z-index: 999;
  transition: opacity .25s ease;
}
.overlay.show{ display: block; }

/* ============================================================
   MAIN: margen según estado del sidebar + padding para dock
   ============================================================ */
main{
  position: relative;
  flex: 1;
  display: flex; flex-direction: column;
  /* por defecto en desktop dejamos espacio al sidebar */
  margin-left: var(--sidebar-w);
  padding: 1rem;
  padding-bottom: 6rem; /* espacio para el dock flotante */
  min-height: 100vh;
  transition: margin-left .25s ease;
  overflow: auto;
}

/* Si el sidebar está cerrado, el main aprovecha todo el ancho */
.sidebar.closed ~ main{ margin-left: 0; }

/* Título Core (si lo usas dentro del main) */
main h2#core{
  margin: 0 0 1rem 0;
  padding-left: calc(40px + 1rem); /* espacio junto al botón ☰ */
  font-size: 1.4rem; font-weight: 600; color: #e7e7ea;
}

/* ============================================================
   DOCK del clasificador (textarea + botón)
   ============================================================ */
.classifier-dock{
  position: fixed; /* fijo sobre el flujo para que siempre esté visible */
  left: 50%;
  transform: translateX(-50%);
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(900px, calc(100% - 2rem));
  background: #323030;
 
  border-radius: 2rem;
  padding: .5rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.classifier-dock textarea{
  flex: 1;
  background: transparent; border: none; outline: none; resize: none;
  color: #e7e7ea; font-size: 1rem; line-height: 1.4;
  padding: .5rem 0; min-height: 1.4em; max-height: 200px; overflow-y: auto;
}

.classifier-dock button{
  background: #414040; color: #fff;
  border: none; border-radius: 50%;
  width: 42px; height: 42px; font-size: 1.2rem;
  cursor: pointer; flex-shrink: 0;
  transition: background .2s ease, transform .1s ease;
}
.classifier-dock button:hover{ background: #403e3e; transform: scale(1.05); }

/* Salida del clasificador, justo encima del dock */
.classifier-output{
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(70px + env(safe-area-inset-bottom));
  width: min(900px, calc(100% - 2rem));
  background: #1a1b1f;
 border-radius: .75rem;
  padding: 1rem;
  font-family: monospace; font-size: .9rem; color: #ddd;
  white-space: pre-wrap; word-break: break-word;
  display: none; z-index: 999;
}

/* ============================================================
   TARJETAS / NOTAS / GRID
   ============================================================ */
.section{ display: flex; flex-direction: column; height: 100%; }

.card{
   border-radius: .75rem;
  padding: 1rem; margin-top: 0px;
}

.row{ display: flex; gap: 1rem; flex-wrap: wrap; }
.grow{ flex: 1 1 320px; }

.notes-wrap{ position: relative; }

.grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.note{
  background: #0f1012; border-radius: .75rem;
  padding: .75rem; cursor: pointer;
}

.tags{ display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.tag{
  padding: .1rem .5rem;border-radius: 999px;
  font-size: .8rem; opacity: .8;
}

.split{ display: grid; grid-template-columns: 320px 1fr; gap: 1rem; }
.list{ overflow: auto; max-height: calc(100vh - 6rem); }
.list .note.active{ outline: 2px solid #3c82f6; }

/* Inputs básicos */
textarea, select, input, button{ font: inherit; }
textarea{
  width: 100%; min-height: 120px;
  background: #0e0f10; color: #e7e7ea;
  border-radius: .5rem;
  padding: .6rem;
}
input, select{
  width: 100%; background: #0e0f10; color: #e7e7ea;
  border-radius: .5rem;
  padding: .5rem;
}
.row .col{ flex: 1 1 160px; }

/* Botón flotante (crear nota, etc.) */
.fab{
  position: fixed; right: 1rem; bottom: calc(1rem + 64px);
  width: 52px; height: 52px; border-radius: 50%;
  border: 0; font-size: 1.5rem;
  background: #2b2f36; color: #fff; cursor: pointer;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 1024px){
  .sidebar{ width: 200px; }
  /* Si sidebar está visible en tablet, main acompaña */
  main{ margin-left: 200px; }
  .sidebar.closed ~ main{ margin-left: 0; }
}

/* Móvil & narrow (sidebar como overlay deslizante) */
@media (max-width: 900px){
  /* Sidebar fuera por defecto; se muestra con .open */
  .sidebar{ transform: translateX(-100%); width: 220px; }
  .sidebar.open{ transform: translateX(0); }

  /* Main siempre a ancho completo en móvil */
  main{ margin-left: 0; padding-top: 4rem; }

  /* Overlay visible cuando se abre sidebar */
  .overlay.show{ display: block; }
}

/* iPad/teclado: previene zoom al enfocar */
textarea, input, select, button{ font-size: 16px; }

/* Imágenes/canvas fluidos */
canvas{ max-width: 100%; height: 200px; }

/* Safe areas modernos */
@supports (height: 100dvh){
  body{ min-height: 100dvh; }
}

/* === Dock que respeta el sidebar (dentro de main) === */
#main {
  position: relative;
  display: flex;
  flex-direction: column;
  /* espacio para que el dock no tape el contenido al hacer scroll */
  padding-bottom: 6.5rem;
  overflow-y: auto;
  
}

/* El dock se pega al fondo de MAIN y se estira al ancho de MAIN */
.classifier-dock {
   position: sticky;
  bottom: 0;
  align-self: center;          
  width: min(900px, 100%);     
  max-width: none;       /* sin límite; si quieres, puedes poner 900px */
  margin: 0;             /* usa el padding de main */
  left: auto; right: auto; transform: none;
  z-index: 5;            /* sobre el contenido, debajo del overlay */
  margin-top:auto; /* separa del contenido al hacer scroll */
  max-width: 900px; /* opcional: no más ancho que esto */

}



/* Móvil: el sidebar es overlay; no hay que hacer nada extra, pero por si acaso: */
@media (max-width: 900px) {
  #main { padding-bottom: 6.5rem; }
  .classifier-dock { width: 100%; align-self: stretch; }
}
/* === MAIN CONTENEDOR === */
main {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100dvh; /* Altura dinámica para iOS */
  overflow-y: auto; /* permite scroll dentro */
  padding: calc(env(safe-area-inset-top) + 1rem) 1rem calc(env(safe-area-inset-bottom) + 6rem);
  box-sizing: border-box;
}

/* === DOCK STICKY === */
.classifier-dock {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + 0.75rem);
  background: #323030;
  
  border-radius: 2rem;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto; /* empuja hacia el final del flujo */
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  z-index: 10;
  box-shadow: none;
}

/* === ELEMENTOS INTERNOS === */
.classifier-dock textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #e7e7ea;
  font-size: 1rem;
  padding: 0.4rem 0;
  line-height: 1.4;
  min-height: 1.4em;
  max-height: 8rem;
}

.classifier-dock button {
  background: #414040;
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
  cursor: pointer;
}

.classifier-dock button:hover {
  background: #403e3e;
}

/* === CORRECCIÓN PARA IPHONE === */
@supports (height: 100dvh) {
  html, body {
    height: 100dvh;
  }
}

body {
  overscroll-behavior-y: none; /* evita salto al abrir teclado */
}







/* ============================================================
   🌙 Panel de chat rojo tipo “blueprint card”
   ============================================================ */

/* Panel rojo tipo “blueprint card” */
.clf-panel {
  position: relative;
  width: min(980px, 90vw);
  height: 85vh;
  margin: 0px auto 12px auto;      /* centrado */
  padding: 24px;
 background: #0e0f10;
  color: #e7e7ea;               /* texto oscuro legible sobre rojo */
  border-radius: 14px;

  overflow: hidden;                  /* el header queda fijo */
  display: flex;
  flex-direction: column;
}

/* Header del panel */
.clf-panel-header {
  font-weight: 700;
  letter-spacing: .3px;
  margin-bottom: 12px;
}

/* Área de mensajes con scroll */
.clf-messages {
  flex: 1;
  overflow-y: scroll; /* activa el scroll */
  background: #0e0f10;
  border-radius: 10px;
  padding: 14px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer y Edge */
}

/* Chrome, Safari y otros WebKit */
.clf-messages::-webkit-scrollbar {
  display: none;
}


/* Mensajes */
.clf-msg { 
  padding: 10px 12px; 
  border-radius: 10px; 
  margin-bottom: 8px; 
  white-space: pre-wrap; 
  line-height: 1.35;
}
.clf-msg.user {
   background: #151515;
  align-self: flex-end;

}
.clf-msg.assistant {
 background: #0e0f10;
  align-self: flex-start;
}


.classifier-output { display: none; }




/* ============================================================
   FOCUS TAGS ADDED FOR CHAT GPT - MAY NOT BE NEEDED
   ============================================================ */  
   .tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tag-chip {
  padding: .25rem .6rem;
  border-radius: 999px;
  border: 1px solid #555;
  font-size: 0.85rem;
  opacity: 0.9;
}
.tag-chip.selected {
  background-color: #3c82f6;
  color: #fff;
  border-color: #3c82f6;
  opacity: 1;
} 

/* ============================================================
   BOTON DE RELOAD DE SUMMARY TAGS 
   ============================================================ */  
.pull-hint {
  font-size: 0.8rem;
  text-align: center;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
  margin-bottom: 0.25rem;
  color: #888;
}
.tag-refresh-btn {
  background: none;        /* sin fondo */
  border: none;            /* sin borde */
  color: #b3b3b3;          /* gris suave estilo macOS */
  font-size: 1.1rem;       /* tamaño del icono */
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;      /* bordes redondeados Apple */
  transition: 
    color 0.25s ease,
    background-color 0.25s ease,
    transform 0.2s ease;
}

.tag-refresh-btn:hover {
  color: #ffffff;                    /* más brillante en hover */
  background: rgba(255,255,255,0.06); /* efecto “glass blur” */
  transform: scale(1.1);             /* pequeño zoom al estilo macOS */
}

.tag-refresh-btn:active {
  transform: scale(0.95);  /* clic macOS: pequeño “tap” */
}





/* ================================
   Insights – versión más Apple
   ================================ */

/* Contenedor general (centrado, sin gradiente propio) */
.insights-section {
  position: relative;
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 32px 72px;
  color: #f5f5f7;
  background: transparent;              /* fuera rectángulo visible */
}

/* Header */
.insights-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.insights-header h2 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 4px 0;
}

.insights-header p {
  margin: 0;
  font-size: 14px;
  color: #a1a1aa;
}

/* Pill resumen (más discreto) */
.insights-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.85);
  
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
}

.summary-text {
  font-size: 13px;
  color: #e5e7eb;
}

/* Grid de cards (más respiración) */
.insights-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}

/* Glow muy suave detrás del bloque de cards */
.insights-grid::before {
  content: "";
  position: absolute;
  inset: -40px -60px;
  
  pointer-events: none;
  z-index: -1;
}

@media (max-width: 1024px) {
  .insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .insights-section {
    max-width: 100%;
    padding: 24px 16px 48px;
  }

  .insights-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin-top: 20px;
  }

  .insights-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Card individual – estilo iCloud */
.insight-card {
  position: relative;
  padding: 20px 20px 18px;
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    #18181b 100%,
    #111116 55%,
    #050508 100%
  );                                    /* degradado casi plano */
  
  box-shadow:
    0 26px 55px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Chip fila superior */
.insight-chip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

.insight-chip-kind {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(31, 41, 55, 0.9);
  color: #e5e7eb;
}

.insight-chip-priority {
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
}

/* Emoji + título */
.insight-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.insight-emoji {
  font-size: 22px;
}

.insight-title {
  font-size: 16px;
  font-weight: 600;
}

/* Textos */
.insight-summary {
  font-size: 13px;
  color: #e4e4e7;
}

.insight-details {
  font-size: 12px;
  color: #9ca3af;
}

/* Footer de tags */
.insight-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
}

.insight-tag {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #020617;
  color: #cbd5f5;
}

.insight-timeframe {
  font-size: 11px;
  color: #9ca3af;
}



/* ============================================================
   DISENO DE LAS 2 FLECHAS DE SCROLL PANEL DE INSIGHTS
   ============================================================ */
/* Contenedor de navegación */
.insights-nav {
  margin: 10px 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.insights-nav-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  color: #ccc;
  cursor: pointer;
  padding: 6px 10px;
  transition: color 0.2s, transform 0.2s;
}

.insights-nav-btn:hover {
  color: #fff;
  transform: scale(1.1);
}

.insights-timeline {
  display: flex;
  gap: 18px;
  align-items: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
  opacity: 0.4;
  transition: transform 0.2s, opacity 0.2s, background 0.2s;
}

.dot.filled {
  background: #ffffff;
  opacity: 0.9;
}

.dot.empty {
  background: #777;
  opacity: 0.3;
}

.dot.current {
  transform: scale(1.4);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
  opacity: 1;
}



/* ============================================================
   CMABIO TRASENDENTE DE UN DIA PARA OTRO EN LAS CARDS DE INSIGHTS
   ============================================================ */
   /* Animación de cambio de día */
.insights-wrapper {
  position: relative;
}

/* Entrar desde la derecha (cuando avanzas →) */
.day-slide-left {
  animation: daySlideLeft 220ms ease-out;
}

@keyframes daySlideLeft {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Entrar desde la izquierda (cuando vas ←) */
.day-slide-right {
  animation: daySlideRight 220ms ease-out;
}

@keyframes daySlideRight {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Cambio neutro (por ejemplo primer load) */
.day-fade {
  animation: dayFade 220ms ease-out;
}

@keyframes dayFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
