/* ═══════════════════════════════════════════════════
   Admin CSS — Poder Judicial SLP
═══════════════════════════════════════════════════ */

/* ── Login page (sin sidebar) ─────────────────── */
body.login-page {
    background: var(--azul);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Layout admin ─────────────────────────────── */
.admin-body { background: #f1f5f9; margin: 0; display: block; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-content-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── Sidebar ──────────────────────────────────── */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--azul);
    color: #fff;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    z-index: 300;
    transition: transform .25s ease;
}
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
    font-size: 1.5rem;
    flex-shrink: 0;
}
.sidebar__org  { font-weight: 700; font-size: .88rem; line-height: 1.2; }
.sidebar__state { font-size: .72rem; opacity: .7; }
.sidebar__close {
    display: none;
    margin-left: auto;
    background: transparent;
    border: none;
    color: rgba(255,255,255,.7);
    font-size: 1.1rem;
    cursor: pointer;
    padding: .25rem .4rem;
    border-radius: 4px;
    line-height: 1;
}
.sidebar__close:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Secciones del nav */
.sidebar__nav { flex: 1; padding: .75rem 0; }
.sidebar__section-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.4);
    padding: .85rem 1.5rem .3rem;
}
.sidebar__link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem 1.5rem;
    font-size: .87rem;
    font-weight: 500;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    transition: background var(--trans), color var(--trans);
    border-left: 3px solid transparent;
}
.sidebar__link:hover  { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.sidebar__link.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--dorado); }

.sidebar__divider { border-top: 1px solid rgba(255,255,255,.12); margin: .5rem 1.5rem; }

.sidebar__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.12);
    flex-shrink: 0;
}
.sidebar__user-info { display: flex; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.sidebar__user-icon { font-size: 1rem; }
.sidebar__user {
    font-size: .78rem;
    opacity: .7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.sidebar__logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,.3);
    color: rgba(255,255,255,.8);
    padding: .35rem .85rem;
    border-radius: var(--radio-sm);
    cursor: pointer;
    font-size: .82rem;
    width: 100%;
    transition: all var(--trans);
    text-align: left;
}
.sidebar__logout:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── Topbar móvil ─────────────────────────────── */
.admin-topbar {
    display: none;
    align-items: center;
    gap: 1rem;
    background: var(--azul);
    color: #fff;
    padding: .75rem 1.25rem;
    border-bottom: 2px solid var(--dorado);
    position: sticky;
    top: 0;
    z-index: 200;
}
.admin-topbar__title { font-weight: 600; font-size: .95rem; flex: 1; }
.admin-topbar__user  { font-size: .78rem; opacity: .75; }

/* Botón hamburguesa */
.hamburger {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: .3rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all .25s ease;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 250;
}
.sidebar-overlay.open { display: block; }

/* ── Contenido admin ──────────────────────────── */
.admin-main { padding: 2rem; flex: 1; overflow-y: auto; }
.admin-page__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.admin-page__title {
    font-family: 'Merriweather', Georgia, serif;
    font-size: 1.6rem;
    color: var(--azul);
}
.admin-page__sub { color: var(--texto-soft); font-size: .9rem; margin-top: .25rem; margin-bottom: 1.5rem; }

/* ── Dashboard cards ──────────────────────────── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 1.25rem; margin-top: 1rem; }
.dash-card {
    background: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: var(--radio-lg);
    padding: 1.75rem;
    text-decoration: none;
    transition: box-shadow var(--trans), transform var(--trans);
    display: block;
}
.dash-card:hover { box-shadow: var(--sombra-md); transform: translateY(-2px); text-decoration: none; }
.dash-card__icon { font-size: 2.5rem; display: block; margin-bottom: .75rem; }
.dash-card h3 { font-size: 1rem; font-weight: 700; color: var(--azul); margin-bottom: .35rem; }
.dash-card p  { font-size: .82rem; color: var(--texto-soft); }

/* Stat cards (para reportes/dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: var(--radio-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.stat-card__label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-soft); }
.stat-card__value { font-size: 2rem; font-weight: 800; color: var(--azul); line-height: 1; }
.stat-card__sub   { font-size: .78rem; color: var(--texto-soft); }
.stat-card--green .stat-card__value { color: var(--verde); }
.stat-card--gold  .stat-card__value { color: var(--dorado); }
.stat-card--red   .stat-card__value { color: var(--rojo); }

/* ── Secciones admin ──────────────────────────── */
.admin-section {
    background: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: var(--radio-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.admin-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .5rem;
}
.admin-section__head h2 { font-size: 1rem; font-weight: 700; color: var(--azul); }

/* ── Tabla general ────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th {
    text-align: left;
    padding: .6rem .85rem;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--texto-soft);
    border-bottom: 2px solid var(--borde);
    background: var(--bg);
    white-space: nowrap;
}
.admin-table td { padding: .65rem .85rem; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.admin-table tr.row-inactive td { opacity: .55; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--azul-lite); }

/* ── Estatus badge de denuncia ────────────────── */
.estatus-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .75rem;
    font-weight: 600;
    padding: .25rem .65rem;
    border-radius: 20px;
    white-space: nowrap;
}
.estatus-pendiente  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.estatus-en-proceso { background: var(--azul-lite); color: var(--azul); border: 1px solid #bfdbfe; }
.estatus-resuelta   { background: var(--verde-lite); color: var(--verde); border: 1px solid #6ee7b7; }
.estatus-archivada  { background: var(--bg); color: var(--texto-soft); border: 1px solid var(--borde); }

/* ── Buscador / filtros ───────────────────────── */
.filter-bar {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1.25rem;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; }

/* ── Lista sortable ───────────────────────────── */
.sortable-list { list-style: none; }
.sortable-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border: 1px solid var(--borde);
    border-radius: var(--radio-sm);
    margin-bottom: .5rem;
    background: var(--blanco);
    transition: box-shadow var(--trans);
}
.sortable-item.inactive { opacity: .55; background: var(--bg); }
.sortable-item:hover { box-shadow: var(--sombra-sm); }
.drag-handle { cursor: grab; color: var(--texto-soft); font-size: 1.1rem; flex-shrink: 0; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.item-name { flex: 1; font-size: .9rem; font-weight: 500; color: var(--texto); }
.item-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Badges ───────────────────────────────────── */
.item-badge { font-size: .72rem; font-weight: 600; padding: .2rem .6rem; border-radius: 20px; flex-shrink: 0; }
.badge-on  { background: var(--verde-lite); color: var(--verde); }
.badge-off { background: #fee2e2; color: var(--rojo); }
.tipo-badge { font-size: .72rem; font-weight: 600; padding: .15rem .55rem; border-radius: 20px; margin-left: .5rem; }
.badge-jur { background: var(--azul-lite); color: var(--azul); }
.badge-adm { background: var(--dorado-lite); color: var(--dorado); }

/* ── Modal ────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-box {
    background: var(--blanco);
    border-radius: var(--radio-lg);
    padding: 2rem;
    max-width: 520px;
    width: 100%;
    box-shadow: var(--sombra-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--azul); margin-bottom: 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; }

/* ── Extras ───────────────────────────────────── */
.filter-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.empty-msg { color: var(--texto-soft); font-size: .88rem; padding: 1.5rem; text-align: center; }

/* ── Layout público — botón admin en header ───── */
.site-header__nav-admin {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: var(--radio-sm);
    padding: .3rem .85rem;
    font-size: .82rem;
    font-weight: 600;
    color: #fff !important;
    transition: background var(--trans);
}
.site-header__nav-admin:hover { background: rgba(255,255,255,.25); text-decoration: none !important; }

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Sidebar se convierte en drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 300;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar__close { display: block; }

    /* Mostrar topbar móvil */
    .admin-topbar { display: flex; }

    /* Ajustes de contenido */
    .admin-main { padding: 1.25rem; }
    .admin-page__head { flex-direction: column; align-items: flex-start; }
    .admin-table { font-size: .8rem; }
    .admin-table th, .admin-table td { padding: .5rem .6rem; }
    .item-actions { flex-direction: column; }
    .stat-grid { grid-template-columns: repeat(2,1fr); }
}

@media (min-width: 769px) {
    .admin-topbar { display: none; }
    .sidebar { transform: none !important; }
}

/* ── Badges de modalidad ──────────────────────────── */
.modalidad-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .75rem;
    font-weight: 600;
    padding: .2rem .6rem;
    border-radius: 20px;
    white-space: nowrap;
}

.modalidad-enlinea {
    background: #e8eef7;
    color: #2356a0;
    border: 1px solid #bfdbfe;
}

.modalidad-presencial {
    background: #fdf3e0;
    color: #92400e;
    border: 1px solid #fde68a;
}