* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 20px;
}

.navbar-nav a {
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.navbar-nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-warning {
    background-color: #ffc107;
    color: black;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-inhabilitar {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-inhabilitar:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: white;
}

.btn-activar {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.btn-activar:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: white;
}

.btn-eliminar {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-eliminar:hover {
    background-color: #c82333;
    border-color: #bd2130;
    color: white;
}

.btn:hover {
    opacity: 0.9;
}

.form-group {
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
}

.alert {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.login-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #007bff;
}

.stat-label {
    color: #666;
    margin-top: 5px;
}

.ventas-form {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.venta-fila {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: end;
}

.horario-alerta {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .venta-fila {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
}

.badge-success { 
    background-color: #28a745; 
    color: white; 
}

.badge-danger { 
    background-color: #dc3545; 
    color: white; 
}

.badge-warning { 
    background-color: #ffc107; 
    color: black; 
}

.badge-primary { 
    background-color: #007bff; 
    color: white; 
}

.badge-secondary { 
    background-color: #6c757d; 
    color: white; 
}

.badge-info { 
    background-color: #17a2b8; 
    color: white; 
}

.badge-dark { 
    background-color: #343a40; 
    color: white; 
}

.badge-inhabilitado { 
    background-color: #6c757d; 
    color: white; 
}

.badge-inactivo { 
    background-color: #dc3545; 
    color: white; 
}

.badge-activo { 
    background-color: #28a745; 
    color: white; 
}

.text-muted { 
    color: #6c757d !important; 
    font-size: 12px;
}

/* ===== SIDEBAR BASE ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* Estado colapsado */
.sidebar.collapsed {
    width: 70px;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.container {
    margin-left: 250px;
    padding: 20px;
    width: calc(100% - 250px);
    min-height: 100vh;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.container.sidebar-collapsed {
    margin-left: 70px;
    width: calc(100% - 70px);
}

/* ===== BOTÓN TOGGLE ===== */
.sidebar-toggle {
    position: absolute;
    top: 15px;
    right: -15px;
    width: 30px;
    height: 30px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    display: flex !important; /* FORZAR VISIBILIDAD */
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1001;
}

.sidebar-toggle:hover {
    background: #f8f9fa;
    transform: scale(1.1);
}

.toggle-icon {
    font-size: 0.9em;
    transition: transform 0.3s ease;
}

/* ===== ESTRUCTURA DEL SIDEBAR ===== */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    position: relative;
}

.sidebar-brand {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.user-info-sidebar {
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.sidebar.collapsed .user-info-sidebar {
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin: 5px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
    border-left-color: white;
    font-weight: bold;
}

.nav-icon {
    margin-right: 15px;
    font-size: 1.2em;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    transition: margin-right 0.3s ease;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.nav-text {
    transition: all 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar.collapsed .logout-btn .nav-text {
    opacity: 0;
    width: 0;
}

/* ===== MEJORAS PARA MÓVIL ===== */
@media (max-width: 768px) {
    .container {
        margin-left: 70px !important;
        width: calc(100% - 70px) !important;
        padding: 15px;
    }
    
    .container.sidebar-collapsed {
        margin-left: 70px !important;
        width: calc(100% - 70px) !important;
    }
    
    /* Indicador de auto-colapso */
    .sidebar:not(.collapsed)::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 4px;
        background: linear-gradient(90deg, #4CAF50, #FFC107, #F44336);
        animation: collapseTimer 5s linear forwards;
        z-index: 1002;
    }
    
    @keyframes collapseTimer {
        0% {
            width: 100%;
            background: #4CAF50;
        }
        50% {
            width: 50%;
            background: #FFC107;
        }
        100% {
            width: 0%;
            background: #F44336;
        }
    }
}

/* ===== TOOLTIPS PARA DESKTOP ===== */
.sidebar.collapsed .sidebar-nav a {
    position: relative;
}

.sidebar.collapsed .sidebar-nav a::before {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1002;
    pointer-events: none;
    margin-left: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed .sidebar-nav a:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Ocultar tooltips en móvil */
@media (max-width: 768px) {
    .sidebar.collapsed .sidebar-nav a::before {
        display: none;
    }
}

/* ===== ESTILOS PARA USUARIOS INHABILITADOS ===== */

/* Estados de usuario en tablas */
.usuario-inhabilitado {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
}

.usuario-inactivo {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

.usuario-activo {
    background-color: white;
}

/* Estados de ventas con usuarios inhabilitados */
.venta-pareja-inhabilitada {
    background-color: #f8f9fa !important;
    border-left: 4px solid #6c757d !important;
}

.venta-compartida {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
}

.venta-propia {
    background-color: white;
}

.venta-recibida {
    background-color: #e7f3ff !important;
    border-left: 4px solid #007bff !important;
}

/* Badges para estados de usuario */
.user-status-badges {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.user-status-badge {
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
}

/* Estadísticas para usuarios inhabilitados */
.inhabilitado-stats {
    background-color: #f8f9fa;
    border-left: 4px solid #6c757d;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

.inhabilitado-stats h4 {
    color: #6c757d;
    margin: 0 0 5px 0;
    font-size: 14px;
}

.inhabilitado-stats p {
    margin: 2px 0;
    font-size: 12px;
    color: #495057;
}

/* Opciones para usuarios inhabilitados en formularios */
.usuario-inhabilitado-option {
    color: #6c757d;
    font-style: italic;
}

.usuario-inhabilitado-option::after {
    content: " (Inhabilitado)";
    font-size: 0.9em;
    color: #dc3545;
}

/* Mensajes informativos para usuarios inhabilitados */
.info-pareja-inhabilitada {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

.info-pareja {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 5px;
    font-size: 12px;
    color: #0066cc;
}

/* Progress bars */
.progress-bar {
    height: 20px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 5px 0;
}

.progress-fill {
    height: 100%;
    background-color: #28a745;
    transition: width 0.3s ease;
}

.progress-fill.warning {
    background-color: #ffc107;
}

.progress-fill.danger {
    background-color: #dc3545;
}

.stat-trend {
    font-size: 12px;
    margin-top: 5px;
}

.trend-up {
    color: #28a745;
}

.trend-down {
    color: #dc3545;
}

/* Quick actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.action-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.action-card:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.1);
    text-decoration: none;
    color: inherit;
}

.action-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Fecha y hora actual */
.fecha-hora-actual {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.fecha-hora-actual .fecha {
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 5px;
}

.fecha-hora-actual .hora {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Pestañas de administración */
.admin-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    overflow-x: auto;
    margin-bottom: 0;
}

.admin-tab {
    padding: 15px 25px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    min-width: 120px;
}

.admin-tab:hover {
    background: #e9ecef;
    color: #495057;
}

.admin-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: white;
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-badge {
    background: #007bff;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    margin-left: 5px;
    vertical-align: super;
}

.tab-badge-inhabilitados {
    background: #6c757d;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    margin-left: 5px;
    vertical-align: super;
}

/* Tarjetas de gestión */
.management-card {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.management-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,123,255,0.1);
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Mensajes informativos */
.warning-message {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    color: #856404;
}

.info-message {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    color: #0c5460;
}

/* Responsive mejorado */
@media (max-width: 768px) {
    .admin-tabs {
        flex-direction: column;
    }
    
    .admin-tab {
        min-width: auto;
        text-align: left;
        padding: 12px 15px;
    }
    
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .management-card form {
        grid-template-columns: 1fr !important;
    }
    
    .user-status-badges {
        flex-direction: column;
        align-items: center;
    }
}

/* Formularios inline en tablas */
.form-inline {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: nowrap;
}

/* Botones pequeños */
.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Botones de acción en tablas */
.table .btn-sm {
    min-width: 30px;
}

/* Modal para usuarios inhabilitados */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 400px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-ok {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 15px;
}

/* Tooltips básicos */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Iconos de estado */
.status-icon {
    margin-right: 5px;
    font-size: 1.1em;
}

.status-icon-success {
    color: #28a745;
}

.status-icon-warning {
    color: #ffc107;
}

.status-icon-danger {
    color: #dc3545;
}

.status-icon-secondary {
    color: #6c757d;
}

/* Estado de usuario en dashboard */
.user-status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.user-status-indicator.active {
    background-color: #28a745;
}

.user-status-indicator.inhabilitado {
    background-color: #6c757d;
}

.user-status-indicator.inactivo {
    background-color: #dc3545;
}

/* Formularios de ventas específicos */
.ventas-form-grid {
    display: grid;
    gap: 15px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

/* Selectores específicos para estados */
select[data-estado="inhabilitado"] {
    background-color: #f8f9fa;
    border-color: #6c757d;
    color: #6c757d;
}

select[data-estado="inhabilitado"] option {
    background-color: white;
    color: #333;
}

/* Clases de utilidad */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.ml-5 {
    margin-left: 5px;
}

.mr-5 {
    margin-right: 5px;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.gap-5 {
    gap: 5px;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-nowrap {
    flex-wrap: nowrap;
}

/* Estados de usuario en tooltips */
[data-estado="inhabilitado"] {
    cursor: help;
}

/* Ajustes para selectores de pareja */
.pareja-select option.usuario-inhabilitado-option {
    font-style: italic;
    color: #6c757d;
}

/* Contenedores flex para acciones */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Badges en tablas */
.table .badge {
    margin: 0 2px;
}

/* Mejoras para formularios de administración */
.form-control-sm {
    padding: 4px 8px;
    font-size: 12px;
    height: auto;
}

/* Ajustes para tablas responsivas */
@media (max-width: 768px) {
    .table {
        display: block;
        overflow-x: auto;
    }
    
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .venta-fila {
        grid-template-columns: 1fr;
    }
}

/* Animaciones suaves */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}