/* ===
   Gral
  =========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;

    font-family: 'Inter', sans-serif;

    transition:
        background-color .2s ease,
        color .2s ease,
        border-color .2s ease,
        box-shadow .2s ease,
        transform .2s ease;
}

html,
body {
    height: 100%;
}

body {
    background: #f4f6f9; /* Suavizado: de morado claro a gris claro limpio */
    color: #2d2d2d;
    overflow-x: hidden;
}

/*  LAYOUT
   */
.app {
    display: flex;
    min-height: 100vh;
}

/* 
   SIDEBAR (Conservaremos la imagen de add)
    */
.sidebar {
    width: 240px;

    background: linear-gradient(180deg, #ab47bc, #8e24aa);

    color: #fff;

    position: fixed;

    left: 0;
    top: 0;

    height: 100vh;

    display: flex;
    flex-direction: column;

    z-index: 1001;

    box-shadow: 4px 0 20px rgba(0,0,0,0.08);
}

.sidebar-header {
    text-align: center;

    padding: 28px 15px;

    border-bottom: 2px solid rgba(255,255,255,0.08);
}

.sidebar-header img {
    width: 95px;
    height: auto;

    margin-bottom: 10px;
}

.sidebar-header span {
    display: block;

    font-weight: 700;
    font-size: 18px;

    letter-spacing: .5px;

    text-transform: uppercase;
}

/* =
   SIDEBAR LINK
   = */
.sidebar a {
    display: flex;
    align-items: center;
    gap: 14px;

    color: rgba(255,255,255,0.95);

    padding: 16px 18px;

    margin: 5px 10px;

    border-radius: 14px;

    text-decoration: none;

    font-weight: 400; /*letrass*/

    font-size: 15px;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255,255,255,0.16);
    transform: translateX(4px);
}

.sidebar a i {
    width: 22px;
    text-align: center;
    font-size: 18px;
}

/*
   MAIN
   */
.main {
    flex: 1;

    margin-left: 240px;

    display: flex;
    flex-direction: column;

    min-height: 100vh;

    padding-top: 72px;
}

/* 
   HEADER 
    */
.panel-header {
    position: fixed;

    top: 0;
    left: 240px;

    width: calc(100% - 240px);
    height: 72px;

    /* Tonasol a brillante */
    background: linear-gradient(135deg, #6200ea, #9c27b0); 

    color: #ffffff; /* Texto en blanco puro para mximo contraste */

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;

    z-index: 1000;

    box-shadow: 0 4px 15px rgba(98, 0, 234, 0.15);
}

.panel-header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); /* sombra al texto para que resalteEEEE */
}

/* 
   Buscador
    */
.search-container {
    position: sticky;

    top: 72px;

    background: rgba(244,246,249,0.92); /* Sincronizado con el fondo general */

    backdrop-filter: blur(10px);

    padding: 14px 20px;

    z-index: 999;

    border-bottom: 1px solid #e1e6ed;
}

#searchBoxIndex,
#searchBoxAdmin {
    width: 100%;

    padding: 15px 18px;

    border-radius: 14px;

    border: 1px solid #dcd1e3;

    background: #ffffff;

    font-size: 15px;

    color: #333;

    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

#searchBoxIndex:focus,
#searchBoxAdmin:focus {
    border-color: #ab47bc;

    background: #fff;

    box-shadow: 0 0 0 4px rgba(171,71,188,0.12);
}

/* 
   Contenidoo
    */
.panel-body {
    flex: 1;

    padding: 24px;

    margin-bottom: 60px;
}

/* 
   TABLE
    */
.table-wrapper {
    background: #fff;

    border-radius: 16px;

    overflow-x: auto;

    box-shadow: 0 4px 20px rgba(160,170,190,0.15); /* Sombraaaa suave */
}

table {
    width: 100%;

    border-collapse: collapse;
}

th {
    background: #2d1b4e; /* Contraste Cambiado morado fu*/

    color: #fff;

    padding: 16px;

    text-align: left;

    font-size: 12px;

    font-weight: 600;

    text-transform: uppercase;

    letter-spacing: .8px;
}

td {
    padding: 16px;

    border-bottom: 1px solid #f2f4f7;

    font-size: 14px;

    font-weight: 380; /*letras table*/

    color: #333333;
}

tbody tr:nth-child(odd) td {
    background: #ffffff;
}

tbody tr:nth-child(even) td {
    background: #fafbfc; /* Fondo claro neutro en lugar de purrpura */
}

tbody tr:hover td {
    background: #eccdf1 !important; /* Hover clik a click */
    color: #310566;

}

/* 
   FOOTER 
    */
.panel-footer {
    position: fixed;

    bottom: 0;
    left: 240px;

    width: calc(100% - 240px);

    /* Gradiente i */
    background: linear-gradient(135deg, #9c27b0, #6200ea); 

    color: rgba(255, 255, 255, 0.9); /* Texto blanco suavemente transparentte */

    text-align: center;

    font-size: 13px;

    padding: 14px;

    z-index: 1000;

    box-shadow: 0 -4px 15px rgba(98, 0, 234, 0.15);
}

/* 
   MENU BUTTON
    */
.menu-btn {
    position: fixed;

    top: 12px;
    right: 14px;

    width: 46px;
    height: 46px;

    background: #7b1fa2;

    color: #fff;

    border-radius: 12px;

    display: none;

    align-items: center;
    justify-content: center;

    font-size: 21px;

    cursor: pointer;

    z-index: 2000;

    box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

/* 
   RESPONSIVE BASE
    */
@media (max-width: 768px) {

    .menu-btn {
        display: flex;
    }

    .sidebar {
        left: -240px;
        transition: .3s;
    }

    .sidebar.active {
        left: 0;
        box-shadow: 5px 0 30px rgba(0,0,0,0.35);
    }

    .main {
        margin-left: 0;
        padding-top: 64px;
    }

    .panel-header {
        left: 0;
        width: 100%;
        height: 64px;
        padding: 0 60px 0 16px;
        border-bottom: 1px solid #eaedf2;
    }

    .panel-header h1 {
        font-size: 19px;
    }

    .search-container {
        top: 64px;
        padding: 12px 14px;
        background: rgba(244,246,249,0.92);
    }

    .panel-body {
        padding: 14px;
        margin-bottom: 70px;
    }

    .panel-footer {
        left: 0;
        width: 100%;
    }

    th,
    td {
        font-size: 13px;
        padding: 12px;
    }
}

/* 
   ADMIN 
    */
body.admin-page .app {
    display: block !important;
}

body.admin-page .sidebar {
    display: none !important;
}

body.admin-page .main {
    margin-left: 0 !important;
    width: 100%;
}

body.admin-page .panel-header {
    left: 0 !important;
    width: 100% !important;
}

body.admin-page .panel-footer {
    left: 0 !important;
    width: 100% !important;
}

/* 
   ESTILOS ECARDS Y ALERTAS
    */
.cards-container {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.cobertura-card {
    background: #fff;
    border-left: 5px solid #8e24aa;
    border-radius: 14px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(160,170,190,0.1);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: #2d2d2d;
    margin-bottom: 8px;
    border-bottom: 1px solid #f0ebf3;
    padding-bottom: 5px;
    text-transform: uppercase;
}

.card-row {
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
    line-height: 1.4;
}

.card-row span {
    font-weight: 600;
    color: #7b1fa2;
}

.card-row strong {
    background: #f2ddfa;
    padding: 2px 6px;
    border-radius: 6px;
    color: #6a1b9a;
}

.card-row.primary a {
    color: #ab47bc;
    text-decoration: none;
    font-weight: bold;
}

/* --- ESTILOS  ADVERTENCIAS Y CATaLOGO DIFERENCIADO --- */

/* 1. Vista de Escritorio (Tabla General/Diferenciado/Coberturas) */
.cobertura-alerta {
    background-color: #fff2f1 !important; /* Fondo rojo  */
}

.cobertura-alerta td:first-child {
    border-left: 5px solid #d32f2f !important; /* Borde rojo destacado para DIFERENCIADO */
    font-weight: bold;
    color: #c62828;
}

.texto-resaltado-diff {
    color: #c62828 !important;
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* Etiquetas/Badges de estados dentro de la tabla */
.badge-descuento-normal {
    background: #f2ddfa;
    padding: 4px 8px;
    border-radius: 6px;
    color: #6a1b9a;
    font-weight: 600;
    display: inline-block;
    font-size: 12px;
}

.badge-descuento-diff {
    background-color: #d32f2f !important;
    color: #ffffff !important;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    display: inline-block;
    font-size: 11px;
    letter-spacing: .5px;
}

/* 2. Vista de Celular (Tarjetas adaptadas con Alerta OK) */
.cobertura-card-alerta {
    border: 1.5px solid #d32f2f !important;
    border-left: 5px solid #d32f2f !important;
    background-color: #fff2f1 !important;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.1) !important;
}

/* Estilo para el botón de salir */
.btn-salir {
    
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 20px;
}

.btn-salir:hover {
    background: rgba(255, 255, 255, 0.2) !important; /* Mantiene bonito estilo del sidebar */
}
