/**
 * Evologis Design System — ds.css
 * Tokens, componentes reutilizables y layout shell para el workspace 5.0
 *
 * Uso: añadir <link href=".../css/ds/ds.css"> en cualquier pantalla de app
 * No sustituye a platform_style.css ni style.css; los complementa.
 *
 * Índice:
 *   1. Tokens
 *   2. Reset de app-shell
 *   3. Layout: shell / topbar / sidebar / main
 *   4. Componentes: botones
 *   5. Componentes: tarjetas
 *   6. Componentes: badges y chips
 *   7. Componentes: lista "continuar"
 *   8. Componentes: barra de progreso
 *   9. Componentes: feed de actividad
 *  10. Responsive
 */

/* ════════════════════════════════════════════════════════════════
   1. TOKENS
   ════════════════════════════════════════════════════════════════ */
:root {
  /* Paleta principal (hereda de customizer si está disponible) */
  --ds-gold:          var(--color-principal,  #af8c2b);
  --ds-gold-light:    #c9a84c;
  --ds-gold-bg:       #fdf8ee;
  --ds-gold-badge:    #f5ead0;

  /* Neutros */
  --ds-bg:            #f7f7f5;
  --ds-surface:       #ffffff;
  --ds-border:        #eeece8;
  --ds-border-strong: #d4d0c8;
  --ds-text:          #3c3a36;
  --ds-text-muted:    #8a8680;

  /* Herramientas */
  --ds-hipnotrans:    #7c3aed;
  --ds-hipnotrans-bg: #f3eeff;
  --ds-medmixer:      #0891b2;
  --ds-medmixer-bg:   #e6f7fa;
  --ds-aicare:        #e97b1a;
  --ds-aicare-bg:     #fff4e5;
  --ds-psicotests:    #059669;
  --ds-psicotests-bg: #d1fae5;

  /* Status */
  --ds-status-analysis-bg:  #fdf3c0;
  --ds-status-analysis-txt: #a16207;
  --ds-status-ready-bg:     #d1fae5;
  --ds-status-ready-txt:    #065f46;
  --ds-status-pending-bg:   #fee2e2;
  --ds-status-pending-txt:  #991b1b;

  /* Layout */
  --ds-sidebar-w:     160px;
  --ds-topbar-h:      60px;

  /* Radios */
  --ds-radius-sm:     8px;
  --ds-radius:        14px;
  --ds-radius-lg:     20px;
  --ds-radius-pill:   999px;

  /* Sombras */
  --ds-shadow:        0 2px 12px rgba(0, 0, 0, .07);
  --ds-shadow-hover:  0 6px 20px rgba(0, 0, 0, .12);

  /* Tipografía */
  --ds-font:          var(--main-font, 'Poppins', sans-serif);
}


/* ════════════════════════════════════════════════════════════════
   2. RESET DE APP-SHELL
   Resetea sólo dentro de .evo-shell, no toca el resto del portal.
   ════════════════════════════════════════════════════════════════ */
.evo-shell *,
.evo-shell *::before,
.evo-shell *::after {
  box-sizing: border-box;
}
.evo-shell {
  font-family: var(--ds-font);
  color: var(--ds-text);
  font-size: 14px;
  line-height: 1.5;
  background: var(--ds-bg);
}


/* ════════════════════════════════════════════════════════════════
   3. LAYOUT: SHELL / TOPBAR / SIDEBAR / MAIN
   ════════════════════════════════════════════════════════════════ */

/* Shell: ocupa toda la pantalla */
.evo-shell {
  display: grid;
  grid-template-columns: var(--ds-sidebar-w) 1fr;
  grid-template-rows: var(--ds-topbar-h) 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  min-height: 100vh;
}

/* ── Topbar ── */
.ds-topbar {
  grid-area: topbar;
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.ds-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.ds-topbar__logo {
  width: 34px;
  height: 34px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-gold);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ds-topbar__logo .material-icons,
.ds-topbar__logo .material-icons-round { color: #fff; font-size: 18px; }

.ds-topbar__brand-name  { font-size: 13px; font-weight: 700; letter-spacing: .04em; display: block; }
.ds-topbar__brand-sub   { font-size: 10px; color: var(--ds-text-muted); display: block; }

.ds-topbar__search {
  flex: 1;
  max-width: 380px;
  position: relative;
}
.ds-topbar__search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--ds-text-muted);
  pointer-events: none;
}
.ds-topbar__search input {
  width: 100%;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-pill);
  padding: 8px 16px 8px 36px;
  font-family: var(--ds-font);
  font-size: 13px;
  color: var(--ds-text);
  outline: none;
  transition: border-color .15s;
}
.ds-topbar__search input:focus { border-color: var(--ds-gold); }
.ds-topbar__search input::placeholder { color: var(--ds-text-muted); }

.ds-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

/* ── Sidebar ── */
.ds-sidebar {
  grid-area: sidebar;
  background: var(--ds-surface);
  border-right: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 2px;
  position: sticky;
  top: var(--ds-topbar-h);
  height: calc(100vh - var(--ds-topbar-h));
  overflow-y: auto;
  z-index: 90;
}

.ds-nav-item {
  width: 54px;
  height: 54px;
  border-radius: var(--ds-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ds-text-muted);
  transition: background .15s, color .15s;
  border: none;
  background: transparent;
}
.ds-nav-item:hover { background: var(--ds-bg); color: var(--ds-text); text-decoration: none; }
.ds-nav-item.is-active { background: var(--ds-gold-bg); color: var(--ds-gold); }
.ds-nav-item .material-icons,
.ds-nav-item .material-icons-round { font-size: 22px; }
.ds-nav-item__label { font-size: 9px; font-weight: 500; letter-spacing: .02em; line-height: 1; }

.ds-nav-sep {
  width: 32px;
  height: 1px;
  background: var(--ds-border);
  margin: 4px 0;
  flex-shrink: 0;
}
/* Empujar el último item al fondo */
.ds-nav-sep--push { margin-top: auto; }

/* ── Main ── */
.ds-main {
  grid-area: main;
  overflow-y: auto;
  padding: 28px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}


/* ════════════════════════════════════════════════════════════════
   4. COMPONENTES: BOTONES
   ════════════════════════════════════════════════════════════════ */
.ds-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: var(--ds-radius-pill);
  padding: 10px 22px;
  font-family: var(--ds-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.ds-btn .material-icons,
.ds-btn .material-icons-round { font-size: 17px; }

.ds-btn--primary { background: var(--ds-gold); color: #fff; }
.ds-btn--primary:hover { background: var(--ds-gold-light); color: #fff; text-decoration: none; }

.ds-btn--outline {
  background: transparent;
  color: var(--ds-text);
  border: 1.5px solid var(--ds-border-strong);
}
.ds-btn--outline:hover { border-color: var(--ds-gold); color: var(--ds-gold); text-decoration: none; }

.ds-btn--sm { padding: 7px 14px; font-size: 12px; }
.ds-btn--sm .material-icons,
.ds-btn--sm .material-icons-round { font-size: 15px; }

/* Icon-only button */
.ds-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--ds-radius-pill);
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ds-text-muted);
  transition: background .15s;
  text-decoration: none;
}
.ds-icon-btn:hover { background: var(--ds-bg); }
.ds-icon-btn .material-icons,
.ds-icon-btn .material-icons-round { font-size: 20px; }

/* ── Sidebar nav groups (accordion) ── */
.ds-nav-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.ds-nav-group__header {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 44px;
  border-radius: var(--ds-radius);
  cursor: pointer;
  text-decoration: none;
  color: var(--ds-text-muted);
  background: transparent;
  border: none;
  transition: background .15s, color .15s;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
}
.ds-nav-group__header:hover { background: var(--ds-bg); color: var(--ds-text); }
.ds-nav-group--open > .ds-nav-group__header { color: var(--ds-text); }
.ds-nav-group__header .material-icons,
.ds-nav-group__header .material-icons-round { font-size: 20px; flex-shrink: 0; }
.ds-nav-group__label { flex: 1; text-align: left; }

.ds-nav-group__arrow {
  font-size: 16px !important;
  transition: transform .2s;
  opacity: .5;
}
.ds-nav-group--open > .ds-nav-group__header .ds-nav-group__arrow {
  transform: rotate(180deg);
  opacity: 1;
}

.ds-nav-group__items {
  display: none;
  flex-direction: column;
  padding: 2px 0 4px 8px;
  gap: 1px;
}
.ds-nav-group--open > .ds-nav-group__items { display: flex; }

.ds-nav-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 36px;
  border-radius: var(--ds-radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--ds-text-muted);
  text-decoration: none;
  transition: background .15s, color .15s;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.ds-nav-subitem:hover { background: var(--ds-bg); color: var(--ds-text); }
.ds-nav-subitem.is-active {
  background: var(--ds-gold-bg);
  color: var(--ds-gold);
  border-left-color: var(--ds-gold);
}
.ds-nav-subitem--disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}
.ds-nav-subitem .material-icons,
.ds-nav-subitem .material-icons-round { font-size: 16px; flex-shrink: 0; }

/* Sidebar now renders as a left column with full labels */
.ds-sidebar {
  align-items: stretch !important;
  padding: 12px 8px !important;
}
.ds-nav-item {
  width: auto !important;
  height: 44px !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  padding: 0 12px !important;
  font-size: 12px;
}
.ds-nav-item__label { font-size: 12px !important; font-weight: 500 !important; }
.ds-nav-sep { width: auto !important; margin: 4px 4px !important; }

/* Avatar button */
.ds-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-gold-badge);
  border: 2px solid var(--ds-gold);
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--ds-gold);
}
.ds-avatar-btn .material-icons,
.ds-avatar-btn .material-icons-round { font-size: 20px; }


/* ════════════════════════════════════════════════════════════════
   5. COMPONENTES: TARJETAS
   ════════════════════════════════════════════════════════════════ */
.ds-card {
  background: var(--ds-surface);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow);
  overflow: hidden;
}

.ds-card__header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--ds-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ds-card__title { font-size: 15px; font-weight: 600; }
.ds-card__sub   { font-size: 11px; color: var(--ds-text-muted); margin-top: 2px; }

.ds-card__body { padding: 14px 20px 18px; }
.ds-card__body--tight { padding: 10px 20px 14px; }

/* Tarjeta hero (welcome) */
.ds-hero-card {
  background: var(--ds-surface);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.ds-hero-card__info { flex: 1; min-width: 0; }
.ds-hero-card__actions { display: flex; gap: 10px; flex-shrink: 0; }

/* Tarjeta de herramienta (tile) */
.ds-tool-tile {
  border-radius: var(--ds-radius);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ds-text);
  transition: transform .15s, box-shadow .15s;
}
.ds-tool-tile:hover { transform: translateY(-2px); box-shadow: var(--ds-shadow-hover); text-decoration: none; color: var(--ds-text); }
.ds-tool-tile .material-icons,
.ds-tool-tile .material-icons-round { font-size: 24px; }
.ds-tool-tile__name { font-size: 12px; font-weight: 600; }
.ds-tool-tile__desc { font-size: 10px; color: var(--ds-text-muted); line-height: 1.4; }

.ds-tool-tile--hipnotrans,
.ds-tool-tile--medmixer,
.ds-tool-tile--aicare,
.ds-tool-tile--psicotests { background: #f3f2f1; color: var(--ds-text); border: 1px solid var(--ds-border); }
.ds-tool-tile--hipnotrans .ds-tool-tile__name,
.ds-tool-tile--medmixer   .ds-tool-tile__name,
.ds-tool-tile--aicare     .ds-tool-tile__name,
.ds-tool-tile--psicotests .ds-tool-tile__name { color: var(--ds-text); }
.ds-tool-tile--hipnotrans .material-icons,
.ds-tool-tile--hipnotrans .material-icons-round,
.ds-tool-tile--medmixer   .material-icons,
.ds-tool-tile--medmixer   .material-icons-round,
.ds-tool-tile--aicare     .material-icons,
.ds-tool-tile--aicare     .material-icons-round,
.ds-tool-tile--psicotests .material-icons,
.ds-tool-tile--psicotests .material-icons-round { color: var(--ds-text-muted); }
.ds-tool-tile--hipnotrans .ds-app-icon,
.ds-tool-tile--medmixer   .ds-app-icon,
.ds-tool-tile--aicare     .ds-app-icon,
.ds-tool-tile--psicotests .ds-app-icon { filter: grayscale(1) opacity(0.6); }


/* ════════════════════════════════════════════════════════════════
   6. COMPONENTES: BADGES Y CHIPS
   ════════════════════════════════════════════════════════════════ */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--ds-radius-pill);
}
.ds-badge .material-icons,
.ds-badge .material-icons-round { font-size: 13px; }

.ds-badge--gold    { background: var(--ds-gold-badge); color: var(--ds-gold); }
.ds-badge--muted   { background: var(--ds-bg); color: var(--ds-text-muted); }
.ds-badge--sm      { font-size: 10px; padding: 2px 8px; }

/* Status badges */
.ds-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--ds-radius-pill);
  white-space: nowrap;
}
.ds-status--analysis { background: var(--ds-status-analysis-bg); color: var(--ds-status-analysis-txt); }
.ds-status--ready    { background: var(--ds-status-ready-bg);    color: var(--ds-status-ready-txt);    }
.ds-status--pending  { background: var(--ds-status-pending-bg);  color: var(--ds-status-pending-txt);  }
.ds-status--failed   { background: var(--ds-status-pending-bg);  color: var(--ds-status-pending-txt);  }

/* Chips (shortcut panel) */
.ds-chip {
  background: var(--ds-gold-badge);
  color: var(--ds-gold);
  border: none;
  border-radius: var(--ds-radius-pill);
  padding: 6px 14px;
  font-family: var(--ds-font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
  display: inline-block;
}
.ds-chip:hover { background: var(--ds-gold); color: #fff; text-decoration: none; }


/* ════════════════════════════════════════════════════════════════
   7. COMPONENTES: LISTA "CONTINUAR"
   ════════════════════════════════════════════════════════════════ */
.ds-continue-list { list-style: none; padding: 0; margin: 0; }

.ds-continue-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ds-border);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: opacity .1s;
}
.ds-continue-item:last-child { border-bottom: none; }
.ds-continue-item:hover { opacity: .8; text-decoration: none; color: inherit; }

.ds-continue-item__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--ds-radius);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ds-continue-item__icon .material-icons,
.ds-continue-item__icon .material-icons-round { font-size: 20px; }

.ds-continue-item__icon--hipnotrans { background: var(--ds-hipnotrans-bg); color: var(--ds-hipnotrans); }
.ds-continue-item__icon--medmixer   { background: var(--ds-medmixer-bg);   color: var(--ds-medmixer);   }
.ds-continue-item__icon--aicare     { background: var(--ds-aicare-bg);     color: var(--ds-aicare);     }
.ds-continue-item__icon--psicotests { background: var(--ds-psicotests-bg); color: var(--ds-psicotests); }
.ds-continue-item__icon--default    { background: var(--ds-bg);            color: var(--ds-text-muted); }

.ds-continue-item__meta { flex: 1; min-width: 0; }
.ds-continue-item__title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-continue-item__info { font-size: 11px; color: var(--ds-text-muted); margin-top: 2px; }

.ds-continue-item__arrow {
  color: var(--ds-border-strong);
  font-size: 18px;
  flex-shrink: 0;
}


/* ════════════════════════════════════════════════════════════════
   8. COMPONENTES: BARRA DE PROGRESO
   ════════════════════════════════════════════════════════════════ */
.ds-progress {
  height: 6px;
  background: var(--ds-border);
  border-radius: 3px;
  overflow: hidden;
}
.ds-progress__fill {
  height: 100%;
  background: var(--ds-gold);
  border-radius: 3px;
  transition: width .4s ease;
}


/* ════════════════════════════════════════════════════════════════
   9. COMPONENTES: FEED DE ACTIVIDAD
   ════════════════════════════════════════════════════════════════ */
.ds-feed { list-style: none; padding: 0; margin: 0; }

.ds-feed__item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ds-border);
}
.ds-feed__item:last-child { border-bottom: none; }

.ds-feed__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.ds-feed__dot--hipnotrans { background: var(--ds-hipnotrans); }
.ds-feed__dot--medmixer   { background: var(--ds-medmixer);   }
.ds-feed__dot--aicare     { background: var(--ds-aicare);     }
.ds-feed__dot--gold       { background: var(--ds-gold);       }
.ds-feed__dot--muted      { background: var(--ds-text-muted); }
.ds-feed__dot--bkg-sound  { background: var(--ds-gold);       }
.ds-feed__dot--tool       { background: var(--ds-gold);       }
.ds-feed__dot--aud        { background: #6366f1;              }
.ds-feed__dot--acc        { background: var(--ds-text-muted); }

.ds-feed__text  { font-size: 12px; line-height: 1.5; }
.ds-feed__time  { font-size: 10px; color: var(--ds-text-muted); margin-top: 3px; display: flex; flex-direction: column; gap: 1px; line-height: 1.4; }
.ds-feed__time-rel { opacity: .72; }

/* Shortcut input */
.ds-shortcut-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ds-bg);
  border-radius: var(--ds-radius-pill);
  padding: 9px 16px;
  margin-bottom: 12px;
}
.ds-shortcut-input .material-icons,
.ds-shortcut-input .material-icons-round { color: var(--ds-text-muted); font-size: 18px; }
.ds-shortcut-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--ds-font);
  font-size: 13px;
  color: var(--ds-text);
}
.ds-shortcut-input input::placeholder { color: var(--ds-text-muted); }

.ds-chips-row { display: flex; flex-wrap: wrap; gap: 7px; }


/* ════════════════════════════════════════════════════════════════
   10. RESPONSIVE
   ════════════════════════════════════════════════════════════════ */

/* Tablet: sidebar en la parte inferior */
@media (max-width: 900px) {
  .evo-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--ds-topbar-h) 1fr auto;
    grid-template-areas:
      "topbar"
      "main"
      "sidebar";
  }

  .ds-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: var(--ds-bottombar-h, 64px);
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 8px;
    border-right: none;
    border-top: 1px solid var(--ds-border);
    z-index: 100;
  }

  .ds-nav-sep { display: none; }
  .ds-nav-sep--push { display: none; }

  /* Accordion groups: flatten to icon-only items in bottom bar */
  .ds-nav-group { flex-direction: row; align-items: center; flex: 1; }
  .ds-nav-group__header {
    flex-direction: column; height: 100%; padding: 4px 0;
    justify-content: center; border-radius: 0; font-size: 9px; gap: 2px;
  }
  .ds-nav-group__header .ds-nav-group__label { display: none; }
  .ds-nav-group__arrow { display: none; }
  .ds-nav-group__items { display: none !important; }
  .ds-nav-group--open > .ds-nav-group__items { display: none !important; }

  .ds-nav-item {
    width: auto;
    height: 100%;
    flex: 1;
    flex-direction: column !important;
    justify-content: center !important;
    border-radius: 0;
    padding: 4px 0;
    gap: 2px !important;
  }
  .ds-nav-item__label { font-size: 9px !important; }
  .ds-nav-item.is-active { background: transparent; }
  .ds-nav-item.is-active .material-icons,
  .ds-nav-item.is-active .material-icons-round { color: var(--ds-gold); }
  .ds-nav-item.is-active .ds-nav-item__label { color: var(--ds-gold); }

  .ds-main { padding: 20px 16px 80px; }

  .ds-topbar__search { display: none; }
  .ds-hero-card { flex-direction: column; align-items: flex-start; }
  .ds-hero-card__actions { width: 100%; }
  .ds-hero-card__actions .ds-btn { flex: 1; justify-content: center; }

  .ds-content-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .ds-topbar__brand-sub { display: none; }
  .ds-main { padding: 16px 12px 80px; }
}
