/* ============================================================
   Plataforma Deportiva Multi-Liga — Panel Admin
   ============================================================ */

:root {
    --admin-dark:    #0f1923;
    --admin-darker:  #0a1018;
    --admin-accent:  #e8b923;
    --sidebar-width: 240px;
}

/* ── Layout ──────────────────────────────────────────────────── */
.admin-body {
    background: #f0f2f5;
    min-height: 100vh; /* fallback */
    min-height: 100dvh;
    height: 100vh; /* fallback */
    height: 100dvh;
    overflow: hidden;
}

.bg-admin-dark {
    background: var(--admin-dark) !important;
}

.admin-wrapper {
    height: calc(100vh - 56px); /* fallback */
    height: calc(100dvh - 56px);
    overflow: hidden;
    position: relative;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.admin-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: var(--admin-darker) !important;
    border-right: 1px solid rgba(255,255,255,.06);
    overflow-y: auto;
}

.admin-menu-toggle {
    display: none;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.admin-sidebar-backdrop {
    display: none;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.1rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .9rem;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}

.admin-nav-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    border-left-color: var(--admin-accent);
}

.admin-nav-link.active {
    background: rgba(232,185,35,.12);
    color: var(--admin-accent);
    border-left-color: var(--admin-accent);
    font-weight: 600;
}

.nav-icon-whistle {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.nav-section {
    padding: 1rem 1.1rem .25rem;
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    list-style: none;
}

/* ── Main content ────────────────────────────────────────────── */
.admin-content {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding-bottom: 120px;
}

.admin-content::-webkit-scrollbar,
.admin-sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.admin-sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card {
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.1) !important;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Shortcut cards ──────────────────────────────────────────── */
.shortcut-card {
    transition: transform .15s, box-shadow .15s;
}

.shortcut-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,.12) !important;
    background: #f8f9fa;
}

/* ── Badge toggle button ─────────────────────────────────────── */
.badge-toggle {
    cursor: pointer;
    font-size: .78rem;
    padding: .35em .6em;
    opacity: .9;
}

.badge-toggle:hover {
    opacity: 1;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table thead th {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

/* ── Responsive collapsed tables (mobile) ───────────────────── */
@media (max-width: 767.98px) {
    .table-responsive {
        overflow: visible;
    }

    .table.table-collapsible thead {
        display: none;
    }

    .table.table-collapsible,
    .table.table-collapsible tbody,
    .table.table-collapsible tr,
    .table.table-collapsible td {
        display: block;
        width: 100%;
    }

    .table.table-collapsible tr {
        margin-bottom: .75rem;
        border: 1px solid #e5e9ef;
        border-radius: .55rem;
        background: #fff;
        box-shadow: 0 1px 5px rgba(0,0,0,.03);
        overflow: hidden;
    }

    .table.table-collapsible tr.row-expandable {
        cursor: pointer;
        position: relative;
    }

    .table.table-collapsible tr.row-expandable::after {
        content: '\25BE';
        position: absolute;
        top: .5rem;
        right: .7rem;
        font-size: .72rem;
        color: #6f7d8a;
        transition: transform .15s ease;
    }

    .table.table-collapsible tr.row-expandable.is-open::after {
        transform: rotate(180deg);
    }

    .table.table-collapsible td {
        border: 0;
        border-bottom: 1px dashed #edf1f5;
        padding: .55rem .8rem;
        text-align: left !important;
    }

    .table.table-collapsible tr.row-expandable td[data-detail="1"] {
        display: none;
    }

    .table.table-collapsible tr.row-expandable.is-open td[data-detail="1"] {
        display: block;
    }

    .table.table-collapsible tr.row-expandable td[data-detail="0"] {
        background: #fcfdff;
    }

    .table.table-collapsible td:last-child {
        border-bottom: 0;
    }

    .table.table-collapsible td[data-label]:not([colspan])::before {
        content: attr(data-label);
        display: block;
        font-size: .68rem;
        font-weight: 700;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: #6f7d8a;
        margin-bottom: .18rem;
    }

    .table.table-collapsible td[colspan] {
        text-align: center !important;
        color: #6c757d;
        padding: .85rem;
    }
}

/* ── Escudo preview ──────────────────────────────────────────── */
.escudo-sm {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.escudo-preview {
    height: 70px;
    object-fit: contain;
}

/* ── Color dot ───────────────────────────────────────────────── */
.color-dot {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    margin-right: 3px;
    vertical-align: middle;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: .6rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: .9rem 1.1rem;
}

/* ── Responsive sidebar ──────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-content {
        max-width: 100vw;
        padding: 1rem 1rem 150px 1rem !important; /* Extra padding at bottom to prevent cutoff */
    }
}

@media (max-width: 991.98px) {
    .admin-menu-toggle {
        display: inline-flex;
    }

    .admin-sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        z-index: 1045;
        width: min(84vw, 320px);
        min-width: 0;
        height: calc(100vh - 56px);
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 10px 28px rgba(0,0,0,.3);
    }

    .admin-sidebar-backdrop {
        display: block;
        position: fixed;
        top: 56px;
        left: 0;
        width: 100vw;
        height: calc(100vh - 56px);
        background: rgba(10,16,24,.45);
        opacity: 0;
        pointer-events: none;
        z-index: 1040;
        transition: opacity .18s ease;
    }

    .admin-body.admin-menu-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-body.admin-menu-open .admin-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .admin-content {
        max-width: 100vw;
        width: 100%;
    }
}

@media (min-width: 992px) {
    .admin-sidebar {
        transform: none !important;
        position: relative;
        top: auto;
        left: auto;
        z-index: auto;
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        box-shadow: none;
    }

    .admin-sidebar-backdrop {
        display: none !important;
    }
}
