:root {
    --bg-page: var(--background);
    --card-bg: var(--surface);
    --surface: var(--surface);
    --primary-color: var(--primary);
    --primary-light: var(--primary-light);
    --primary-dark: var(--primary-dark);
    --success: var(--success);
    --warning: var(--warning);
    --danger: var(--danger);
    --info: var(--info);
    --text: var(--text-primary);
    --text-muted: var(--text-secondary);
    --text-light: var(--text-muted);
    --border: var(--border-color);
    --border-light: var(--border-light);
    --border-dark: var(--border-dark);
    --radius-sm: var(--radius-sm);
    --radius-md: var(--radius);
    --radius-lg: var(--radius-lg);
    --shadow-sm: var(--shadow-sm);
    --shadow-md: var(--shadow);
    --shadow-lg: var(--shadow-md);
}

.catalogo-page {
    background: var(--bg-page);
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    color: var(--text);
}

.catalogo-page .header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.catalogo-page .header-section h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.catalogo-page .header-section p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0 0;
}

.catalogo-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.catalogo-page .btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.catalogo-page .btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.catalogo-page .btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border-dark);
}

.catalogo-page .btn-secondary:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.catalogo-page .btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.catalogo-page .btn-ghost:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text);
}

.catalogo-page .btn-icon {
    padding: 0.45rem;
    aspect-ratio: 1;
    border-radius: 6px;
}

.catalogo-page .btn-danger-ghost {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    transition: all 0.15s;
}

.catalogo-page .btn-danger-ghost:hover {
    background: rgba(239,68,68,0.08);
}

.catalogo-page .btn-sm {
    font-size: 0.7rem;
    padding: 0.3rem 0.55rem;
}

.catalogo-page .toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    background: var(--card-bg);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.catalogo-page .toolbar .input-text,
.catalogo-page .toolbar .input-select {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

.catalogo-page .toolbar .input-text:focus,
.catalogo-page .toolbar .input-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(58,110,165,0.1);
}

.catalogo-page .toolbar .search-wrapper {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.catalogo-page .toolbar .search-wrapper input {
    width: 100%;
    padding-left: 2rem;
    box-sizing: border-box;
}

.catalogo-page .toolbar .search-wrapper i {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.85rem;
}

.catalogo-page .toolbar .toolbar-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.catalogo-page .table-container {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.catalogo-page .catalog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.catalogo-page .catalog-table thead {
    background: var(--primary-color);
}

.catalogo-page .catalog-table thead th {
    color: white;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.7rem 0.6rem;
    text-align: left;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.catalogo-page .catalog-table thead th:last-child {
    border-right: none;
}

.catalogo-page .catalog-table tbody td {
    padding: 0.6rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    line-height: 1.4;
}

.catalogo-page .catalog-table tbody tr:hover {
    background: rgba(30,58,95,0.02);
}

.catalogo-page .catalog-table tbody tr:last-child td {
    border-bottom: none;
}

.catalogo-page .catalog-table .cod-cell .cod-interno {
    font-weight: 600;
    font-size: 0.78rem;
}

.catalogo-page .catalog-table .cod-cell .cod-barra {
    color: var(--text-light);
    font-size: 0.68rem;
    font-family: 'Courier New', monospace;
}

.catalogo-page .catalog-table .prod-cell .prod-nombre {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--primary-dark);
}

.catalogo-page .catalog-table .prod-cell .prod-generico {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.catalogo-page .catalog-table .prod-cell .prod-funcion {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-style: italic;
    margin-top: 0.15rem;
}

.catalogo-page .catalog-table .prod-cell .prod-laboratorio {
    font-size: 0.7rem;
    color: var(--primary-light);
    font-weight: 500;
    margin-top: 0.15rem;
}

.catalogo-page .catalog-table .pres-cell {
    min-width: 100px;
}

.catalogo-page .catalog-table .pres-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0;
}

.catalogo-page .catalog-table .pres-item .pres-name {
    font-weight: 500;
    font-size: 0.72rem;
}

.catalogo-page .catalog-table .pres-item .pres-factor {
    font-size: 0.65rem;
    color: var(--text-light);
}

.catalogo-page .catalog-table .price-cell {
    min-width: 110px;
}

.catalogo-page .catalog-table .price-cell .price-costo {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.catalogo-page .catalog-table .price-cell .price-costo span {
    font-weight: 600;
    color: var(--text);
}

.catalogo-page .catalog-table .price-cell .price-venta {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--success);
}

.catalogo-page .catalog-table .price-cell .price-margen {
    font-size: 0.62rem;
    color: var(--text-light);
}

.catalogo-page .catalog-table .date-cell {
    font-size: 0.72rem;
}

.catalogo-page .catalog-table .date-cell .date-compra {
    color: var(--text);
}

.catalogo-page .catalog-table .date-cell .date-venc {
    color: var(--danger);
    font-weight: 500;
}

.catalogo-page .catalog-table .exento-cell {
    text-align: center;
}

.catalogo-page .catalog-table .exento-cell .check-mark {
    color: var(--success);
    font-size: 1rem;
}

.catalogo-page .catalog-table .exento-cell .check-none {
    color: var(--border-dark);
    font-size: 1rem;
}

.catalogo-page .catalog-table .action-cell {
    text-align: center;
    white-space: nowrap;
}

.catalogo-page .catalog-table .action-cell .btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: transparent;
}

.catalogo-page .catalog-table .action-cell .btn-action:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text);
}

.catalogo-page .catalog-table .action-cell .btn-action.edit:hover {
    background: rgba(59,130,246,0.1);
    color: var(--info);
}

.catalogo-page .catalog-table .action-cell .btn-action.delete:hover {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
}

.catalogo-page .catalog-table .lugares-subrow td {
    padding: 0.5rem 0.6rem 0.6rem 0.6rem;
    background: #F9F7F4;
    border-bottom: 1px solid var(--border-light);
}

.catalogo-page .catalog-table .lugares-subrow .lugares-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.catalogo-page .catalog-table .lugares-subrow .lugar-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.68rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.catalogo-page .catalog-table .lugares-subrow .lugar-badge:hover {
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.catalogo-page .catalog-table .lugares-subrow .lugar-badge.active {
    border-color: var(--primary-light);
    background: rgba(58,110,165,0.06);
    color: var(--primary-color);
    font-weight: 500;
}

.catalogo-page .catalog-table .lugares-subrow .lugar-badge i {
    font-size: 0.6rem;
    color: var(--primary-light);
}

.catalogo-page .pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 1rem;
    padding: 0.5rem 0;
}

.catalogo-page .pagination .page-btn {
    min-width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalogo-page .pagination .page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.catalogo-page .pagination .page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.catalogo-page .pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.catalogo-page .pagination .page-info {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0 0.35rem;
}

.catalogo-page .counter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    background: rgba(30,58,95,0.06);
    border-radius: 20px;
    font-size: 0.72rem;
    color: var(--primary-color);
    font-weight: 500;
    white-space: nowrap;
}

.catalogo-page .counter-badge i {
    color: var(--primary-light);
}

.catalogo-page .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.catalogo-page .empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--border-dark);
}

.catalogo-page .empty-state p {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.catalogo-page .empty-state small {
    font-size: 0.78rem;
}

.catalogo-page .loading-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.catalogo-page .loading-state i {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary-light);
}

.catalogo-page .loading-state p {
    font-size: 0.85rem;
}

.catalogo-page .toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
}

.catalogo-page .toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastSlide 0.3s ease-out;
    color: white;
}

.catalogo-page .toast-success { background: var(--success); }
.catalogo-page .toast-error { background: var(--danger); }
.catalogo-page .toast-info { background: var(--info); }
.catalogo-page .toast-warning { background: var(--warning); }

.catalogo-page .toast.toast-out {
    animation: toastFade 0.3s ease-out forwards;
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

@media (max-width: 1024px) {
    .catalogo-page .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .catalogo-page .toolbar .search-wrapper {
        min-width: unset;
    }
}

@media (max-width: 768px) {
    .catalogo-page .header-section {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    .catalogo-page .catalog-table {
        font-size: 0.72rem;
    }
}
