/* ============================================================
   ElInformanteRD - Panel de administracion
   ============================================================ */
:root {
    --navy: #0a2540;
    --navy-2: #14366e;
    --blue: #1f4e9c;
    --blue-soft: #eef3fb;
    --gold: #c1272d;
    --red: #c1272d;
    --green: #0a7d54;
    --ink: #1b2330;
    --muted: #6b7686;
    --line: #e4e8ef;
    --bg: #f4f6fa;
    --sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--ink); }
a { color: var(--blue); text-decoration: none; }
.svg-icon { vertical-align: middle; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
.login-card { background: #fff; width: 100%; max-width: 400px; border-radius: 16px; padding: 38px 34px;
    box-shadow: 0 30px 70px rgba(0,0,0,.3); }
.login-card .logo { text-align: center; margin-bottom: 20px; }
.login-card .logo img { height: 60px; }
.login-card h1 { text-align: center; font-size: 21px; margin: 6px 0 2px; color: var(--navy); }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.hint-users { background: var(--blue-soft); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--navy-2); margin-top: 18px; }
.hint-users code { background: #fff; padding: 1px 6px; border-radius: 4px; font-weight: 700; }

/* ---- Form controls ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--ink); }
.field .help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .field input[type=text], .field input[type=password], .field input[type=email],
.field input[type=url], .field input[type=date], .field select, .field textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px;
    font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,78,156,.12); }
.field textarea { resize: vertical; min-height: 80px; }
.with-icon { position: relative; }
.with-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; z-index: 2; }
/* Especificidad alta para que no la pise la regla generica .field input[type=...] */
.field .with-icon input[type] { padding-left: 44px; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
    background: var(--navy-2); color: #fff; padding: 11px 18px; border-radius: 9px; font-size: 15px;
    font-weight: 700; font-family: inherit; transition: .15s; }
.btn:hover { background: var(--blue); color: #fff; }
.btn.block { width: 100%; justify-content: center; }
.btn.gold { background: var(--red); color: #fff; }
.btn.gold:hover { background: #9e1f24; color: #fff; }
.btn.red { background: var(--red); }
.btn.ghost { background: #fff; color: var(--navy-2); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.sm { padding: 7px 12px; font-size: 13px; }

/* ---- Shell ---- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar-admin { background: var(--navy); color: #c7d2e4; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-admin .brand { display: flex; align-items: center; gap: 10px; padding: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-admin .brand img { height: 46px; width: auto; background: #fff; padding: 5px; border-radius: 8px; }
.sidebar-admin .brand span { font-weight: 800; color: #fff; font-size: 17px; }
.sidebar-admin .brand span b { color: var(--red); font-weight: 800; }
.nav-admin { padding: 14px 0; }
.nav-admin a { display: flex; align-items: center; gap: 12px; padding: 12px 22px; color: #c7d2e4; font-weight: 600; font-size: 14.5px; border-left: 3px solid transparent; }
.nav-admin a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-admin a.active { background: rgba(31,78,156,.35); color: #fff; border-left-color: var(--gold); }
.nav-admin .group { padding: 16px 22px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #7b8aa6; }

/* El backdrop solo existe para el menu movil: fuera del flujo del grid en escritorio */
.admin-backdrop { display: none; }
.content-admin { display: flex; flex-direction: column; min-width: 0; }
.topbar-admin { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 26px;
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; }
.topbar-admin h1 { font-size: 19px; margin: 0; color: var(--navy); }
.topbar-admin .user-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy-2); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
    overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--navy); cursor: pointer; }

.page { padding: 26px; max-width: 1180px; width: 100%; }

/* ---- Cards / stats ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat { background: #fff; border-radius: 14px; padding: 18px 20px; box-shadow: 0 4px 16px rgba(10,37,64,.05); display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--blue-soft); color: var(--navy-2); flex-shrink: 0; }
.stat .num { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 13px; }

.card-admin { background: #fff; border-radius: 14px; box-shadow: 0 4px 16px rgba(10,37,64,.05); margin-bottom: 22px; }
.card-admin .head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card-admin .head h2 { font-size: 16px; margin: 0; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.card-admin .body { padding: 20px; }
.card-admin .body.flush { padding: 0; }

/* ---- Tablas ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14.5px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfd; }
.table .thumb-sm { width: 54px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--blue-soft); }
.table .title-cell { font-weight: 700; color: var(--ink); }
.table .title-cell a { color: var(--ink); }
.table .title-cell a:hover { color: var(--blue); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.pub { background: #e3f5ec; color: var(--green); }
.badge.draft { background: #fdeaea; color: var(--red); }
.badge.gray { background: #eef1f6; color: var(--muted); }
.badge.gold { background: var(--blue-soft); color: var(--navy-2); }
.chip-cat { display: inline-block; padding: 2px 9px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 700; }

.actions-cell { display: flex; gap: 6px; }
.icon-action { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--navy-2);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-action:hover { background: var(--blue-soft); }
.icon-action.danger:hover { background: #fdeaea; color: var(--red); border-color: #f3c2c2; }

/* ---- Editor de post ---- */
.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.side-panel { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 86px; }
.title-input { font-size: 24px; font-weight: 800; font-family: 'Playfair Display', Georgia, serif; }

.tag-input-wrap { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.tag-input-wrap input { border: none; outline: none; flex: 1; min-width: 120px; font-size: 14px; padding: 4px; }
.tag-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-soft); color: var(--navy-2); padding: 4px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.tag-pill button { background: none; border: none; color: var(--navy-2); cursor: pointer; display: inline-flex; padding: 0; }

.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: #fff; }
.dropzone:hover { border-color: var(--blue); color: var(--blue); }
.cover-preview { margin-top: 12px; border-radius: 10px; overflow: hidden; position: relative; display: none; }
.cover-preview.show { display: block; }
.cover-preview img { width: 100%; }
.cover-preview .remove { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.switch { position: relative; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cfd6e2; border-radius: 26px; transition: .2s; cursor: pointer; }
.slider:before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ---- Alerts / flash ---- */
.flash { padding: 13px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.flash.success { background: #e3f5ec; color: var(--green); }
.flash.error { background: #fdeaea; color: var(--red); }
.flash.info { background: var(--blue-soft); color: var(--navy-2); }

/* ---- Ad slots reference grid ---- */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.slot-box { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; display: flex; flex-direction: column; }
.slot-box .preview { height: 92px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
    background: repeating-linear-gradient(45deg, #f1f4fa, #f1f4fa 8px, #e9eef7 8px, #e9eef7 16px); border-radius: 8px; }
.slot-box .slot-shape { display: flex; align-items: center; justify-content: center; background: var(--blue-soft);
    border: 1px solid #d4ddee; border-radius: 5px; color: var(--navy-2); font-size: 11px; font-weight: 700; min-width: 40px; }
.slot-box .name { font-weight: 700; color: var(--navy); }
.slot-box .size { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Vista previa de anuncio */
.ad-preview-box { position: relative; }
.ad-preview-label { display: block; text-align: right; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 5px; }
.ad-preview {
    width: 100%; margin: 0 auto; border-radius: 10px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: repeating-linear-gradient(45deg, #f1f4fa, #f1f4fa 8px, #e9eef7 8px, #e9eef7 16px);
    border: 1px dashed #cdd6e6; min-height: 60px;
}
.ad-preview > * { width: 100%; height: 100%; }
.ad-preview img { width: 100%; height: 100%; object-fit: cover; }
.ad-preview-empty { width: auto; height: auto; color: var(--muted); font-size: 13px; font-weight: 600; padding: 12px; text-align: center; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.empty-admin { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-admin svg { color: var(--line); margin-bottom: 10px; }

@media (max-width: 980px) {
    .editor-grid { grid-template-columns: 1fr; }
    .side-panel { position: static; }
    .stats { grid-template-columns: 1fr 1fr; }
    .row2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar-admin { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: .25s; z-index: 100; }
    .sidebar-admin.open { transform: translateX(0); box-shadow: 0 0 50px rgba(0,0,0,.5); }
    .mobile-menu-btn { display: inline-flex; }
    .admin-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; }
    .admin-backdrop.open { display: block; }
    .stats { grid-template-columns: 1fr 1fr; }
    .table-responsive { overflow-x: auto; }
}
