/* Sistema de Inventario - Estilos Globales */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
}

/* Contenedor principal */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

/* Mobile: Sidebar oculto por defecto */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Overlay oscuro cuando el menú está abierto */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    
    body.menu-open::before {
        display: block;
    }
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 22px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-menu a.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left: 4px solid #3498db;
}

.sidebar-menu a i {
    margin-right: 10px;
    font-size: 18px;
}

/* Contenido principal */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
    width: calc(100% - 260px);
}

/* Mobile: contenido ocupa todo el ancho */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 10px;
    }
}

/* Header */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    color: #2c3e50;
    font-size: 26px;
}

/* Botón hamburguesa para móvil */
.menu-toggle {
    display: none;
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .header {
        padding: 15px;
        margin-top: 60px;
    }
    
    .header h1 {
        font-size: 20px;
    }
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.user-info span {
    color: #666;
}

@media (max-width: 768px) {
    .user-info {
        font-size: 14px;
    }
    
    .user-info span {
        display: none;
    }
}

.btn-logout {
    padding: 8px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c0392b;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-header h3 {
    color: #2c3e50;
    font-size: 16px;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.card-value {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

.card-label {
    color: #7f8c8d;
    font-size: 14px;
    margin-top: 5px;
}

/* Colores para cards */
.card-primary { background: #3498db; color: white; }
.card-success { background: #2ecc71; color: white; }
.card-warning { background: #f39c12; color: white; }
.card-danger { background: #e74c3c; color: white; }

/* Tablas */
.table-container {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow-x: auto;
}

@media (max-width: 768px) {
    .table-container {
        padding: 15px;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

@media (max-width: 768px) {
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px 6px;
    }
}

thead {
    background: #f8f9fa;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

tr:hover {
    background: #f8f9fa;
}

/* Botones */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

/* Formularios */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

/* Alertas */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* Responsive */
@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    .form-control {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    /* Botones de acción en tablas */
    .btn-sm {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    /* Ocultar columnas menos importantes en móvil */
    .hide-mobile {
        display: none;
    }
}
/* Importar estilos responsive */
@import url('responsive.css');

/* Agrega estas clases al final del archivo */

/* Estilos para información diferenciada por rol */
.admin-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin: 12px 0;
}

.admin-info .precio-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
}

.admin-info strong {
    color: white;
}

.vendedor-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    border: 1px solid #e0e0e0;
}

.vendedor-info .precio-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
}

/* Badge de margen */
.margen-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.margen-alto { 
    background: #27ae60;
    box-shadow: 0 2px 5px rgba(39, 174, 96, 0.3);
}

.margen-medio { 
    background: #f39c12;
    box-shadow: 0 2px 5px rgba(243, 156, 18, 0.3);
}

.margen-bajo { 
    background: #e74c3c;
    box-shadow: 0 2px 5px rgba(231, 76, 60, 0.3);
}

/* Agrega al inicio del archivo o donde prefieras */

/* Estilos responsivos base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f7fa;
}

/* Contenedor principal */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar para desktop */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

/* Contenido principal */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
    width: calc(100% - 250px);
}

/* Header */
.header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Grid de cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Tablas responsivas */
.table-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow-x: auto;
}

/* Media Queries para móvil */
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }
    
    .header {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .user-info {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .productos-grid {
        grid-template-columns: 1fr;
    }
    
    /* Ajustes para formularios en móvil */
    .form-group {
        margin-bottom: 15px;
    }
    
    input, select, textarea, button {
        font-size: 16px !important; /* Evita zoom en iOS */
    }
    
    /* Tablas en móvil */
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px 10px;
        min-width: 100px;
    }
    
    /* Botones en móvil */
    .btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .btn-sm {
        padding: 8px 15px;
        font-size: 14px;
    }
}

/* Para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
        width: calc(100% - 220px);
    }
    
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .productos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Estilos para el menú móvil */
#mobile-menu-toggle:active {
    transform: scale(0.95);
}

#mobile-menu ul li a:hover {
    background: #3498db;
    color: white !important;
}

/* Asegurar que el contenido no se desplace con el menú abierto */
body.menu-open {
    overflow: hidden;
}

/* Estilos para información diferenciada por rol (que ya tenías) */
.admin-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin: 12px 0;
}

.vendedor-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    border: 1px solid #e0e0e0;
}

/* ===== CORRECCIÓN DE SIDEBAR Y CONTENIDO ===== */

/* Sidebar - posición y z-index CORREGIDO */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px 0;
    position: fixed; /* Se mantiene fixed */
    height: 100vh;
    overflow-y: auto;
    z-index: 100; /* REDUCIDO de 1000 a 100 */
    transition: transform 0.3s ease;
    left: 0;
    top: 0;
}

/* Contenido principal - margen CORREGIDO */
.main-content {
    flex: 1;
    margin-left: 260px; /* MARGEN para el sidebar */
    padding: 20px;
    width: calc(100% - 260px);
    position: relative;
    z-index: 1; /* DEBAJO del sidebar */
    background: #f5f7fa; /* Fondo para cubrir */
    min-height: 100vh;
}

/* En móvil, el contenido ocupa todo el ancho */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000; /* ALTO solo en móvil cuando está abierto */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
        margin-top: 0; /* Asegurar que no tenga margen superior */
    }
    
    /* Botón hamburguesa */
    .menu-toggle {
        display: block !important;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1001; /* Encima del sidebar */
        background: #3498db;
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 5px;
        cursor: pointer;
        font-size: 16px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    }
    
    /* Overlay para móvil */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999; /* Debajo del sidebar, encima del contenido */
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}
/* Asegurar que los contenedores internos tengan posición correcta */
.table-container,
.cards-grid,
.header,
.productos-grid {
    position: relative;
    z-index: 1;
}

/* Fondo del wrapper */
.wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    background: #f5f7fa;
}

/* Asegurar que el contenido esté detrás del sidebar en desktop */
@media (min-width: 769px) {
    .main-content {
        z-index: 1;
    }
    
    .sidebar {
        z-index: 2; /* Solo ligeramente encima */
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
}