/* Panel desplegable de cursos: buscador, grupos, "Otro" y chips.
   Usa los tokens de color de cada página (--accent, --line, --ink…). */
.picker { display: grid; gap: 10px; min-width: 0; }
.dd { position: relative; min-width: 0; }
.dd-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; cursor: pointer;
  font: 600 16px var(--body, var(--font)); color: var(--ink); background: var(--bg-soft); border: 1.5px solid var(--line); border-radius: 11px; padding: 11px 13px; }
.dd-btn.vacio .dd-txt { color: var(--muted); font-weight: 400; }
.dd-btn:hover { border-color: var(--accent); }
.dd.abierto .dd-btn { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.dd-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-chev { flex: none; color: var(--accent); transition: transform .2s ease; }
.dd.abierto .dd-chev { transform: rotate(180deg); }

.dd-panel { position: absolute; z-index: 60; top: calc(100% + 8px); left: 0; right: 0; min-width: 280px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 24px 48px -16px rgba(8, 53, 101, .35); display: flex; flex-direction: column; overflow: hidden;
  animation: ddIn .16s ease-out; }
.dd-panel[hidden] { display: none; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px); } }
.dd-head { display: none; }
.dd-buscar { padding: 10px; border-bottom: 1px solid var(--line); }
.dd-buscar input { width: 100%; font: 15px var(--body, var(--font)); padding: 10px 12px 10px 36px; border-radius: 10px; border: 1.5px solid var(--line); background-color: var(--bg-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2353677b' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px center; color: var(--ink); }
.dd-buscar input:focus { outline: none; border-color: var(--accent); background-color: #fff; }
.dd-list { max-height: 300px; overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.dd-grupo[hidden] { display: none; }
.dd-grupo > span { display: block; font: 700 11px var(--body, var(--font)); letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); padding: 10px 10px 6px; }
.dd-opt { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border: 0; background: none; cursor: pointer;
  font: 500 15px var(--body, var(--font)); color: var(--ink); padding: 10px 12px; border-radius: 10px; }
.dd-opt[hidden] { display: none; }
.dd-opt:hover, .dd-opt:focus-visible { background: var(--bg-soft); outline: none; }
.dd-opt i { font-style: normal; font-weight: 800; color: var(--accent); opacity: 0; }
.dd-opt[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-2); font-weight: 700; }
.dd-opt[aria-selected="true"] i { opacity: 1; }
.dd-nuevo { color: var(--accent-2); font-weight: 700; border: 1.5px dashed var(--accent); margin: 6px 0; }
.dd-nuevo i { opacity: 1; font-size: 18px; }
.dd-vacio { margin: 0; padding: 14px; font-size: 14px; color: var(--muted); text-align: center; }
.dd-pie { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.dd-pie .small { font-size: 12px; }

.picker-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.picker-chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-2); font-size: 14px; font-weight: 600; }
.chip button { width: 24px; height: 24px; border-radius: 50%; border: 0; background: #fff; color: var(--accent-2); font-size: 16px; line-height: 1; cursor: pointer; }
.chip button:hover { background: var(--accent); color: #fff; }

/* Celular: el panel sube desde abajo, ordenado y con altura fija */
@media (max-width: 560px) {
  body.dd-bloqueo { overflow: hidden; }
  .dd.abierto::before { content: ""; position: fixed; inset: 0; z-index: 59; background: rgba(10, 33, 61, .45); }
  .dd-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; min-width: 0; max-height: 78vh; border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px); animation: ddSube .22s ease-out; }
  @keyframes ddSube { from { transform: translateY(40px); opacity: .4; } }
  .dd-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
  .dd-head::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
  .dd-head b { font-size: 17px; }
  .dd-cerrar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg-soft); font-size: 20px; color: var(--ink); cursor: pointer; }
  .dd-list { max-height: none; flex: 1; }
  .dd-opt { padding: 13px 12px; font-size: 16px; }
  .dd-pie .btn { padding: 12px 22px; }
}
@media (prefers-reduced-motion: reduce) { .dd-panel { animation: none; } .dd-chev { transition: none; } }

/* El ícono de búsqueda no debe perderse con estilos de formulario de cada página */
.dd .dd-buscar input, .dd .dd-buscar input:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2353677b' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: 11px center !important; background-size: 16px !important; padding-left: 36px !important; }
.dd-grupo + .dd-grupo { border-top: 1px solid var(--line); margin-top: 4px; }
