/** Antecit derechos reservados
 * Descripción del desarrollo: Estilos comunes de SISTEMA sobre el tema Able Pro (Tema.css, TemaPreset.css) con preset-8.
 * Todas las páginas de SISTEMA usan solo este archivo (más Loading, Notificaciones y Pagination) */

:root {
    --bs-font-sans-serif: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --esv-verde: #25d366;
    --esv-verde-oscuro: #128c7e;
    --esv-verde-suave: rgba(44, 168, 127, .1);
}

body {
    font-family: var(--bs-font-sans-serif);
}

.esv-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    padding: 3px;
}

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

.pc-header .pc-head-link i {
    font-size: 1.05rem;
}

.pc-header .badge {
    font-weight: 500;
}

.page-header-title p {
    max-width: 760px;
}

.esv-buscar {
    max-width: 320px;
}

/* Tarjetas que pinta el JS (mismo aspecto que .card) */
.esv-tarjeta {
    background: var(--bs-card-bg, #fff);
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: 12px;
    box-shadow: var(--pc-card-box-shadow);
}

[data-pc-theme=dark] .esv-tarjeta {
    background: #1b232d;
    border-color: #263240;
}

.esv-icono-wa {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.35rem;
    color: var(--bs-primary);
    background: var(--esv-verde-suave);
}

.esv-dato {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color, #5b6b79);
    margin-bottom: .15rem;
}

.esv-valor {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .88rem;
    word-break: break-all;
}

.esv-paso {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    padding: .4rem 0;
    font-size: .9rem;
}

.esv-paso i {
    margin-top: .2rem;
}

.esv-vacio {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bs-secondary-color, #5b6b79);
}

.esv-vacio > i {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    opacity: .6;
}

.esv-codigo {
    background: var(--pc-active-background, #f3f5f7);
    border-radius: 10px;
    padding: .9rem;
    font-size: .8rem;
    max-height: 360px;
    overflow: auto;
}

.table > :not(caption) > * > * {
    background-color: transparent;
}

/* Notificaciones (Plataforma.js) */
.esv-toasts {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2000;
}

/* Tarjetas de canales y opciones de conexión: altura igual en la fila y sin margen (la separación la da el g-3 de la fila) */
.esv-tarjeta-canal {
    height: 100%;
    margin-bottom: 0;
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.esv-tarjeta-canal .card-body {
    padding: 1.25rem;
}

.esv-tarjeta-canal h5,
.esv-tarjeta-canal h6 {
    font-weight: 600;
}

.esv-tarjeta-canal p {
    line-height: 1.5;
}

.esv-tarjeta-canal:hover {
    border-color: rgba(44, 168, 127, .55);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(27, 46, 94, .08);
}

.esv-opcion-alta {
    height: 100%;
    cursor: pointer;
    padding: 1.1rem;
    border: 2px solid var(--bs-border-color);
    border-radius: 12px;
    transition: border-color .15s ease, background .15s ease;
}

.esv-opcion-alta:hover,
.esv-opcion-alta.activa {
    border-color: var(--bs-primary);
    background: var(--esv-verde-suave);
}

/* Esqueleto mientras llega el usuario de la sesión (Sidebar.js, Navbar.js) */
.esv-esqueleto {
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bs-border-color) 25%, var(--pc-active-background, #f3f5f7) 50%, var(--bs-border-color) 75%);
    background-size: 200% 100%;
    animation: esv-esqueleto 1.2s ease-in-out infinite;
    color: transparent !important;
}

@keyframes esv-esqueleto {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Avatar con imagen del usuario (mismo tamaño que .avtar) */
img.esv-avatar {
    object-fit: cover;
}

img.esv-avatar.avtar-xs { width: 32px; height: 32px; }
img.esv-avatar.avtar-s { width: 40px; height: 40px; }
img.esv-avatar.avtar-l { width: 54px; height: 54px; }

/* Espacio de trabajo en el menú del usuario (Navbar.js) */
.esv-espacio-navbar {
    background: var(--pc-active-background, #f3f5f7);
    border: var(--bs-border-width) solid var(--bs-border-color);
}

/* Encabezado de la página (Sistema.js) */
.page-header .page-header-title h2 {
    font-weight: 700;
}

.page-header .page-header-title p {
    max-width: 760px;
}

.page-header .breadcrumb .breadcrumb-item i {
    font-size: .8rem;
}

/* Encabezados de las tablas en tarjetas (card table-card de Able Pro) */
.table-card .table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color, #5b6b79);
    font-weight: 600;
    border-bottom-width: 1px;
}

/* Filtros en el encabezado de una tarjeta */
.esv-filtro .form-select {
    min-width: 220px;
}

/* Tarjetas de indicadores (Inicio, Facturación) */
.esv-indicador .avtar {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
}

.esv-indicador h3 {
    font-weight: 700;
    margin-bottom: 0;
}

/* Línea de tiempo de actividad (Inicio) */
.esv-linea-tiempo li {
    position: relative;
}

.esv-linea-tiempo li:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 15px;
    top: 34px;
    bottom: 4px;
    border-left: 1px dashed var(--bs-border-color);
}

/* Tarjeta de saldo (Inicio, Facturación) */
.esv-saldo {
    background-image: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, .18) 0, transparent 55%);
}

/* Perfil: portada y avatar */
.esv-portada {
    height: 110px;
    background: linear-gradient(135deg, var(--bs-primary), var(--esv-verde-oscuro));
}

.esv-avatar-perfil-contenedor {
    margin-top: -55px;
}

.esv-avatar-perfil {
    width: 110px !important;
    height: 110px !important;
    font-size: 2.5rem;
    object-fit: cover;
    border: 4px solid var(--bs-card-bg, #fff);
}

/* Flecha de las tarjetas (Canales, CanalWhatsapp): círculo que se pinta al pasar el mouse */
.esv-tarjeta-canal .esv-flecha {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .85rem;
    color: var(--bs-secondary-color, #5b6b79);
    background: var(--pc-active-background, #f3f5f7);
    transition: transform .15s ease, color .15s ease, background .15s ease;
}

.esv-tarjeta-canal:hover .esv-flecha {
    transform: translateX(3px);
    color: #fff;
    background: var(--bs-primary);
}

/* Separación entre el encabezado de la página y su contenido */
.page-header {
    margin-bottom: 1.5rem;
}

/* Tablas dentro de tarjetas: la tabla llega a los bordes y el texto conserva el padding */
.table-card .card-body.p-0 .table > :not(caption) > * > *:first-child {
    padding-left: 25px;
}

.table-card .card-body.p-0 .table > :not(caption) > * > *:last-child {
    padding-right: 25px;
}

.table-card .card-header h5 {
    font-weight: 600;
}

/* Íconos de dos tonos (IcoSSDuo...): el tono de fondo un poco más suave que el del tema de Font Awesome */
.fa-duotone {
    --fa-secondary-opacity: .35;
}

/* Menú lateral: íconos de dos tonos del tamaño que usa Able Pro para sus SVG */
.pc-sidebar .pc-micon i {
    font-size: 20px;
    vertical-align: middle;
}

.pc-sidebar .pc-item.active > .pc-link .pc-micon i,
.pc-sidebar .pc-link:hover .pc-micon i {
    color: var(--bs-primary);
}

/* Banner de bienvenida (Inicio) */
.esv-banner {
    background: linear-gradient(120deg, var(--bs-primary) 0%, var(--esv-verde-oscuro) 100%);
    margin-bottom: 1.5rem;
}

.esv-banner .card-body {
    padding: 2rem 2.25rem;
}

.esv-banner::before,
.esv-banner::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    pointer-events: none;
}

.esv-banner::before {
    width: 420px;
    height: 420px;
    right: -120px;
    top: -220px;
}

.esv-banner::after {
    width: 260px;
    height: 260px;
    right: 180px;
    bottom: -170px;
}

.esv-banner h2 {
    font-weight: 700;
}

.esv-banner-icono {
    width: 120px;
    height: 120px;
    border-radius: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #fff;
    background: rgba(255, 255, 255, .15);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .12);
    transform: rotate(-8deg);
}

/* Tarjetas principales de Inicio: caja gris con la mini gráfica y el valor (como Able Pro) */
.esv-indicador h6 {
    font-weight: 600;
}

.esv-indicador-caja {
    background: var(--pc-active-background, #f3f5f7);
    border-radius: 10px;
    padding: .5rem 1rem .5rem .5rem;
}

.esv-mini-grafica {
    width: 86px;
    min-height: 86px;
    flex-shrink: 0;
}

[data-pc-theme=dark] .esv-indicador-caja {
    background: rgba(255, 255, 255, .04);
}

/* Enlaces compartidos (Enlaces.js): url corta en la tabla y barra de usos */
.esv-enlace-url {
    max-width: 280px;
    display: inline-block;
    vertical-align: middle;
    font-size: .78rem;
}

.esv-enlace-usos {
    min-width: 120px;
}

/* Menú lateral: grupos que se despliegan (Sidebar.js) */
.pc-sidebar .pc-arrow i {
    font-size: .75rem;
    transition: transform .2s ease;
}

.pc-sidebar .pc-hasmenu.pc-trigger > .pc-link > .pc-arrow {
    transform: none;
}

.pc-sidebar .pc-hasmenu.pc-trigger > .pc-link > .pc-arrow i {
    transform: rotate(90deg);
}

.pc-sidebar .pc-hasmenu.active > .pc-link {
    color: var(--bs-primary);
}

.pc-sidebar .pc-hasmenu.active > .pc-link .pc-micon i {
    color: var(--bs-primary);
}

.pc-sidebar .pc-submenu {
    padding: 2px 0 6px;
}

.pc-sidebar .pc-submenu .pc-item.active > .pc-link {
    color: var(--bs-primary);
    font-weight: 600;
}

/* Accesos rápidos (Canales) */
.esv-acceso {
    height: 100%;
    margin-bottom: 0;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.esv-acceso:hover {
    border-color: rgba(44, 168, 127, .55);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(27, 46, 94, .08);
}

.esv-acceso .esv-flecha {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .75rem;
    color: var(--bs-secondary-color, #5b6b79);
    background: var(--pc-active-background, #f3f5f7);
    transition: transform .15s ease, color .15s ease, background .15s ease;
}

.esv-acceso:hover .esv-flecha {
    transform: translateX(3px);
    color: #fff;
    background: var(--bs-primary);
}

/* Tarjeta de canal (Canales): banda de color, icono grande y número de conectados */
.esv-canal {
    overflow: hidden;
}

.esv-canal-banda {
    height: 6px;
    background: linear-gradient(90deg, var(--esv-verde), var(--esv-verde-oscuro));
}

.esv-canal-icono {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff;
    background: linear-gradient(135deg, var(--esv-verde), var(--esv-verde-oscuro));
    box-shadow: 0 8px 18px rgba(18, 140, 126, .25);
}

.esv-canal-dato {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    padding: .6rem .9rem;
    border-radius: 10px;
    background: var(--pc-active-background, #f3f5f7);
}

[data-pc-theme=dark] .esv-canal-dato {
    background: rgba(255, 255, 255, .04);
}

/* Flujo de los webhooks (Webhooks): pasos con flecha entre ellos */
.esv-flujo-paso {
    position: relative;
    display: flex;
    align-items: center;
    gap: .9rem;
    height: 100%;
    padding: .9rem 1rem;
    border-radius: 12px;
    background: var(--pc-active-background, #f3f5f7);
}

[data-pc-theme=dark] .esv-flujo-paso {
    background: rgba(255, 255, 255, .04);
}

@media (min-width: 768px) {
    .esv-flujo-sigue::after {
        content: "\203A";
        position: absolute;
        right: -15px;
        top: 50%;
        transform: translateY(-50%);
        width: 22px;
        height: 22px;
        line-height: 20px;
        text-align: center;
        border-radius: 50%;
        font-weight: 700;
        color: var(--bs-primary);
        background: var(--bs-card-bg, #fff);
        border: 1px solid var(--bs-border-color);
        z-index: 1;
    }
}

.esv-mini-dato .card-body {
    padding: 1rem 1.1rem;
}

.esv-mini-dato h4 {
    font-weight: 700;
}

.esv-webhook-url {
    max-width: 360px;
}

/* Listas en el celular: cada registro es una tarjeta (Webhooks) */
.esv-item-movil {
    padding: 1rem 1.25rem;
    border-bottom: var(--bs-border-width) solid var(--bs-border-color);
}

.esv-item-movil:last-child {
    border-bottom: 0;
}

/* Endpoints de la API (Apis) */
.esv-endpoint {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    padding: .85rem 0;
    border-bottom: 1px dashed var(--bs-border-color);
}

.esv-endpoint:first-child {
    padding-top: 0;
}

.esv-endpoint:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.esv-pestanas {
    gap: .35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.esv-pestanas .nav-link {
    white-space: nowrap;
    border-radius: 8px;
    padding: .4rem .9rem;
    font-size: .85rem;
}

.esv-aviso-socios {
    border-style: dashed;
    background: var(--esv-verde-suave);
}

/* Celular: menos espacio y botones de la página a lo ancho */
@media (max-width: 575.98px) {
    .page-header .page-header-title h2 {
        font-size: 1.4rem;
    }

    #InnerHTMLAccionesPagina > .btn,
    #InnerHTMLAccionesPagina > a.btn {
        flex: 1 1 auto;
    }

    .esv-filtro {
        width: 100%;
    }

    .esv-filtro .form-select {
        min-width: 0;
    }

    .table-card .card-header {
        padding: 1rem 1.25rem;
    }
}
