/* =========================================================
   TuNoticia – Estado de Servicios  |  frontend.css
   Diseño compatible con el tema oscuro de TuNoticia
   ========================================================= */

/* ---------- Variables ---------- */
:root {
    --tnserv-bg:          #1a1a1a;
    --tnserv-border:      #2e2e2e;
    --tnserv-accent:      #d63031;       /* rojo TuNoticia */
    --tnserv-title-bg:    #d63031;
    --tnserv-title-color: #ffffff;
    --tnserv-item-bg:     #232323;
    --tnserv-item-hover:  #2c2c2c;
    --tnserv-text:        #e0e0e0;
    --tnserv-muted:       #888;
    --tnserv-green:       #00b894;
    --tnserv-red:         #e74c3c;
    --tnserv-radius:      6px;
    --tnserv-font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Contenedor principal ---------- */
.tnserv-bar {
    display: flex;
    align-items: stretch;
    background: var(--tnserv-bg);
    border: 1px solid var(--tnserv-border);
    border-radius: var(--tnserv-radius);
    overflow: hidden;
    font-family: var(--tnserv-font);
    font-size: 12px;
    margin: 0 0 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.45);
}

/* ---------- Título "SERVICIOS" ---------- */
.tnserv-bar__title {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--tnserv-title-bg);
    color: var(--tnserv-title-color);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 80px;
    flex-shrink: 0;
}

.tnserv-bar__icon {
    font-size: 18px;
    line-height: 1;
}

/* ---------- Fila de ítems ---------- */
.tnserv-bar__items {
    display: flex;
    flex: 1;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}
.tnserv-bar__items::-webkit-scrollbar { display: none; }

/* ---------- Ítem individual ---------- */
.tnserv-bar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 18px;
    border-right: 1px solid var(--tnserv-border);
    background: var(--tnserv-item-bg);
    transition: background .18s ease;
    cursor: default;
    flex: 1;
    min-width: 90px;
    position: relative;
}

.tnserv-bar__item:last-child {
    border-right: none;
}

.tnserv-bar__item:hover {
    background: var(--tnserv-item-hover);
}

/* Línea superior de color según estado */
.tnserv-bar__item::before {
    content: '';
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 0;
    transition: opacity .2s;
}
.tnserv-bar__item--active::before  { background: var(--tnserv-green); }
.tnserv-bar__item--inactive::before { background: var(--tnserv-red); }

/* ---------- Ícono SVG ---------- */
.tnserv-bar__item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}
.tnserv-bar__item-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
    transition: color .2s;
}
.tnserv-bar__item--active   .tnserv-bar__item-icon svg { color: var(--tnserv-green); }
.tnserv-bar__item--inactive .tnserv-bar__item-icon svg { color: var(--tnserv-red); }

/* ---------- Nombre del servicio ---------- */
.tnserv-bar__item-name {
    color: var(--tnserv-text);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .4px;
    text-transform: uppercase;
    line-height: 1;
}

/* ---------- Badge de estado ---------- */
.tnserv-bar__item-badge {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .3px;
    line-height: 1;
    padding: 2px 0;
}
.tnserv-bar__item-badge.active   { color: var(--tnserv-green); }
.tnserv-bar__item-badge.inactive { color: var(--tnserv-red); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 600px) {
    .tnserv-bar {
        flex-direction: column;
    }
    .tnserv-bar__title {
        flex-direction: row;
        min-width: auto;
        padding: 8px 14px;
        gap: 8px;
        font-size: 11px;
    }
    .tnserv-bar__items {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .tnserv-bar__item {
        flex: 1 1 45%;
        border-right: none;
        border-bottom: 1px solid var(--tnserv-border);
        padding: 10px 8px;
    }
    .tnserv-bar__item:last-child {
        border-bottom: none;
    }
}

/* =========================================================
   COMPATIBILIDAD CON TEMA CLARO
   Si el sitio usa fondo claro, los colores se adaptan
   ========================================================= */
@media (prefers-color-scheme: light) {
    .tnserv-bar {
        /* mantener estilo oscuro de marca aunque el OS sea claro */
        background: var(--tnserv-bg);
    }
}

/* =========================================================
   SKELETON / LOADING STATE (mientras carga el AJAX)
   ========================================================= */

@keyframes tnserv-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

.tnserv-skeleton {
    display: flex;
    flex: 1;
    align-items: stretch;
}

.tnserv-skel-item {
    flex: 1;
    min-width: 90px;
    height: 100%;
    min-height: 60px;
    border-right: 1px solid var(--tnserv-border);
    background: linear-gradient(
        90deg,
        #232323 25%,
        #2e2e2e 50%,
        #232323 75%
    );
    background-size: 800px 100%;
    animation: tnserv-shimmer 1.4s infinite linear;
}

.tnserv-skel-item:last-child {
    border-right: none;
}
