/* RESET BÁSICO PARA EL PORTAL */
.thgp-dashboard-container,
.thgp-login-wrapper {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    color: #333;
}

/* --- ESTILOS LOGIN --- */
.thgp-login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f4f6f9;
}

.thgp-login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.thgp-login-box h2 {
    color: #1f419b;
    /* Azul Fuerte Primario */
    margin-bottom: 20px;
}

.thgp-login-box img {
    max-width: 150px;
    margin-bottom: 20px;
}

/* Botón del Login */
.thgp-login-box .login-submit input[type="submit"] {
    background-color: #1f419b !important;
    border: none !important;
    color: white !important;
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.thgp-login-box .login-submit input[type="submit"]:hover {
    background-color: #088ebf !important;
    /* Azul auxiliar al hover */
}

/* --- ESTILOS DASHBOARD (LAYOUT) --- */
.thgp-dashboard-container {
    display: flex;
    min-height: 100vh;
    /* Altura mínima del portal */
    background-color: #f4f6f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

/* SIDEBAR IZQUIERDO */
.thgp-sidebar {
    width: 250px;
    background-color: #1f419b;
    /* PRIMARIO */
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.thgp-sidebar-header {
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.1);
    text-align: center;
}

.thgp-sidebar-header img {
    max-width: 80%;
    height: auto;
    filter: brightness(0) invert(1);
    /* Vuelve el logo blanco si es oscuro */
}

.thgp-nav {
    flex-grow: 1;
    padding-top: 20px;
}

.thgp-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.thgp-nav li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    font-size: 15px;
    border-left: 4px solid transparent;
    transition: all 0.3s;
}

.thgp-nav li a:hover,
.thgp-nav li.active a {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: #088ebf;
    /* Azul auxiliar para indicar activo */
    color: white;
}

.thgp-nav span.dashicons {
    margin-right: 10px;
    font-size: 18px;
}

.thgp-user-profile {
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    font-size: 14px;
}

.thgp-logout {
    color: #ffcccc;
    font-size: 12px;
    text-decoration: none;
}

/* CONTENIDO PRINCIPAL */
.thgp-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.thgp-topbar {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e4e8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.thgp-topbar h1 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.thgp-content-area {
    padding: 30px;
    overflow-y: auto;
}

/* --- BOTONES GENERALES PARA EL FUTURO --- */
.btn-primary {
    background-color: #1f419b;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary {
    background-color: #9b201f;
    /* ROJO SECUNDARIO */
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.btn-aux {
    background-color: #088ebf;
    color: white;
}


/* --- COMPONENTES: TARJETAS --- */
.thgp-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.thgp-card-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thgp-card-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1f419b;
}

.thgp-card-body {
    padding: 20px;
}

/* --- TABLAS DE DATOS --- */
.thgp-table {
    width: 100%;
    border-collapse: collapse;
}

.thgp-table th {
    text-align: left;
    padding: 12px;
    background-color: #f8f9fa;
    color: #666;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid #eee;
}

.thgp-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 14px;
}

.thgp-table tr:hover {
    background-color: #f9fbff;
    /* Azul muy clarito al pasar mouse */
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Botón icono editar */
.btn-icon {
    text-decoration: none;
    font-size: 18px;
    padding: 5px;
    border-radius: 4px;
}

.btn-icon:hover {
    background-color: #eee;
}

/* --- FORMULARIOS (GRID) --- */
.thgp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 Columnas */
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    border-color: #1f419b;
    outline: none;
}

.form-actions {
    margin-top: 20px;
    text-align: right;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

/* --- ESTILOS DASHBOARD (LAYOUT 100VH) --- */

/* 1. Forzamos al contenedor a ocupar toda la pantalla y no crecer más */
.thgp-dashboard-container {
    display: flex;
    height: 100vh;
    /* Altura fija al 100% de la ventana */
    width: 100%;
    background-color: #f4f6f9;
    border: 1px solid #ddd;
    overflow: hidden;
    /* Ocultamos cualquier desborde del contenedor principal */
}

/* 2. El Sidebar ocupa el 100% de alto también */
.thgp-sidebar {
    width: 250px;
    background-color: #1f419b;
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    /* Asegura que llegue hasta abajo */
    overflow-y: auto;
    /* Si el menú es muy largo, que scrollee el menú */
}

/* 3. El Main Content organiza el Header y el Área de Contenido */
.thgp-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    /* Apila Header arriba, Contenido abajo */
    height: 100%;
    /* Ocupa el 100% del alto disponible */
    overflow: hidden;
    /* Evita scroll doble */
}

/* 4. Topbar fija arriba */
.thgp-topbar {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e4e8;
    flex-shrink: 0;
    /* No permitas que se aplaste */
}

/* 5. ESTE ES EL CLAVE: El área de contenido es la que tiene el scroll */
.thgp-content-area {
    padding: 30px;
    flex-grow: 1;
    /* Ocupa todo el espacio sobrante */
    overflow-y: auto;
    /* AQUÍ ESTÁ EL SCROLL INTERNO */
    height: 100%;
}

/* --- ESTILO PARA EL BUSCADOR (Nuevo) --- */
.thgp-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.thgp-search-box {
    display: flex;
    gap: 5px;
}

.thgp-search-box input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 250px;
}

/* --- IMÁGENES DE PRODUCTOS --- */
.thgp-table img {
    border-radius: 4px;
    width: 40px;
    height: 40px;
    object-fit: cover;
    /* Para que no se deformen */
    border: 1px solid #eee;
}

a.btn-aux {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    border-radius: 3px;
}

/* --- BADGES DE ESTADO (Tipo WooCommerce Nativo) --- */
.thgp-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.5px;
    padding: 10px;
}

/* Colores por estado */
.status-completed {
    background-color: #c6e1c6;
    color: #5b841b;
}

/* Completado: Verde */

.status-processing {
    background-color: #c8d7e1;
    color: #2e4453;
}

/* Procesando: Gris/Azul (Nativo Woo antiguo) o Verde activo */
/* Alternativa moderna para Procesando: */
.status-processing {
    background-color: #def7ec;
    color: #03543f;
}

/* Verde Moderno */
.status-completed {
    background-color: #e1effe;
    color: #1e429f;
}

/* Azul para Finalizado */

.status-pending {
    background-color: #fff8dd;
    color: #92400e;
}

/* Pendiente: Amarillo */
.status-on-hold {
    background-color: #fdf6b2;
    color: #723b13;
}

/* En espera: Naranja */
.status-cancelled {
    background-color: #fde8e8;
    color: #9b1c1c;
}

/* Cancelado: Rojo */
.status-refunded {
    background-color: #f3f4f6;
    color: #374151;
}

/* Reembolsado: Gris oscuro */
.status-failed {
    background-color: #fde8e8;
    color: #9b1c1c;
}

/* Fallido: Rojo */

/* --- BARRA DE FILTROS --- */
.thgp-filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

.thgp-filter-bar input,
.thgp-filter-bar select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

input#user_login {
    width: 100%;
}

p.login-password {
    display: flex;
    flex-direction: column;
}

/* --- PAGINACIÓN --- */
.thgp-pagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.thgp-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 5px;
}

.thgp-pagination li {
    margin: 0;
}

.thgp-pagination a,
.thgp-pagination span {
    display: block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #1f419b;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    min-width: 35px;
    text-align: center;
}

.thgp-pagination a:hover {
    background-color: #f0f4ff;
    border-color: #1f419b;
}

/* Página Activa */
.thgp-pagination span.current {
    background-color: #1f419b;
    color: white;
    border-color: #1f419b;
    font-weight: bold;
}


/* Ajustes para Select2 en el Portal */
.select2-container .select2-selection--single {
    height: 38px !important; /* Altura similar a tus inputs */
    border: 1px solid #ddd !important;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px !important;
}

/* Opcional: Asegurar que el z-index sea correcto si usas modales */
.select2-dropdown {
    z-index: 9999;
}

/* --- RESPONSIVE / MÓVIL --- */

/* Por defecto ocultamos el botón de menú y el overlay en escritorio */
#thgp-mobile-toggle, .thgp-overlay {
    display: none;
}

@media (max-width: 768px) {
    
    /* 1. Ajustar el contenedor principal */
    .thgp-dashboard-container {
        flex-direction: column; /* Cambiar flujo */
    }

    /* 2. Estilo del Sidebar (Oculto por defecto) */
    .thgp-sidebar {
        position: fixed; /* Flotante */
        top: 0;
        left: -260px; /* Escondido a la izquierda */
        width: 250px;
        height: 100vh;
        z-index: 1000; /* Por encima de todo */
        transition: left 0.3s ease-in-out; /* Animación suave */
        box-shadow: 2px 0 15px rgba(0,0,0,0.2);
    }

    /* Clase para cuando está abierto */
    .thgp-sidebar.open {
        left: 0; /* Aparece */
    }

    /* 3. Botón de Hamburguesa */
    #thgp-mobile-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 28px;
        color: #1f419b;
        cursor: pointer;
        margin-right: 15px;
        padding: 0;
        line-height: 1;
    }

    /* Ajustar el Topbar para incluir el botón */
    .thgp-topbar {
        display: flex;
        align-items: center;
        padding: 15px 20px;
    }

    .thgp-topbar h1 {
        font-size: 18px; /* Título más pequeño en móvil */
    }

    /* 4. Fondo Oscuro (Overlay) al abrir menú */
    .thgp-overlay {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999; /* Debajo del sidebar pero encima del contenido */
        backdrop-filter: blur(2px);
    }
    
    /* El contenido principal ocupa todo el ancho */
    .thgp-main-content {
        width: 100%;
    }
    
    /* Ajustes visuales para tablas en móvil (Scroll horizontal) */
    .thgp-card-body {
        overflow-x: auto; 
    }
    .thgp-table {
        min-width: 600px; /* Fuerza scroll si la tabla es muy ancha */
    }
    
    /* Ajustar filtros en columna */
    .thgp-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .thgp-filter-bar input, .thgp-filter-bar select {
        width: 100% !important;
    }
}