/* GASCA · Administración › Administrador de menús (gasca_menu_admin.js). Prefijo ma- (editor) y gma- (menú lateral). */

/* Menú lateral: icono opcional de una sección */
.menu-label > i.gma-ic { margin-right: 8px; font-size: .78rem; opacity: .85; }

/* ------------------------------------------------------------------ editor */
#menu-admin-view { --ma-azul: #003a68; --ma-acento: #7c3aed; --ma-linea: #e2e8f0; --ma-suave: #f6f8fb; --ma-gris: #64748b; }
#menu-admin-view * { box-sizing: border-box; }
#menu-admin-view i, .ma-ipick i, .ma-dests i { flex-shrink: 0; }
.ma-root [hidden], .ma-ipick [hidden] { display: none !important; }
.ma-head .ra-tit p { max-width: 640px; }
.ma-estado { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 700; color: #15803d; background: #f0fdf4;
  border: 1px solid #bbf7d0; border-radius: 999px; padding: 6px 11px; }
.ma-estado i { font-size: .62rem; }
.ma-estado.ma-sucio { color: #9a3412; background: #fff7ed; border-color: #fed7aa; animation: maLatido 2s ease-in-out infinite; }
@keyframes maLatido { 50% { box-shadow: 0 0 0 4px rgba(251,146,60,.18); } }

.ma-barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ma-buscar { position: relative; flex: 0 1 340px; min-width: 220px; }
.ma-buscar i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .82rem; }
.ma-buscar input { width: 100%; padding-left: 32px; }
.ma-ayuda { font-size: .76rem; color: var(--ma-gris); flex: 1 1 320px; }
.ma-ayuda i { color: #94a3b8; margin-right: 3px; }

.ma-main { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
/* columnas tipo «masonry»: se leen de arriba abajo y luego la siguiente columna, como el menú */
.ma-tablero { columns: 290px; column-gap: 14px; }
.ma-tablero > .ma-sec { break-inside: avoid; margin-bottom: 14px; }

/* tarjeta de sección */
.ma-sec { background: #fff; border: 1px solid var(--ma-linea); border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 26px -18px rgba(15,23,42,.3);
  display: flex; flex-direction: column; min-width: 0; transition: box-shadow .15s, border-color .15s, opacity .15s; position: relative; }
.ma-sec::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, #0B3C73, #1d6fb8); }
.ma-sec.ma-nueva { border-style: dashed; border-color: #c4b5fd; }
.ma-sec.ma-nueva::before { background: linear-gradient(180deg, var(--ma-acento), #a78bfa); }
.ma-sec.ma-oculta { background: repeating-linear-gradient(135deg, #fff, #fff 10px, #f8fafc 10px, #f8fafc 20px); }
.ma-sec.ma-oculta .ma-sec-h, .ma-sec.ma-oculta .ma-items { opacity: .62; }
.ma-sec-h { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px 14px; }
.ma-sec-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 8px 16px; border-bottom: 1px solid #eef2f6; flex-wrap: wrap; }
.ma-sec-k { font-size: .7rem; color: var(--ma-gris); display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.ma-sec-k code, .ma-meta code { font-size: .68rem; background: #f1f5f9; color: #475569; border-radius: 5px; padding: 1px 6px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.ma-cnt { flex: none; font-size: .72rem; font-weight: 800; color: #0a3160; background: rgba(11,60,115,.09); border-radius: 999px; padding: 2px 9px; }
.ma-nom { flex: 1 1 auto; min-width: 0; width: 100%; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 5px 7px;
  font: inherit; font-size: .9rem; font-weight: 600; color: #0f172a; text-overflow: ellipsis; transition: border-color .12s, background .12s; }
.ma-nom:hover { border-color: var(--ma-linea); background: #fff; }
.ma-nom:focus { outline: 0; border-color: #2a78d6; background: #fff; box-shadow: 0 0 0 3px rgba(42,120,214,.14); }
.ma-nom::placeholder { color: #94a3b8; font-weight: 500; font-style: italic; }
.ma-nom-sec { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: #0a3160; }

.ma-handle { flex: none; width: 24px; height: 30px; display: grid; place-items: center; color: #94a3b8; cursor: grab; border-radius: 7px; touch-action: none; }
.ma-handle:hover { color: #0f172a; background: #f1f5f9; }
.ma-handle:active { cursor: grabbing; }
.ma-ic-btn { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--ma-linea); background: var(--ma-suave); color: #0B3C73; cursor: pointer;
  display: grid; place-items: center; font-size: .92rem; transition: all .12s; }
.ma-ic-btn:hover { border-color: #2a78d6; color: #2a78d6; background: #fff; transform: scale(1.06); }
.ma-ic-sec { width: 30px; height: 30px; font-size: .82rem; }
.ma-ic-btn.ma-sin { color: #cbd5e1; border-style: dashed; background: #fff; }

.ma-acc { display: inline-flex; gap: 2px; align-items: center; flex: none; }
.ma-b { width: 28px; height: 28px; border: 0; background: transparent; color: #64748b; border-radius: 7px; cursor: pointer; font-size: .78rem; display: grid; place-items: center; }
.ma-b:hover:not(:disabled) { background: #eef2f7; color: #0f172a; }
.ma-b:disabled { opacity: .3; cursor: default; }
.ma-b-rojo:hover:not(:disabled) { background: #fef2f2; color: #b4000c; }
.ma-it:not(.ma-mod) .ma-b-des, .ma-sec:not(.ma-mod) .ma-b-des { display: none; }

/* opción */
.ma-items { list-style: none; margin: 0; padding: 8px 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; min-height: 46px; }
.ma-it { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 2px; border-radius: 12px; border: 1px solid transparent; background: #fff; transition: background .12s, border-color .12s, opacity .12s; }
.ma-it:hover { background: #f8fafc; border-color: #eef2f6; }
.ma-it-c { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ma-it-pie { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ma-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; padding-left: 7px; font-size: .68rem; color: var(--ma-gris); }
#menu-admin-view .ma-meta code, #menu-admin-view .ma-sec-k code { white-space: nowrap !important; word-break: normal; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ma-it .ma-b { width: 25px; height: 25px; font-size: .72rem; }
.ma-perm { display: inline-flex; align-items: center; gap: 4px; color: #64748b; max-width: 100%; min-width: 0; cursor: help; }
.ma-perm i { font-size: .6rem; opacity: .7; flex: none; }
.ma-perm span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-tag { display: inline-flex; align-items: center; gap: 4px; font-size: .64rem; font-weight: 700; border-radius: 999px; padding: 1px 7px; background: #f1f5f9; color: #475569; white-space: nowrap; }
.ma-tag i { font-size: .58rem; }
.ma-tag-oc { background: #fff7ed; color: #9a3412; }
.ma-tag-prot { background: #eef2ff; color: #4338ca; }
.ma-tag-mod { background: #f5f3ff; color: #6d28d9; }
.ma-tag-act { background: #dcfce7; color: #166534; font-size: .72rem; padding: 3px 10px; }
.ma-it:not(.ma-mod) .ma-tag-mod { display: none; }
.ma-it.ma-oculto { background: repeating-linear-gradient(135deg, #fff, #fff 8px, #fafafa 8px, #fafafa 16px); }
.ma-it.ma-oculto .ma-nom, .ma-it.ma-oculto .ma-ic-btn { opacity: .5; text-decoration: line-through; }
.ma-it.ma-gris .ma-ic-btn { filter: grayscale(1); opacity: .6; }
.ma-it .ma-acc { opacity: .5; transition: opacity .12s; }
.ma-it:hover .ma-acc, .ma-it:focus-within .ma-acc { opacity: 1; }
@media (hover: none) { .ma-it .ma-acc { opacity: 1; } }
.ma-vacia { margin: -40px 12px 12px; padding: 12px; border: 2px dashed #e2e8f0; border-radius: 12px; text-align: center; color: #94a3b8; font-size: .78rem; pointer-events: none; }
.ma-pv .ma-vacia { margin: 8px 0; }

.ma-atenuado { opacity: .28; }
.ma-sec.ma-atenuado { opacity: .45; }
.ma-it.ma-hallado { background: #fefce8; border-color: #fde68a; }
.ma-flash { animation: maFlash 1.2s ease; }
@keyframes maFlash { 0%, 40% { box-shadow: 0 0 0 3px rgba(124,58,237,.45); background: #f5f3ff; } 100% { box-shadow: none; } }

/* arrastrar (SortableJS) */
.ma-fantasma { opacity: .9; background: #eef2ff !important; border: 2px dashed #818cf8 !important; }
.ma-fantasma > * { visibility: hidden; }
.ma-elegido { box-shadow: 0 14px 30px -12px rgba(15,23,42,.35); }
.ma-arrastrando { transform: rotate(1deg); }
.ma-arrastrando-on .ma-items { background: linear-gradient(#fff, #fff) padding-box; outline: 2px dashed #e0e7ff; outline-offset: -4px; border-radius: 12px; }
.ma-arrastrando-on .ma-it .ma-acc { opacity: 0; }

/* vista previa */
.ma-pv { position: sticky; top: 76px; background: #fff; border: 1px solid var(--ma-linea); border-radius: 16px; box-shadow: 0 10px 26px -18px rgba(15,23,42,.3);
  max-height: calc(100vh - 100px); display: flex; flex-direction: column; overflow: hidden; }
.ma-pv-h { padding: 12px 14px; font-size: .8rem; font-weight: 800; color: #0f172a; border-bottom: 1px solid #eef2f6; display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap; }
.ma-pv-h small { font-weight: 500; color: var(--ma-gris); font-size: .7rem; }
.ma-pv-nav { padding: 10px; overflow: auto; }
.ma-pv-sec { margin-bottom: 8px; }
.ma-pv-lab { display: flex; align-items: center; gap: 7px; padding: 7px 10px; font-size: .68rem; font-weight: 800; color: #0a3160; text-transform: uppercase;
  letter-spacing: .3px; background: rgba(11,60,115,.10); border-radius: 9px; margin-bottom: 3px; }
.ma-pv-lab::before { content: ''; width: 3px; height: 12px; border-radius: 3px; background: linear-gradient(180deg, #0B3C73, #1d6fb8); }
.ma-pv-it { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; text-align: left; padding: 6px 10px 6px 16px; border-radius: 8px;
  font: inherit; font-size: .8rem; color: #475569; cursor: pointer; }
.ma-pv-it:hover { background: #f1f5f9; color: #0f172a; }
.ma-pv-it i { width: 16px; text-align: center; font-size: .8rem; }
.ma-pv-it.ma-gris { opacity: .42; filter: grayscale(1); }

/* selector de iconos */
.ma-ipick { display: flex; flex-direction: column; gap: 10px; }
.ma-ipick-bus { position: relative; position: sticky; top: 0; background: #fff; padding-bottom: 4px; z-index: 1; }
.ma-ipick-bus i { position: absolute; left: 11px; top: 18px; transform: translateY(-50%); color: #94a3b8; font-size: .82rem; }
.ma-ipick-bus input { width: 100%; padding-left: 32px; }
.ma-ipick-tit { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ra-muted, #64748b); }
.ma-ipick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; }
.ma-icono { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 7px; border: 1px solid var(--ma-linea, #e2e8f0); border-radius: 11px;
  background: #fff; cursor: pointer; color: #0B3C73; transition: all .12s; min-width: 0; }
.ma-icono i { font-size: 1.15rem; }
.ma-icono span { font-size: .6rem; color: #64748b; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-icono:hover { border-color: #2a78d6; background: #eff6ff; transform: translateY(-1px); }
.ma-icono.ma-on { border-color: #7c3aed; background: #f5f3ff; box-shadow: 0 0 0 2px rgba(124,58,237,.25); }
.ma-ipick-nada { color: #64748b; font-size: .82rem; text-align: center; padding: 18px; }

/* mover a otra sección */
.ma-dests { display: grid; gap: 6px; }
.ma-dest { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 11px; background: #fff; cursor: pointer; text-align: left; font: inherit; }
.ma-dest:hover:not(:disabled) { border-color: #2a78d6; background: #eff6ff; }
.ma-dest:disabled { opacity: .45; cursor: not-allowed; }
.ma-dest i { color: #0B3C73; width: 18px; text-align: center; }
.ma-dest span { font-weight: 700; font-size: .86rem; flex: 1; }
.ma-dest small { color: #64748b; font-size: .72rem; }

/* historial */
.ma-hv { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 12px; }
.ma-hv + .ma-hv { margin-top: 6px; }
.ma-hv-act { border-color: #bbf7d0; background: #f0fdf4; }
.ma-hv-ic { width: 34px; height: 34px; border-radius: 10px; background: #f1f5f9; color: #0B3C73; display: grid; place-items: center; flex: none; }
.ma-hv-c { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ma-hv-c b { font-size: .84rem; }
.ma-hv-c span { font-size: .74rem; color: #64748b; }
.ma-hv-b { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 1180px) {
  .ma-main { grid-template-columns: 1fr; }
  .ma-pv { position: static; max-height: 420px; }
}
@media (max-width: 560px) {
  .ma-tablero { columns: 1; }
  .ma-it-pie { flex-wrap: wrap; }
  .ma-it .ma-acc { margin-left: auto; }
  .ma-hv { flex-wrap: wrap; }
}
