/* =========================================================
 * Estilos base del panel
 * ========================================================= */
:root {
    --app-brand: #F58426;
    --app-brand-dark: #d96d14;
    --app-accent: #009FC2;
    --app-sidebar-bg: #1f2633;
    --app-sidebar-text: #c3c9d4;
    --app-sidebar-width: 248px;
    --app-bg: #f4f6f9;
    --app-border: #e3e7ee;
}

body.app {
    background: var(--app-bg);
    min-height: 100vh;
}

.min-w-0 { min-width: 0; }

/* Botón principal con el color de la marca */
.btn-brand {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--app-brand);
    --bs-btn-border-color: var(--app-brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-brand-dark);
    --bs-btn-hover-border-color: var(--app-brand-dark);
    --bs-btn-active-bg: var(--app-brand-dark);
    --bs-btn-active-border-color: var(--app-brand-dark);
    --bs-btn-disabled-bg: var(--app-brand);
    --bs-btn-disabled-border-color: var(--app-brand);
}

/* ---------- Menú lateral ---------- */
.app-sidebar {
    /* Bootstrap deja transparente .offcanvas-lg en pantallas grandes */
    background: var(--app-sidebar-bg) !important;
    color: var(--app-sidebar-text);
    --bs-offcanvas-width: var(--app-sidebar-width);
    --bs-offcanvas-bg: var(--app-sidebar-bg);
    --bs-offcanvas-color: var(--app-sidebar-text);
}
@media (min-width: 992px) {
    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--app-sidebar-width);
        z-index: 1030;
    }
    .app-main { margin-left: var(--app-sidebar-width); }
}
.app-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem .75rem;
    overflow-y: auto;
}
.app-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .25rem .5rem 1rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
}
.app-brand img { border-radius: 8px; background: #fff; padding: 2px; }
.app-nav { flex: 1; }
.app-nav-title {
    margin: 1rem .75rem .35rem;
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #7d8698;
}
.app-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border-radius: .5rem;
    color: var(--app-sidebar-text);
    text-decoration: none;
    font-weight: 500;
}
.app-nav-link i { font-size: 1.1rem; }
.app-nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.app-nav-link.active { background: var(--app-brand); color: #fff; }

.app-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .75rem .5rem 0;
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.app-user-avatar {
    flex: 0 0 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--app-accent);
    color: #fff;
    font-weight: 700;
}
.app-user-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem;
    margin: -.35rem;
    border-radius: .5rem;
    text-decoration: none;
}
.app-user-link:hover, .app-user-link.active { background: rgba(255, 255, 255, .06); }
.app-user-link:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.app-user-info { flex: 1; min-width: 0; line-height: 1.2; }
.app-user-name { color: #fff; font-weight: 600; font-size: .9rem; }
.app-user-email { font-size: .75rem; color: #7d8698; }
.app-user-logout { color: var(--app-sidebar-text); font-size: 1.15rem; }
.app-user-logout:hover { color: #fff; }

/* ---------- Contenido ---------- */
.app-main { min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: .5rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--app-border);
}
.app-topbar .breadcrumb { font-size: .9rem; flex-wrap: nowrap; overflow: hidden; }
.app-topbar .breadcrumb-item { white-space: nowrap; }
.app-topbar .breadcrumb-item a { color: #6c757d; text-decoration: none; }
.app-topbar .breadcrumb-item a:hover { color: var(--app-brand); }
.app-content { flex: 1; padding: 1.5rem; }
.app-footer {
    padding: 1rem 1.5rem;
    font-size: .8rem;
    color: #8a93a3;
}
.app-footer a { color: inherit; }
.app-messages .alert { margin-bottom: 1rem; }

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-subtitle { color: #6c757d; margin: .25rem 0 0; font-size: .9rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Tarjetas y tablas */
.card { border-color: var(--app-border); }
.card-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--app-border);
}
.table > thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    background: #f8f9fb;
    white-space: nowrap;
}
.table td { vertical-align: middle; }
.table .row-link { color: inherit; font-weight: 600; text-decoration: none; }
.table .row-link:hover { color: var(--app-brand); }
.table-actions { white-space: nowrap; text-align: end; }
.empty-state { padding: 2.5rem 1rem; text-align: center; color: #6c757d; }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #b5bdca; }

/* Encabezado de detalle con pestañas */
.detail-header {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    padding: 1.25rem 1.25rem 0;
    margin-bottom: 1.25rem;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; color: #6c757d; font-size: .9rem; margin-top: .35rem; }
.detail-meta i { margin-right: .25rem; }
.detail-tabs { margin-top: 1rem; border-bottom: 0; flex-wrap: nowrap; overflow-x: auto; }
.detail-tabs .nav-link {
    color: #6c757d;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: .6rem 1rem;
    white-space: nowrap;
    font-weight: 500;
}
.detail-tabs .nav-link:hover { color: #212529; }
.detail-tabs .nav-link.active { color: var(--app-brand); border-bottom-color: var(--app-brand); background: none; }

/* Indicadores */
.stat-card {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    padding: 1rem 1.1rem;
    height: 100%;
}
.stat-label { font-size: .8rem; color: #6c757d; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-hint { font-size: .8rem; color: #6c757d; }

/* Accesos rápidos */
.action-tile {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    width: 100%;
    padding: .9rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    background: #fff;
    color: inherit;
    text-align: start;
    text-decoration: none;
    height: 100%;
}
.action-tile:hover { border-color: var(--app-brand); box-shadow: 0 2px 10px rgba(245, 132, 38, .12); color: inherit; }
.action-tile i { font-size: 1.4rem; color: var(--app-brand); }
.action-tile strong { display: block; }
.action-tile small { color: #6c757d; }

/* Formularios */
.form-card { max-width: 760px; }
.form-help { font-size: .85rem; color: #6c757d; }

/* Pantallas de juego (operador) */
body.app-focus { background: #fff; }
.app-focus-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--app-border);
}

/* Selector de color con valor "por defecto" (shared/widgets/color_input.html) */
.color-input .form-control-color { flex: 0 0 3.25rem; width: 3.25rem; padding: .3rem; }

/* Enlace de detalle dentro de tablas */
.table-detail-link { color: var(--bs-body-color); }
.table-detail-link:hover { color: var(--app-brand); }

/* Encabezado de las pantallas de juego en vivo (tómbola y sorteo de lotería) */
.focus-eyebrow { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6c757d; line-height: 1; }
.focus-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.connection-status { font-weight: 500; font-size: .75rem; display: inline-flex; align-items: center; gap: .35rem; }
.connection-status i { font-size: .5rem; }
.connection-status.is-online { background: #e6f4ea; color: #1e7e34; }
.connection-status.is-offline { background: #fdecea; color: #b02a37; }
