/* Estilos para el Dashboard de Administrador */

/* Header de Administrador */
.admin-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 0.5rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.admin-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0 1rem;
}

.admin-header .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.admin-header .logo h1 {
    color: #e74c3c;
    margin: 0;
    font-size: 1.4rem;
}

.admin-header .logo .brand-logo-admin {
    display: block;
    height: 43px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

.admin-badge {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.admin-nav {
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar {
    display: none;
}

.admin-nav ul {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.user-info {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.user-role {
    display: block;
    font-size: 0.7rem;
    opacity: 0.7;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-profile,
.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-profile:hover {
    background: rgba(52, 152, 219, 0.8);
}

.btn-logout:hover {
    background: rgba(231, 76, 60, 0.8);
}

/* Contenido Principal */
.admin-main {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
    background: #f8f9fa;
}

.admin-section {
    display: none;
    padding: 2rem 0;
}

.admin-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin: 0;
}

.section-actions {
    display: flex;
    gap: 1rem;
}

/* Estadísticas del Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.stat-card:nth-child(1) {
    border-left-color: #3498db;
}

.stat-card:nth-child(2) {
    border-left-color: #27ae60;
}

.stat-card:nth-child(3) {
    border-left-color: #f39c12;
}

.stat-card:nth-child(4) {
    border-left-color: #e74c3c;
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-content h3 {
    color: #2c3e50;
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
}

.stat-change {
    font-size: 0.8rem;
    font-weight: 500;
}

.stat-change.positive {
    color: #27ae60;
}

.stat-change.negative {
    color: #e74c3c;
}

.stat-change.neutral {
    color: #95a5a6;
}

/* Dashboard Content */
.dashboard-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.chart-container,
.recent-activity {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.chart-container h3,
.recent-activity h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.chart-placeholder {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: #666;
    border: 2px dashed #dee2e6;
}

.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f2f6;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.activity-icon.order {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.activity-icon.user {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.activity-icon.alert {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.activity-content {
    flex: 1;
}

.activity-content p {
    margin: 0 0 0.2rem 0;
    color: #2c3e50;
    font-weight: 500;
}

.activity-time {
    font-size: 0.8rem;
    color: #666;
}

/* Filtros */
.filters-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    display: flex;
    gap: 1.5rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.filter-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
    padding: 0.8rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #3498db;
}

/* Tablas */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 1.2rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f2f6;
    color: #2c3e50;
}

.admin-table tbody tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.pending {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.status-badge.processing {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.status-badge.completed {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.status-badge.cancelled {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-table {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
}

.btn-print {
    background: rgba(142, 68, 173, 0.1);
    color: #8e44ad;
    min-width: 36px;
}

.btn-view {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.btn-edit {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.btn-delete {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.btn-table:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Inventario */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.inventory-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s;
}

.inventory-card:hover {
    transform: translateY(-4px);
}

.inventory-card h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f1f2f6;
}

.stock-item:last-child {
    border-bottom: none;
}

.stock-count {
    font-weight: 600;
    color: #27ae60;
}

.stock-count.low-stock {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

/* Reportes */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.report-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s;
}

.report-card:hover {
    transform: translateY(-4px);
}

.report-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.report-card p {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }

    .admin-nav ul {
        flex-wrap: wrap;
    }

    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .admin-header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .admin-nav ul {
        justify-content: center;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .section-actions {
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .user-menu {
        order: -1;
    }

    .admin-main {
        margin-top: 140px;
    }
}

@media (max-width: 480px) {
    .admin-main {
        margin-top: 180px;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .table-container {
        overflow-x: auto;
    }

    .admin-table {
        min-width: 600px;
    }
}

/* ===== GESTIÓN DE CLIENTES B2B ===== */

/* Pestañas */
.tabs-container {
    margin-bottom: 2rem;
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #495057;
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background-color: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Resumen de Clientes */
.clients-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.summary-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 50%;
    color: white;
}

.summary-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.summary-number {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Tabla de Clientes */
.clients-table {
    width: 100%;
}

.clients-table th {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 1rem 0.75rem;
    border: none;
}

.clients-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.clients-table tr:hover {
    background-color: #f8f9fa;
}

/* Estados de Cliente */
.client-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.client-status.active {
    background-color: #d4edda;
    color: #155724;
}

.client-status.warning {
    background-color: #fff3cd;
    color: #856404;
}

.client-status.inactive {
    background-color: #f8d7da;
    color: #721c24;
}

/* Indicadores de Crédito */
.credit-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.credit-bar {
    width: 60px;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.credit-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.credit-fill.low {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.credit-fill.medium {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.credit-fill.high {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.credit-percentage {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 35px;
}

.credit-percentage.low {
    color: #27ae60;
}

.credit-percentage.medium {
    color: #f39c12;
}

.credit-percentage.high {
    color: #e74c3c;
}

/* Información de Cliente */
.client-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.client-name {
    font-weight: 600;
    color: #2c3e50;
}

.client-rut {
    font-size: 0.8rem;
    color: #6c757d;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.contact-name {
    font-weight: 500;
    color: #2c3e50;
}

.contact-email {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Métricas de Cliente */
.client-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    color: #6c757d;
}

.metric-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Días desde último pedido */
.days-since-order {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
}

.days-since-order.recent {
    background-color: #d4edda;
    color: #155724;
}

.days-since-order.moderate {
    background-color: #fff3cd;
    color: #856404;
}

.days-since-order.old {
    background-color: #f8d7da;
    color: #721c24;
}

/* Botones de acción específicos para clientes */
.client-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-client-view {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-client-view:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.btn-client-edit {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-client-edit:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.btn-client-credit {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-client-credit:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
}

/* Responsive para clientes */
@media (max-width: 768px) {
    .clients-summary {
        grid-template-columns: 1fr;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .clients-table {
        font-size: 0.8rem;
    }

    .clients-table th,
    .clients-table td {
        padding: 0.5rem 0.25rem;
    }

    .client-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Animaciones */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    animation: slideInUp 0.3s ease-out;
}

.summary-card {
    animation: slideInUp 0.3s ease-out;
}

.summary-card:nth-child(2) {
    animation-delay: 0.1s;
}

.summary-card:nth-child(3) {
    animation-delay: 0.2s;
}

.summary-card:nth-child(4) {
    animation-delay: 0.3s;
}

/* ===== INVENTORY MANAGEMENT STYLES ===== */

.inventory-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 120px;
}

.filter-group input[type="text"] {
    min-width: 200px;
}

.inventory-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-weight: 500;
    opacity: 0.9;
}

.stat-value {
    font-weight: 700;
    font-size: 1.2rem;
}

.stat-value.warning {
    color: #ffd700;
    animation: pulse 2s infinite;
}

.inventory-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.inventory-grouped-container {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    margin-bottom: 2rem;
}

.inventory-type-block {
    margin-bottom: 1.5rem;
}

.inventory-type-block h3 {
    margin: 0 0 0.75rem;
    color: #1e293b;
    font-size: 1.1rem;
}

.inventory-subtable-wrap {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.8rem;
    overflow: hidden;
}

.inventory-subtables-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
}

.inventory-subtable-wrap h4 {
    margin: 0;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    color: #0f172a;
    font-size: 0.92rem;
}

.inventory-subtable {
    width: 100%;
    border-collapse: collapse;
}

.inventory-subtable th,
.inventory-subtable td {
    padding: 0.5rem 0.65rem;
    border-top: 1px solid #e2e8f0;
    text-align: left;
}

.inventory-subtable th {
    background: #1f2937;
    color: white;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.inventory-subtable tbody tr.low-stock {
    background: #fff7ed;
}

.inventory-subtable tbody tr.no-stock {
    background: #f8fafc;
}

.inventory-type-empty {
    color: #64748b;
    margin: 0;
    padding: 0.6rem 0.2rem;
}

@media (max-width: 1200px) {
    .inventory-subtables-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .inventory-subtables-grid {
        grid-template-columns: 1fr;
    }
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
}

.inventory-table th {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #34495e;
}

.inventory-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
}

.inventory-table tbody tr:hover {
    background: #f8f9fa;
}

.inventory-table tbody tr.low-stock {
    background: #fff5f5;
    border-left: 4px solid #e74c3c;
}

.inventory-table tbody tr.no-stock {
    background: #f8f8f8;
    color: #7f8c8d;
    border-left: 4px solid #95a5a6;
}

.stock-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    min-width: 60px;
}

.stock-badge.high {
    background: #d5f4e6;
    color: #27ae60;
}

.stock-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.stock-badge.low {
    background: #f8d7da;
    color: #721c24;
    animation: pulse 2s infinite;
}

.stock-badge.zero {
    background: #e2e3e5;
    color: #6c757d;
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.category-badge.monofocal {
    background: #e3f2fd;
    color: #1976d2;
}

.category-badge.multifocal {
    background: #fff3e0;
    color: #f57c00;
}

.category-badge.bifocal {
    background: #f3e5f5;
    color: #7b1fa2;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #3498db;
    color: white;
}

.btn-edit:hover {
    background: #2980b9;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #7f8c8d;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ecf0f1;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.btn-page {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-page:hover:not(:disabled) {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-weight: 600;
    color: #2c3e50;
}

.empty-message {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .inventory-filters {
        flex-direction: column;
    }

    .inventory-stats {
        grid-template-columns: 1fr;
    }

    .inventory-table-container {
        overflow-x: auto;
    }

    .inventory-table {
        min-width: 800px;
    }
}

/* Estilos adicionales para inventario */
.product-code {
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #495057;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.product-info strong {
    color: #2c3e50;
    font-size: 0.9rem;
}

.product-info small {
    color: #7f8c8d;
    font-size: 0.75rem;
    text-transform: capitalize;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d5f4e6;
    color: #27ae60;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Equipo por óptica — tabla usuarios admin */
.user-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.user-pill--admin {
    background: #1e3a5f;
    color: #fff;
}

.user-pill--jefe {
    background: #0d9488;
    color: #fff;
}

.user-pill--encargado {
    background: #16a34a;
    color: #fff;
}

.user-pill--optica {
    background: #e2e8f0;
    color: #334155;
}

.user-pill--other {
    background: #f1f5f9;
    color: #64748b;
}

tr.user-row--admin td:first-child {
    box-shadow: inset 3px 0 0 #1e3a5f;
}

tr.user-row--jefe td:first-child {
    box-shadow: inset 3px 0 0 #0d9488;
}

tr.user-row--encargado td:first-child {
    box-shadow: inset 3px 0 0 #16a34a;
}

tr.user-row--optica td:first-child {
    box-shadow: inset 3px 0 0 #94a3b8;
}

tr.user-row--other td:first-child {
    box-shadow: inset 3px 0 0 #cbd5e1;
}

.optica-staff-block {
    margin-bottom: 1.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.optica-staff-block .optica-staff-head {
    background: linear-gradient(90deg, #1e3a5f, #2c5282);
    color: #fff;
    padding: 0.85rem 1.25rem;
}

.optica-staff-block .optica-staff-head-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
}

.optica-staff-block .optica-staff-head-text {
    flex: 1;
    min-width: 12rem;
}

.optica-staff-block .optica-staff-head-actions {
    flex-shrink: 0;
}

.optica-staff-block .optica-staff-head-actions .optica-staff-add-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #1e3a5f;
    border: none;
    padding: 0.45rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.optica-staff-block .optica-staff-head-actions .optica-staff-add-btn:hover {
    background: #fff;
    filter: brightness(1.02);
}

.optica-staff-block .optica-staff-head--admin .optica-staff-head-actions .optica-staff-add-btn {
    color: #0f172a;
}

.optica-staff-block .optica-staff-head--warn .optica-staff-head-actions .optica-staff-add-btn {
    color: #7c2d12;
}

.optica-staff-block .optica-staff-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.optica-staff-block .optica-staff-head p {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    opacity: 0.92;
    line-height: 1.35;
}

.optica-staff-block .optica-staff-head--admin {
    background: linear-gradient(90deg, #0f172a, #334155);
}

.optica-staff-block .optica-staff-head--warn {
    background: linear-gradient(90deg, #9a3412, #c2410c);
}

.optica-staff-block table.admin-table {
    margin: 0;
}

.btn-warning {
    background: #f39c12;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-warning:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

/* Mejoras responsivas */
@media (max-width: 1200px) {

    .inventory-table th:nth-child(5),
    .inventory-table td:nth-child(5),
    .inventory-table th:nth-child(6),
    .inventory-table td:nth-child(6) {
        display: none;
    }
}

@media (max-width: 992px) {

    .inventory-table th:nth-child(4),
    .inventory-table td:nth-child(4),
    .inventory-table th:nth-child(9),
    .inventory-table td:nth-child(9) {
        display: none;
    }
}

@media (max-width: 768px) {

    .inventory-table th:nth-child(1),
    .inventory-table td:nth-child(1) {
        display: none;
    }

    .product-actions {
        flex-direction: column;
        gap: 0.25rem;
    }

    .btn-action {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* ===== ORDERS MANAGEMENT STYLES ===== */

.orders-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.orders-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.orders-stats .stat-label {
    font-weight: 500;
    opacity: 0.9;
}

.orders-stats .stat-value {
    font-weight: 700;
    font-size: 1.2rem;
}

.orders-stats .stat-value.warning {
    color: #ffd700;
    animation: pulse 2s infinite;
}

.orders-stats .stat-value.info {
    color: #87ceeb;
}

.orders-stats .stat-value.success {
    color: #90ee90;
}

.orders-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.orders-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
}

.orders-table th {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #34495e;
}

.orders-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
}

.orders-table tbody tr:hover {
    background: #f8f9fa;
}

.order-id {
    font-family: 'Courier New', monospace;
    background: #e3f2fd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #1976d2;
    font-weight: 600;
}

.client-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.client-name {
    font-weight: 600;
    color: #2c3e50;
}

.client-id {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.patient-name {
    font-weight: 500;
    color: #34495e;
}

.order-date {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-main {
    font-weight: 500;
    color: #2c3e50;
}

.date-time {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.crystals-summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.crystals-count {
    font-weight: 600;
    color: #27ae60;
}

.crystals-types {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.order-total {
    font-weight: 700;
    font-size: 1.1rem;
    color: #27ae60;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    min-width: 80px;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.processing {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #74b9ff;
}

.status-badge.completed {
    background: #d5f4e6;
    color: #155724;
    border: 1px solid #00b894;
}

.status-badge.cancelled {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #d63031;
}

.order-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-order-action {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-view {
    background: #3498db;
    color: white;
}

.btn-view:hover {
    background: #2980b9;
}

.btn-edit-status {
    background: #f39c12;
    color: white;
}

.btn-edit-status:hover {
    background: #e67e22;
}

.btn-cancel {
    background: #e74c3c;
    color: white;
}

.btn-cancel:hover {
    background: #c0392b;
}

.btn-complete {
    background: #27ae60;
    color: white;
}

.btn-complete:hover {
    background: #229954;
}

/* Responsive Design para Orders */
@media (max-width: 1200px) {

    .orders-table th:nth-child(3),
    .orders-table td:nth-child(3) {
        display: none;
    }
}

@media (max-width: 992px) {

    .orders-table th:nth-child(4),
    .orders-table td:nth-child(4) {
        display: none;
    }

    .orders-filters {
        flex-direction: column;
    }
}

@media (max-width: 768px) {

    .orders-table th:nth-child(5),
    .orders-table td:nth-child(5) {
        display: none;
    }

    .order-actions {
        flex-direction: column;
        gap: 0.25rem;
    }

    .btn-order-action {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    .orders-stats {
        grid-template-columns: 1fr;
    }
}

/* Sobrescribir estilos minimalistas para el admin */
.admin-header,
.admin-header *,
.admin-content,
.admin-content *,
.stats-grid,
.stats-grid *,
.stat-card,
.stat-card *,
.section-content,
.section-content *,
.data-table,
.data-table *,
.form-group,
.form-group *,
.btn-primary,
.btn-secondary,
.btn-danger,
.modal-content,
.modal-content * {
    border-radius: 8px !important;
}

/* Restaurar colores para el admin */
.admin-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
}

.admin-badge {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}

.nav-link.active {
    background: rgba(231, 76, 60, 0.2) !important;
    color: #e74c3c !important;
}

.stat-card {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.stat-card.revenue {
    border-left: 4px solid #27ae60 !important;
}

.stat-card.orders {
    border-left: 4px solid #3498db !important;
}

.stat-card.clients {
    border-left: 4px solid #9b59b6 !important;
}

.stat-card.inventory {
    border-left: 4px solid #f39c12 !important;
}

.stat-value {
    color: #2c3e50 !important;
}

.stat-label {
    color: #7f8c8d !important;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    color: white !important;
    border: none !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #21618c) !important;
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d) !important;
    color: white !important;
    border: none !important;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    color: white !important;
    border: none !important;
}

.data-table {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
}

.data-table th {
    background: #f8f9fa !important;
    color: #2c3e50 !important;
    border-bottom: 2px solid #e0e0e0 !important;
}

.data-table td {
    border-bottom: 1px solid #e0e0e0 !important;
}

.status-badge.pending {
    background: #f39c12 !important;
    color: white !important;
}

.status-badge.completed {
    background: #27ae60 !important;
    color: white !important;
}

.status-badge.cancelled {
    background: #e74c3c !important;
    color: white !important;
}

.form-group input,
.form-group select,
.form-group textarea {
    border: 2px solid #e0e0e0 !important;
    background: white !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #3498db !important;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1) !important;
}

.modal-content {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.modal-header {
    background: #f8f9fa !important;
    border-bottom: 1px solid #e0e0e0 !important;
}

/* Asegurar que el body del admin tenga fondo blanco */
body {
    background: #f5f6fa !important;
}

.admin-content {
    background: #f5f6fa !important;
}

.section-content {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Forzar color de texto en tablas del admin */
.admin-section table td,
.admin-section table tbody tr,
.admin-section table tbody td,
.admin-card-table td,
#empresas-tbody td,
#sucursales-tbody td,
#pagos-tbody td,
#users-grouped-container .admin-table td {
    color: #1a1a1a !important;
    background: white !important;
}