/* ==========================================================================
   Club de Pescadores · Panel de administración
   ========================================================================== */

.admin-body { background: #eef3f4; }

/* ---------- Barra superior ---------- */
.admin-topbar { background: var(--brand-darker); color: #fff; position: sticky; top: 0; z-index: 40; box-shadow: var(--shadow); margin-left: 250px; transition: margin-left .26s ease; }
.admin-topbar__inner { max-width: 1340px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 16px; }
.admin-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; white-space: nowrap; }
.admin-brand:hover { color: #fff; }
.admin-brand__mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.admin-brand__logo { width: 34px; height: 34px; object-fit: contain; flex: none; }
.admin-nav { display: flex; gap: 4px; margin-left: 8px; }
.admin-nav a { color: #cfe3e6; padding: 8px 10px; border-radius: 999px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.admin-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.admin-nav a.is-active { background: var(--brand); color: #fff; }
.admin-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .88rem; white-space: nowrap; }
.admin-user__view { color: #9fd6db; white-space: nowrap; }
.admin-user__view:hover { color: #fff; }
.admin-user__name { color: #cfe3e6; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.admin-user__logout { background: rgba(255,255,255,.12); color: #fff; padding: 7px 14px; border-radius: 999px; font-weight: 600; }
.admin-user__logout:hover { background: var(--accent); color: #fff; }

/* ---------- Botón hamburguesa ---------- */
.admin-burger {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 0 9px; border: 0; border-radius: 9px;
  background: rgba(255,255,255,.1); cursor: pointer; flex: none;
}
.admin-burger:hover { background: rgba(255,255,255,.2); }
.admin-burger span { display: block; height: 3px; background: #fff; border-radius: 3px; transition: .2s; }

/* ---------- Menú lateral (drawer) ---------- */
.admin-drawer {
  position: fixed; top: 0; left: 0; width: 250px; height: 100vh;
  background: #082f35; color: #cfe3e6; z-index: 70; display: flex; flex-direction: column;
  overflow-y: auto; transform: none; transition: transform .26s ease;
}
.admin-drawer.is-open { transform: none; }
body.sidebar-collapsed .admin-drawer { transform: translateX(-102%); }
body.sidebar-collapsed .admin-topbar,
body.sidebar-collapsed .admin-main { margin-left: 0; }
.admin-drawer__head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.admin-drawer__title { color: #fff; font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; }
.admin-drawer__head img { border-radius: 8px; }
.admin-drawer__head span { display: flex; flex-direction: column; line-height: 1.2; }
.admin-drawer__head strong { color: #fff; font-size: .98rem; }
.admin-drawer__head small { color: #8fb2b7; font-size: .76rem; }
.admin-drawer__nav { display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; overflow-y: auto; flex: 1; }
.admin-drawer__nav a { color: #cfe3e6; padding: 12px 15px; border-radius: 9px; font-weight: 600; font-size: .95rem; }
.admin-drawer__nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-drawer__nav a.is-active { background: var(--brand); color: #fff; }
.admin-drawer__foot { display: flex; flex-direction: column; gap: 8px; padding: 15px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: .88rem; }
.admin-drawer__foot a { color: #9fd6db; }
.admin-drawer__foot a:hover { color: #fff; }
.admin-overlay {
  position: fixed; inset: 0; background: rgba(4,25,28,.55); z-index: 65;
  opacity: 0; visibility: hidden; transition: .22s;
}
.admin-overlay.is-open { opacity: 1; visibility: visible; }

/* ---------- Layout ---------- */
.admin-main { margin-left: 250px; padding: 30px 0 60px; transition: margin-left .26s ease; }
.admin-container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.admin-page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-page-head h1 { font-size: 1.7rem; margin: 0 0 4px; }
.admin-page-head p { margin: 0; }

/* ---------- Estadísticas ---------- */
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.stat__num { font-size: 1.9rem; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.stat__label { color: var(--muted); font-size: .85rem; margin-top: 6px; }

/* ---------- Toolbar ---------- */
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.admin-tabs a { padding: 7px 16px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.admin-tabs a.is-active { background: var(--brand); color: #fff; }
.admin-search { display: flex; gap: 8px; }
.admin-search input { padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px; font-family: inherit; font-size: .9rem; outline: 0; min-width: 220px; }
.admin-search input:focus { border-color: var(--brand); }

/* ---------- Tablas ---------- */
.admin-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow-sm); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.admin-table th, .admin-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
.admin-table thead th { background: var(--surface-alt); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: #f7fbfb; }
.ta-r { text-align: right; }
.cell-title__main { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-weight: 600; }
.cell-title a { color: var(--ink); }
.cell-title a:hover { color: var(--brand-dark); }
.cell-title small { display: block; margin-top: 2px; }
.row-actions { display: inline-flex; gap: 8px; align-items: center; justify-content: flex-end; }
.row-actions form { display: inline; }

.tag { font-size: .66rem; text-transform: uppercase; font-weight: 800; letter-spacing: .03em; padding: 3px 8px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); }
.tag--primary { background: #e8f1fb; color: #1b4d7e; }
.tag--star { background: #fdf3dd; color: #93670a; }

.estado { font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.estado--publicado { background: #e6f6ec; color: #125c2b; }
.estado--borrador { background: #f0f0f2; color: #5c6470; }

/* ---------- Paneles / columnas ---------- */
.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: 24px; }
.panel__title { font-size: 1.05rem; margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.admin-form__grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.admin-form__side .panel + .panel { margin-top: 20px; }
.admin-form__main > .panel { margin-top: 0; }

.check-row { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; }
.check-row input { margin-top: 4px; width: 17px; height: 17px; }
.check-row label { font-size: .9rem; font-weight: 500; }

.img-preview { margin-bottom: 14px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.img-preview img { width: 100%; display: block; }
.img-preview--logo { background: #f7fbfb; border-style: dashed; padding: 10px; text-align: center; }
.img-preview--logo img { width: 96px; height: 96px; object-fit: contain; margin: 0 auto; }

/* ---------- Aviso de formato de imagen ---------- */
.info-tip {
  background: #eef6f7; border: 1px solid #cfe6e9; border-left: 4px solid var(--brand);
  border-radius: 9px; padding: 13px 16px; margin-top: 14px; font-size: .85rem; color: #234;
}
.info-tip strong { display: block; margin-bottom: 7px; color: var(--brand-dark); font-size: .88rem; }
.info-tip ul { list-style: disc; padding-left: 18px; margin: 0 0 8px; }
.info-tip li { margin-bottom: 4px; }
.info-tip small { display: block; color: var(--muted); }

/* ---------- Editor de notas: barra de imágenes y arrastrar/soltar ---------- */
.editor-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.editor-hint { font-size: .8rem; color: var(--muted); }
.editor-progress { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.editor-progress__bar { flex: 1; height: 10px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.editor-progress__bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.editor-progress__txt { font-size: .82rem; color: var(--brand-dark); font-weight: 600; white-space: nowrap; }

/* ---------- Apariencia: vista previa ---------- */
.apa-color { display: flex; align-items: center; gap: 12px; }
.apa-color label { flex: 1; margin: 0; }
.apa-color input[type=color] { width: 54px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }
.apa-color .apa-hex { width: 96px; text-transform: uppercase; font-family: Consolas, monospace; }
.apa-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: #fff; }
.apa-preview .apa-h { margin-top: 0; }
.apa-preview .apa-card { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.apa-preview .apa-bar { margin-top: 10px; padding: 8px 12px; border-radius: 8px; text-align: center; font-weight: 700; }
.editor-wrap { position: relative; }
.editor-wrap.is-drag textarea { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,124,134,.15); }
.editor-drop {
  display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
  background: rgba(14,124,134,.08); border: 2px dashed var(--brand); border-radius: var(--radius-sm);
  font-weight: 700; color: var(--brand-dark); pointer-events: none; text-align: center; padding: 10px;
}
.editor-wrap.is-drag .editor-drop { display: flex; }
.editor-wrap.is-busy::after {
  content: 'Subiendo imagen…'; position: absolute; top: 10px; right: 12px;
  background: var(--brand); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: .74rem;
}
#formNota.form-dragging { outline: 2px dashed var(--brand); outline-offset: 4px; border-radius: var(--radius); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 18px 14px;
  cursor: pointer; background: var(--surface-alt); transition: .15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand); background: #eef6f7; }
.dropzone__input { display: none; }
.dropzone__icon { font-size: 1.1rem; color: var(--brand); }
.dropzone__text { font-size: .84rem; color: var(--ink); }
.dropzone__file { font-size: .78rem; color: var(--brand-dark); font-weight: 600; word-break: break-all; }

/* ---------- Editor por bloques (párrafos e imágenes) ---------- */
.editor-blocks { display: flex; flex-direction: column; gap: 12px; }
.editor-blocks.is-drag { outline: 2px dashed var(--brand); outline-offset: 3px; border-radius: var(--radius); }
.editor-blocks.is-busy { opacity: .6; }
.blk { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 12px; background: var(--surface); }
.blk-p .blk-text { width: 100%; min-height: 90px; border: 0; outline: 0; resize: vertical; font-family: inherit; font-size: .95rem; color: var(--ink); background: transparent; padding-right: 96px; }
.blk-img { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.blk-img img { max-width: 100%; max-height: 340px; width: auto; border-radius: 6px; display: block; }
.blk-img-cap { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-family: inherit; font-size: .9rem; }
.blk-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.blk-tools button { width: 28px; height: 28px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; font-size: .8rem; line-height: 1; color: var(--ink); }
.blk-tools button:hover { background: var(--surface-alt); }
.editor-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Insertador entre bloques (estilo WordPress) */
.blk-inserter { position: relative; height: 20px; display: flex; align-items: center; justify-content: center; }
.blk-inserter::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed transparent; transition: border-color .12s; }
.blk-inserter:hover::before { border-top-color: var(--brand); }
.blk-plus { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--brand-dark); font-size: 17px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: .55; transition: .12s; }
.blk-inserter:hover .blk-plus { opacity: 1; border-color: var(--brand); }
.blk-plus:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.blk-menu { position: absolute; z-index: 8; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 5px; background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); padding: 5px; display: none; flex-direction: column; gap: 2px; min-width: 130px; }
.blk-menu.open { display: flex; }
.blk-menu button { border: 0; background: transparent; padding: 8px 12px; text-align: left; border-radius: 6px; cursor: pointer; font-size: .88rem; color: var(--ink); font-weight: 600; }
.blk-menu button:hover { background: var(--surface-alt); }

/* Bloque de video */
.blk-video-row { display: flex; gap: 8px; }
.blk-video-src { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; font-family: inherit; font-size: .9rem; }
.blk-video-preview { margin-top: 10px; }
.blk-video-preview iframe, .blk-video-preview video { width: 100%; max-width: 640px; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 8px; display: block; background: #000; }
.blk-video.is-busy { opacity: .6; }

/* ---------- Lista de categorías ---------- */
.cat-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cat-list li:last-child { border-bottom: 0; }
.cat-list__info { display: flex; align-items: center; gap: 11px; }
.cat-list__info small { display: block; font-size: .78rem; }
.cat-list__actions { display: flex; gap: 8px; }
.cat-list__actions form { display: inline; }

/* ---------- Login ---------- */
.login-body { background: radial-gradient(circle at 30% 20%, #0e7c86, #063a40 70%); min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { background: var(--surface); width: 100%; max-width: 400px; border-radius: 18px; padding: 36px 32px; box-shadow: var(--shadow-lg); }
.login-card__head { text-align: center; margin-bottom: 22px; }
.login-card__mark { width: 56px; height: 56px; border-radius: 15px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; margin: 0 auto 14px; }
.login-card__logo { width: 64px; height: 64px; object-fit: contain; margin: 0 auto 14px; }
.login-card__head h1 { font-size: 1.4rem; margin-bottom: 4px; }
.login-card__head p { font-size: .9rem; margin: 0; }
.login-card__foot { text-align: center; margin: 18px 0 0; font-size: .88rem; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-cols { grid-template-columns: 1fr; }
  .admin-form__grid { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
  .admin-nav { display: none; }
  .admin-burger { display: inline-flex; }
}
@media (max-width: 1024px) {
  .admin-topbar, .admin-main { margin-left: 0; }
  .admin-drawer { transform: translateX(-102%); width: 262px; max-width: 86vw; box-shadow: 8px 0 30px rgba(0,0,0,.35); }
  .admin-drawer.is-open { transform: none; }
}
@media (max-width: 820px) {
  .admin-topbar__inner { padding: 10px 16px; gap: 14px; }
  .admin-user__name { display: none; }
}
@media (max-width: 640px) {
  .admin-container { padding: 0 14px; }
  .admin-main { padding: 20px 0 50px; }
  .admin-page-head h1 { font-size: 1.4rem; }
  .admin-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat__num { font-size: 1.5rem; }
  .panel { padding: 16px; }
  .admin-table th, .admin-table td { padding: 11px 12px; }
  .admin-brand span { font-size: .9rem; }
  .admin-user__view { display: none; }
  .admin-toolbar { gap: 10px; }
  .admin-tabs { width: 100%; justify-content: space-between; }
  .admin-search { width: 100%; }
  .admin-search input { flex: 1; min-width: 0; }
  .row-actions { flex-wrap: wrap; }
}
