:root{
  /* Nueva paleta escuelaguia.cl */
  --ega-primary:#68A5DE;     /* Color Primario */
  --ega-support:#FF5EA8;     /* Color Secundario */
  --ega-motivation:#FFD931;  /* Color Energía */

  --ega-bg:#F7F9FC;          /* Fondo Principal */
  --ega-ink:#1F2937;         /* Texto */
  --ega-muted: rgba(31,41,55,.62);

  /* Superficies / bordes */
  --ega-panel:#ffffff;
  --ega-border: rgba(31,41,55,.10);

  /* Layout/estilo */
  --ega-radius-xl: 26px;
  --ega-radius-lg: 18px;
  --ega-radius-md: 14px;

  --ega-shadow-lg: 0 18px 60px rgba(31,41,55,.12);
  --ega-shadow-md: 0 10px 28px rgba(31,41,55,.10);
  --ega-shadow-sm: 0 8px 18px rgba(31,41,55,.08);

  --ega-sidebar-w: 300px;
  --ega-sidebar-w-collapsed: 92px;
  --ega-topbar-h: 58px;

  --ega-font: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans";
}

/* Base */
*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
  font-family: var(--ega-font);
  color: var(--ega-ink);
}

button, input, select, textarea{ font-family: inherit; }

body.ega-app{
  background:
    radial-gradient(900px 600px at 14% 5%, rgba(255,94,168,.18), transparent 60%),
    radial-gradient(900px 600px at 86% 0%, rgba(104,165,222,.22), transparent 60%),
    var(--ega-bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Shell */
.ega-shell{
  min-height: 100vh;
  padding: 26px;

  /* Contenedor max (centrado) */
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;

  display: grid;

  /* FIX overflow: permite que la col 1fr se encoja */
  grid-template-columns: var(--ega-sidebar-w) minmax(0, 1fr);
  gap: 22px;

  transition: grid-template-columns .18s ease;
}

/* Desktop collapse */
@media (min-width: 981px){
  body.ega-sidebar-collapsed .ega-shell{
    grid-template-columns: var(--ega-sidebar-w-collapsed) minmax(0, 1fr);
  }
}

/* Sidebar */
.ega-sidebar{
  position: sticky;
  top: 26px;
  height: calc(100vh - 52px);
  border-radius: 28px;
  padding: 16px 12px;
  background: linear-gradient(180deg, rgba(104,165,222,.96), rgba(104,165,222,.78));
  box-shadow: var(--ega-shadow-md);
  overflow: hidden;

  display: flex;
  flex-direction: column;
}

/* Brand tile (logo) */
.ega-brand{
  width: 84px;
  height: 84px;
  border-radius: 22px;
  display:flex;
  align-items:center;
  justify-content:center;
  margin: 6px auto 14px;

  background: rgba(255,255,255,.26);
  border: 1px solid rgba(255,255,255,.42);
  box-shadow: 0 14px 30px rgba(0,0,0,.12);
  overflow: hidden;

  padding: 0;
  transition: width .18s ease, height .18s ease, border-radius .18s ease;
}

.ega-brand__link{
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 0;
  margin: 0;
  text-decoration:none;
}

.ega-brand__logo{
  width: 100%;
  height: 100%;
  display:block;
  object-fit: contain;
  object-position: center;
}

.ega-brand__text{
  color: rgba(255,255,255,.95);
  font-weight: 800;
  font-size: 13px;
  text-align:center;
  padding: 10px;
}

/* Logo más chico cuando sidebar está colapsado (desktop) */
@media (min-width: 981px){
  body.ega-sidebar-collapsed .ega-brand{
    width: 54px;
    height: 54px;
    border-radius: 16px;
  }
}

/* Menús */
.ega-nav ul{
  list-style:none;
  padding: 6px;
  margin: 0;
  display:grid;
  gap: 8px;
}

.ega-nav a{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;

  color: rgba(255,255,255,.92);
  text-decoration:none;

  background: transparent;
  transition: background-color .12s ease, transform .12s ease, opacity .12s ease;

  font-weight: 500;
  opacity: .95;
}

.ega-nav a:hover{
  background: rgba(255,255,255,.18);
  transform: translateY(-1px);
  opacity: 1;
}

.ega-nav .current-menu-item > a,
.ega-nav .current_page_item > a{
  background: rgba(255,255,255,.24);
  box-shadow: 0 10px 24px rgba(0,0,0,.14);
  font-weight: 700;
  opacity: 1;
}

/* Menú secundario abajo */
.ega-nav--secondary{
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.22);
}

/* Íconos del menú */
.ega-mi__icon{
  font-size: 18px;
  line-height: 1;
  width: 22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.ega-mi__icon--dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.85);
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
}

/* Colapsado: ocultar texto, dejar ícono */
@media (min-width: 981px){
  body.ega-sidebar-collapsed .ega-mi__text{ display:none; }
  body.ega-sidebar-collapsed .ega-nav a{
    justify-content:center;
    gap: 0;
    padding: 12px 10px;
  }
}

/* Main card */
.ega-main{
  /* ya lo tenías, es clave en grids */
  min-width: 0;

  border-radius: 34px;
  background: rgba(255,255,255,.58);
  border: 1px solid rgba(255,255,255,.60);
  box-shadow: var(--ega-shadow-lg);
  overflow: visible; /* dropdown */
  backdrop-filter: blur(10px);
}

/* Topbar */
.ega-topbar{
  height: var(--ega-topbar-h);
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 18px 22px 10px;

  position: relative;
  z-index: 50;
}

.ega-topbar-spacer{ flex:1; }

.ega-burger{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--ega-border);
  background: rgba(255,255,255,.72);
  box-shadow: var(--ega-shadow-sm);
  cursor: pointer;
}

/* Search */
.ega-search{ width: min(520px, 52vw); }
.ega-search__input{
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(31,41,55,.12);
  background: rgba(255,255,255,.78);
  padding: 12px 14px;
  outline: none;
}

/* Content */
.ega-content{ padding: 10px 22px 22px; }

/* Cards helpers */
.ega-card{
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(31,41,55,.08);
  border-radius: var(--ega-radius-xl);
  box-shadow: var(--ega-shadow-sm);
  padding: 18px;
}

.ega-card--accent{
  border: 2px solid rgba(104,165,222,.55);
  box-shadow: 0 18px 44px rgba(104,165,222,.18);
}

/* User dropdown */
.ega-userwrap{ position: relative; z-index: 60; }

.ega-userbtn{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(31,41,55,.10);
  box-shadow: var(--ega-shadow-sm);
  cursor: pointer;
}

.ega-user__avatar{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  overflow: hidden;
  flex: 0 0 40px;
  box-shadow: 0 10px 20px rgba(31,41,55,.12);
}

.ega-user__img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}

.ega-user__meta{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  line-height: 1.1;
}

.ega-user__name{ font-weight: 800; font-size: 14px; }
.ega-user__sub{ font-size: 12px; color: var(--ega-muted); margin-top: 2px; }

/* Dropdown */
.ega-usermenu{
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 220px;
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(31,41,55,.10);
  box-shadow: 0 18px 60px rgba(31,41,55,.14);
  overflow: hidden;
  z-index: 9999;
}

.ega-usermenu__item{
  display:flex;
  padding: 12px 14px;
  text-decoration:none;
  color: var(--ega-ink);
}

.ega-usermenu__item:hover{
  background: rgba(104,165,222,.12);
}

.ega-usermenu__item--danger{ color: #8a1d14; }
.ega-usermenu__item--danger:hover{ background: rgba(255, 80, 60, .12); }

/* WooCommerce: evitar desborde de tablas en grid */
.woocommerce table.shop_table{
  width: 100%;
  max-width: 100%;
}
.woocommerce-cart .woocommerce{
  overflow-x: auto;
}

/* Mobile off-canvas */
@media (max-width: 980px){
  .ega-shell{
    max-width: none;
    padding: 14px;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .ega-sidebar{
    position: fixed;
    top: 14px;
    left: 14px;
    height: calc(100vh - 28px);
    width: min(var(--ega-sidebar-w), 88vw);
    transform: translateX(-110%);
    transition: transform .2s ease;
    z-index: 9999;
  }

  body.ega-sidebar-open .ega-sidebar{ transform: translateX(0); }

  .ega-main{ border-radius: 26px; }
  .ega-topbar{ padding: 10px 14px 8px; }
  .ega-content{ padding: 8px 14px 14px; }

  .ega-search{ width: 100%; }
}

/* TOOLTIP: solo desktop y solo cuando está colapsado */
@media (min-width: 981px){
  .ega-sidebar{ z-index: 200; }

  body.ega-sidebar-collapsed .ega-nav a[data-tip]{ position: relative; }

  body.ega-sidebar-collapsed .ega-nav a[data-tip]::after{
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(31,41,55,.12);
    box-shadow: 0 14px 40px rgba(31,41,55,.18);
    color: var(--ega-ink);
    font-weight: 600;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease, transform .12s ease;
    z-index: 999999;
  }

  body.ega-sidebar-collapsed .ega-nav a[data-tip]::before{
    content: "";
    position: absolute;
    left: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,.95);
    border-left: 1px solid rgba(31,41,55,.12);
    border-top: 1px solid rgba(31,41,55,.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    z-index: 999999;
  }

  body.ega-sidebar-collapsed .ega-nav a[data-tip]:hover::after,
  body.ega-sidebar-collapsed .ega-nav a[data-tip]:focus-visible::after{
    opacity: 1;
    transform: translateY(-50%) translateX(2px);
  }

  body.ega-sidebar-collapsed .ega-nav a[data-tip]:hover::before,
  body.ega-sidebar-collapsed .ega-nav a[data-tip]:focus-visible::before{
    opacity: 1;
  }
}

/* Muy grandes */
@media (min-width: 1440px){
  .ega-shell{ max-width: 1360px; }
}
.ega-authorbox{
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 18px; /* si quieres mantener 25px, cámbialo a 25px */
  border: 1px solid rgba(31,41,55,.10);
  background: rgba(255,255,255,.80);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ega-authorbox__title{
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  color: var(--ega-ink);
}

.author-avatar{
  border-radius: 999px;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}
