/* ==========================================================================
   ESTILOS GENERALES DEL PANEL DE USUARIO (PROYECTO-B)
   ========================================================================== */

  body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    font-family: 'Inter', sans-serif;
}


.search-bar2 {
    flex-grow: 1;
    max-width: 600px;
    display: flex;
    border: 1px solid var(--light-gray);
    border-radius: 30px;
    overflow: hidden;
}

.search-bar2 input {
    flex-grow: 1;
    border: none;
    padding: 12px 20px;
    outline: none;
}
.search-bar2 button {
    background-color: var(--light-gray);
    color: var(--white);
    border: none;
    padding: 0 25px;
    cursor: pointer;
    font-size: 16px;
    transition: 0.3s;
}

.search-bar2 button:hover {
    background-color: var(--dark-blue);
}

.user-panel-section {
    background-color: var(--bg-light);
    padding: 0px;
    min-height: calc(100vh - 160px);
}

.user-panel-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    font-family: 'Inter', sans-serif;
}

/* --- SIDEBAR DE NAVEGACIÓN --- */
.panel-sidebar {
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 0px;
    padding: 25px 30px; /* Reduje un poco el padding lateral para pantallas medianas */
    box-shadow: 0 4px 15px rgba(0, 32, 87, 0.03);
    
    /* ESTO EVITA EL DESBORDE */
    width: 260px; 
    flex-shrink: 0; /* Impide que el menú se aplaste o deforme */
    box-sizing: border-box; /* Asegura que el padding no sume ancho extra */
}

  /* PANEL ADMIN */

.admin-panel-section {
    background-color: var(--dark-blue);
    padding: 0px;
    min-height: calc(100vh - 160px);
}

.admin-panel-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--white);
    font-family: 'Inter', sans-serif;
}

/* --- SIDEBAR DE NAVEGACIÓN --- */
.paneladmin-sidebar {
    background-color: var(--dark-blue);
    border: 1px solid var(--light-gray);
    color: var(--white);
    border-radius: 0px;
    padding: 25px 30px; /* Reduje un poco el padding lateral para pantallas medianas */
    box-shadow: 0 4px 15px rgba(0, 32, 87, 0.03);    
    width: 260px; 
    flex-shrink: 0; /* Impide que el menú se aplaste o deforme */
    box-sizing: border-box; /* Asegura que el padding no sume ancho extra */
}

/* --- BOTÓN TOGGLE SIDEBAR (Oculto en Desktop) --- */
.sidebar-toggle-btn {
    display: none;
    width: 100%;
    padding: 12px 15px;
    background: transparent;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
}

/* --- REGLAS MÓVILES (Pantallas <= 991px) --- */
@media (max-width: 991px) {
    /* Ajuste del contenedor principal */
    .admin-panel-container {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 0 10px !important;
    }

    /* Ajuste del contenedor Sidebar */
    .paneladmin-sidebar {
        width: 100% !important;
        position: relative !important;
        top: 0 !important;
        padding: 12px 15px !important;
        border-radius: 12px !important;
        transition: all 0.3s ease;
    }

    /* Mostrar el botón desplegable en móvil */
    .sidebar-toggle-btn {
        display: flex !important;
    }

    /* Ocultar el contenido interno por defecto en móvil */
    .paneladmin-sidebar .sidebar-admin-header,
    .paneladmin-sidebar .sidebaradmin-nav {
        display: none !important;
    }

    /* Estado Desplegado (Cuando se activa con JS) */
    .paneladmin-sidebar.is-open .sidebar-admin-header {
        display: block !important;
        margin-top: 15px;
    }

    .paneladmin-sidebar.is-open .sidebaradmin-nav {
        display: flex !important;
        margin-top: 10px;
    }

    /* Ajustes para la tabla en dispositivos táctiles */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* --- BANNER DE BIENVENIDA --- */
.dashboard-banner {
    background-color: var(--dark-blue);
    color: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 32, 87, 0.05);
}

.dashboard-banner h2 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 700;
}

.dashboard-banner p {
    font-size: 14px;
    opacity: 0.85;
    line-height: 1.5;
}

/* --- REJILLA DE MÉTRICAS (3 columnas perfectas) --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Divide la fila en 3 partes idénticas */
    gap: 25px;
    width: 100%;
    align-items: stretch;                 /* Hace que todas midan lo mismo de alto */
}

.metric-card {
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 12px rgba(0, 32, 87, 0.02);
    box-sizing: border-box;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: var(--cyan);
}

.card-icon {
    width: 50px;
    height: 50px;
    background-color: var(--bg-light);
    color: var(--cyan);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.card-info h4 {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.card-info .metric-value {
    font-size: 22px;
    color: var(--dark-blue);
    font-weight: 700;
}

/* --- SECCIÓN DE LA TABLA RECIENTE --- */
.recent-activity-header {
    display: flex;
    justify-content: space-between; /* Empuja el título a la izquierda y el enlace a la derecha */
    align-items: center;           /* Los centra verticalmente para que queden en la misma línea perfecta */
    margin-bottom: 20px;           /* Separa esta barra de la tabla de abajo */
    width: 100%;
    background-color: var(--white);
}

.recent-activity-header h3 {
    font-size: 18px;
    color: var(--dark-blue);
    font-weight: 700;
    margin: 0;                     /* Quitamos el margen para que no desfase la alineación */
}

/* Estilos para el enlace del Historial Completo */
.view-all-link {
    font-size: 14px;
    color: var(--cyan);            /* Usa el color turquesa/cian de tu sitio */
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;                      /* Separa el texto de la pequeña flecha de icono */
    transition: color 0.3s ease;
}

/* Efecto al pasar el mouse por encima */
.view-all-link:hover {
    color: var(--dark-blue);       /* Cambia al azul oscuro de tu paleta al hacer hover */
}

/* Contenedor seguro para el scroll horizontal responsivo interno */
.table-responsive {
    width: 100%;
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
    background-color: var(--white);
}

.specs-table th {
    background-color: var(--white);
    color: var(--dark-blue);
    padding: 15px;
    font-weight: 600;
    border-bottom: 2px solid var(--light-gray);
}

.specs-table td {
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
    color: var(--dark-gray);
    vertical-align: middle;
}

/* Enlaces o formatos especiales en la tabla */
.token-plus { color: #2e7d32; font-weight: 600; }
.token-minus { color: var(--danger); font-weight: 600; }
.price-minus { color: var(--dark-gray); font-weight: 500; }

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-success {
    background-color: rgba(4, 217, 217, 0.1);
    color: #008b8b;
}

/* --- RESPONSIVIDAD PARA EL LADO DERECHO --- */
@media (max-width: 1100px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr); /* Pasa a 2 columnas en pantallas medianas */
    }
}

@media (max-width: 768px) {
    .panel-main-content {
        padding: 20px;
    }
    .metrics-grid {
        grid-template-columns: 1fr;           /* 1 sola columna en dispositivos móviles */
        gap: 15px;
    }
}

/*ADMIN*/

.sidebar-admin-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--bg-light);
    margin-bottom: 20px;
}

.admin-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: var(--white);
    color: var(--cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
}

.admin-info h4 {
    font-size: 16px;
    color: var(--white);
    font-weight: 700;
    line-height: 1.2;
}

.admin-info span {
    font-size: 12px;
    color: var(--light-gray);
}

.sidebaradmin-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebaradmin-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.sidebaradmin-nav-link i {
    font-size: 18px;
    color: var(--cyan);
    transition: color 0.25s ease;
}

.sidebaradmin-nav-link.active {
    background-color: var(--cyan);
    color: var(--dark-gray);
}

.sidebaradmin-nav-link:hover {
    background-color: var(--bg-light);
    color: var(--dark-gray);
}

.sidebaradmin-nav-link:hover i,
.sidebaradmin-nav-link.active i {
    color: var(--dark-gray);
}

.sidebaradmin-nav-link.logout {
    margin-top: 20px;
    border-top: 1px solid var(--bg-light);
    padding-top: 20px;
    color: var(--danger);
    background-color: #ffebee;
}

.sidebaradmin-nav-link.logout:hover {
    background-color: #ffebee;
    color: var(--danger);
}

/*USUARIO*/

.sidebar-user-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--bg-light);
    margin-bottom: 20px;
}

.user-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: var(--dark-blue);
    color: var(--cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
}

.user-info h4 {
    font-size: 16px;
    color: var(--dark-blue);
    font-weight: 700;
    line-height: 1.2;
}

.user-info span {
    font-size: 12px;
    color: #777;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-gray);
    transition: all 0.25s ease;
}

.sidebar-nav-link i {
    font-size: 18px;
    color: #888;
    transition: color 0.25s ease;
}

.sidebar-nav-link.active {
    background-color: var(--dark-blue);
    color: var(--white);
}

.sidebar-nav-link:hover {
    background-color: var(--bg-light);
    color: var(--dark-gray);
}

.sidebar-nav-link:hover i,
.sidebar-nav-link.active i {
    color: var(--cyan);
}

.sidebar-nav-link.logout {
    margin-top: 20px;
    border-top: 1px solid var(--bg-light);
    padding-top: 20px;
    color: var(--danger);
}

.sidebar-nav-link.logout:hover {
    background-color: #ffebee;
    color: var(--danger);
}

/* --- ÁREA DE CONTENIDO PRINCIPAL --- */
.panel-main-content {
    flex: 1;                   /* Ocupa dinámicamente todo el espacio restante a la derecha */
    min-width: 0;              /* ¡CRUCIAL! Rompe la rigidez de flexbox para evitar desbordes */
    padding: 40px 5% 40px 4%;  /* Genera un colchón de aire por todos los costados */
    background-color: var(--bg-light);
    display: flex;
    flex-direction: column;
    gap: 30px;                 /* Separa verticalmente el Banner, las Métricas y la Tabla */
    box-sizing: border-box;
}

.panel-banner-header {
    background: linear-gradient(135deg, var(--dark-blue) 0%, #003380 100%);
    border-radius: 0px;
    padding: 30px;
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0, 32, 87, 0.1);
}

.panel-banner-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--white);
}

.panel-banner-header p {
    font-size: 14px;
    color: #d1f7f7;
    margin-bottom: 0;
}

.btn-bio-action {
    background-color: var(--cyan);
    color: var(--dark-blue);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-bio-action:hover {
    background-color: var(--white);
    transform: translateY(-2px);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 0 5%;
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 80px;
}

.logo img { max-width: 200px; height: auto; display: block; }

.nav-links { display: flex; gap: 30px; height: 100%; align-items: center; }
.nav-links li { height: 100%; display: flex; align-items: center; }
.nav-links a { color: var(--dark-blue); font-weight: 600; font-size: 14px; transition: color 0.3s; }
.nav-links a:hover, .nav-links a.active { color: var(--cyan); }

/* Menú Desplegable */
.dropdown { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 0 0 5px 5px;
    padding: 10px 0;
    z-index: 1000;
    flex-direction: column;
}
.dropdown:hover .dropdown-menu { display: flex; }
.dropdown-menu li { height: auto; width: 100%; }
.dropdown-menu a { padding: 12px 20px; display: block; color: var(--dark-gray); font-weight: 400; }
.dropdown-menu a:hover { background-color: var(--bg-light); color: var(--cyan); }

/* Botones de Nav */
.nav-buttons { display: flex; height: 100%; }
.btn-ingresar {
    color: var(--cyan);
    height: 100%;
    padding: 0 30px;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    transition: background 0.3s;
}

.panel-wrapper { display: flex; gap: 40px; margin: 40px auto; align-items: flex-start; }
.panel-nav-aside { width: 250px; background: #fff; border: 1px solid var(--light-gray); border-radius: 12px; padding: 20px; flex-shrink: 0; }
.user-brief { text-align: center; border-bottom: 1px solid #eee; padding-bottom: 20px; margin-bottom: 20px; }
.user-avatar { width: 70px; height: 70px; border-radius: 50%; background: var(--dark-blue); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 10px auto; }
.admin-brief { text-align: center; border-bottom: 1px solid #eee; padding-bottom: 20px; margin-bottom: 20px; }
.admin-avatar { width: 70px; height: 70px; border-radius: 50%; color: var(--dark-blue); display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 10px auto; }
.panel-menu-list li a { display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: 8px; color: #555; font-weight: 500; transition: 0.3s; }
.panel-menu-list li a:hover, .panel-menu-list li a.active { background-color: var(--bg-light); color: var(--dark-blue); font-weight: 600; }
.panel-main-content { flex-grow: 1; }
.content-card { background: #fff; border: 1px solid var(--light-gray); border-radius: 12px; padding: 30px; display: none; }
.content-card.active { display: block; }
.order-history-item { border: 1px solid #eee; border-radius: 8px; padding: 20px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.data-table-container { background: var(--white); padding: 25px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.05); color: var(--dark-gray);}
@media (max-width: 768px) { .panel-wrapper { flex-direction: column; } .panel-nav-aside { width: 100%; } }
    
        .form-wrapper {
            max-width: 950px;
            margin: 0px;
            background: var(--white);
            border: 1px solid var(--light-gray);
            border-radius: 20px;
            padding: 40px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.02);
        }
        .form-header {
            margin-bottom: 30px;
            border-bottom: 2px solid var(--bg-light);
            padding-bottom: 15px;
        }
        .form-header h1 {
            font-size: 28px;
            color: var(--dark-blue);
            font-weight: 700;
        }
        .form-header p {
            color: #666;
            font-size: 14px;
            margin-top: 5px;
        }
        .form-group {
            margin-bottom: 22px;
        }
        .form-group label {
            display: block;
            font-size: 14px;
            font-weight: 600;
            color: var(--dark-gray);
            margin-bottom: 8px;
        }
        .form-group input[type="text"],
        .form-group input[type="url"],
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid var(--light-gray);
            border-radius: 10px;
            font-size: 15px;
            font-family: 'Inter', sans-serif;
            color: var(--dark-gray);
            background-color: var(--bg-light);
            transition: all 0.3s ease;
        }
        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: var(--cyan);
            background-color: var(--white);
            box-shadow: 0 0 0 3px rgba(4, 217, 217, 0.15);
        }
        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        .btn-submit {
            background-color: var(--dark-blue);
            color: var(--white);
            border: none;
            padding: 14px 30px;
            font-size: 16px;
            font-weight: 600;
            border-radius: 30px;
            cursor: pointer;
            width: 100%;
            transition: background-color 0.3s ease;
            margin-top: 10px;
        }
        .btn-submit:hover {
            background-color: #00163d;
        }
        @media (max-width: 768px) {
            .form-wrapper { padding: 25px; margin: 20px 15px; }
            .form-row { grid-template-columns: 1fr; gap: 0; }
        }


/* Efecto hover sutil para la tabla de inventario */
.fila-producto {
    transition: background-color 0.2s ease;
}
.fila-producto:hover {
    background-color: #f8fafc;
}

/* --- FILTROS DE TARJETAS EN INVENTARIO --- */
.filter-card {
    transition: all 0.3s ease;
}

.filter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 32, 87, 0.08);
}

/* Estado activo del filtro */
.filter-card.active-filter {
    border-color: var(--cyan);
    background-color: #f0fcfc; /* Un tono muy suave de cyan */
}

/* Asegura que el contenedor de la tabla sea flexible */
.data-table-container {
    width: 100%;
    overflow: hidden; /* Evita que la tabla empuje el layout */
    box-sizing: border-box;
}

/* Fuerza a la tabla a adaptarse al ancho disponible */
#tabla-inventario_wrapper {
    width: 100% !important;
    overflow-x: auto; /* Permite scroll horizontal solo si es necesario */
}

table#tabla-inventario {
    table-layout: fixed; /* Mantiene las columnas bajo control */
    width: 100% !important;
}

/* --- CORRECCIÓN PARA DATATABLES Y DESBORDAMIENTO --- */

/* 1. Asegura que el contenedor de la tabla no se expanda fuera de la pantalla */
.data-table-container {
    width: 100% !important;
    overflow-x: auto; /* Permite scroll horizontal solo si es necesario en móviles */
    box-sizing: border-box;
}

/* 2. Corrige el ancho de la tabla interna */
table#tabla-inventario {
    width: 100% !important;
    table-layout: auto; /* Deja que el navegador calcule el ancho de columnas */
    border-collapse: collapse;
}

/* 3. Limita los contenedores generados por DataTables */
div.dataTables_wrapper {
    width: 100% !important;
    padding: 0;
}

/* 4. Asegura que las celdas no rompan el layout */
table#tabla-inventario td, 
table#tabla-inventario th {
    white-space: nowrap; /* Evita que el texto se parta en varias líneas */
    padding: 12px 15px !important;
    text-align: left;
}

/* Contenedor del Modal (Fondo oscuro) */
#modal-editar-producto {
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0, 32, 87, 0.6); 
    z-index: 9999; /* Asegura que esté por encima de todo */
    
    /* ESTO ES LO QUE CENTRA EL CONTENIDO */
    display: flex; 
    justify-content: center; 
    align-items: center; 
    backdrop-filter: blur(4px);
}

/* Caja blanca interna */
#modal-editar-producto > div {
    background: var(--white); 
    padding: 30px; 
    border-radius: 15px; 
    width: 90%; 
    max-width: 500px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    margin: 0; /* Eliminamos cualquier margen externo */
}

/* Colores para los estados de inventario */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.status-en-stock { background: rgba(4, 217, 217, 0.15); color: #048d34 !important; }
.status-bajo { background: rgba(255, 152, 0, 0.15); color: #e65100 !important; }
.status-agotado { background: rgba(255, 59, 48, 0.15); color: #c62828 !important; }


/* --- ESTILOS PARA MODALES GENERALES --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 32, 87, 0.6); z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--white); padding: 30px; border-radius: 15px;
    width: 90%; max-width: 500px; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.modal-box h3 { color: var(--dark-blue); margin-bottom: 20px; font-size: 20px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 25px; }

.btn-cancelar { background: #e2e8f0; color: #475569; padding: 10px 20px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-guardar { background: var(--dark-blue); color: var(--white); padding: 10px 20px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }

/* --- BOTONES DE TABLA --- */
.action-btn-tbl {
    background: none; border: none; padding: 6px; border-radius: 6px; cursor: pointer; font-size: 14px; transition: 0.2s;
}
.action-btn-tbl.view-btn { color: var(--dark-blue); background: #f1f5f9; }
.action-btn-tbl.view-btn:hover { background: var(--dark-blue); color: white; }
.action-btn-tbl.edit-btn { color: var(--cyan); background: #e0fcfc; }
.action-btn-tbl.edit-btn:hover { background: var(--cyan); color: var(--dark-blue); }

