/* Estilos específicos para la página de productos */

/* Contenedor principal */
.content-container {
    padding: 2rem;
    max-width: 100%;
    overflow-x: hidden;
}

/* Tarjeta de filtros */
.filters-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group input[type="text"],
.filter-group select {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background: white;
}

.filter-group input[type="text"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.filter-group .btn-primary {
    padding: 0.75rem 2rem;
    white-space: nowrap;
}

/* Tabla de productos */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table thead {
    background: var(--light);
    border-bottom: 2px solid var(--gray-light);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-dark);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table th:first-child {
    width: 50px;
    text-align: center;
}

.data-table th:last-child {
    width: 150px;
    text-align: center;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-light);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: all 0.3s;
}

.data-table tbody tr:hover {
    background: rgba(67, 97, 238, 0.03);
}

/* Celdas específicas */
.data-table td:first-child {
    text-align: center;
}

.data-table td:last-child {
    text-align: center;
}

/* Checkbox de selección */
.data-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Celda de producto */
.product-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 250px;
}

.product-image-small {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.product-image-small img {
    width: fit-content;
    height: 100%;
    object-fit: cover;
}

.product-image-small i {
    font-size: 1.5rem;
    color: var(--gray);
}

.product-info-small {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--dark);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-description {
    font-size: 0.85rem;
    color: var(--gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Badges */
.product-category-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-category-badge[data-category="fundas"] {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

.product-category-badge[data-category="celulares"] {
    background: rgba(114, 9, 183, 0.1);
    color: var(--secondary);
}

.product-category-badge[data-category="cargadores"] {
    background: rgba(76, 201, 240, 0.1);
    color: var(--success);
}

.product-category-badge[data-category="audifonos"] {
    background: rgba(247, 37, 133, 0.1);
    color: var(--danger);
}

/* Stock badges */
.stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stock-badge.low-stock {
    background: rgba(247, 37, 133, 0.1);
    color: var(--danger);
}

.stock-badge.medium-stock {
    background: rgba(248, 150, 30, 0.1);
    color: var(--warning);
}

.stock-badge.good-stock {
    background: rgba(67, 170, 139, 0.1);
    color: #43aa8b;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 80px;
}

.status-badge.active {
    background: rgba(67, 170, 139, 0.1);
    color: #43aa8b;
}

.status-badge.inactive {
    background: rgba(108, 117, 125, 0.1);
    color: var(--gray);
}

/* Acciones */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-icon {
    background: var(--light);
    border: 1px solid var(--gray-light);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--gray);
}

.btn-icon:hover {
    background: var(--gray-light);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.btn-icon.edit {
    color: var(--primary);
}

.btn-icon.toggle {
    color: var(--warning);
}

.btn-icon.delete {
    color: var(--danger);
    border-color: rgba(247, 37, 133, 0.3);
}

.btn-icon.delete:hover {
    background: rgba(247, 37, 133, 0.1);
}

.btn-icon i {
    font-size: 0.9rem;
}

/* Pie de tabla */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-light);
}

.table-info {
    font-size: 0.9rem;
    color: var(--gray);
}

/* Paginación */
.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-light);
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-dots {
    padding: 0.5rem;
    color: var(--gray);
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--dark);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-close:hover {
    background: var(--gray-light);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Formulario de producto */
#productForm {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Subida de imágenes */
.image-upload-area {
    border: 2px dashed var(--gray-light);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.image-upload-area:hover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.05);
}

.image-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
}

.upload-placeholder {
    pointer-events: none;
}

.upload-placeholder i {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

.upload-placeholder p {
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--gray-light);
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--gray-light);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.preview-item:hover .remove-image {
    opacity: 1;
}

/* Mensajes vacíos */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: var(--gray-light);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-dark);
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Botones de acción masiva */
.bulk-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: var(--light);
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}

.bulk-actions.visible {
    display: flex;
}

.bulk-selected {
    font-weight: 600;
    color: var(--dark);
}

.bulk-buttons {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.btn-bulk {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--gray-light);
    background: white;
}

.btn-bulk:hover {
    background: var(--gray-light);
}

.btn-bulk.delete {
    color: var(--danger);
    border-color: rgba(247, 37, 133, 0.3);
}

.btn-bulk.delete:hover {
    background: rgba(247, 37, 133, 0.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .content-container {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content-container {
        padding: 1rem;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group input[type="text"],
    .filter-group select,
    .filter-group .btn-primary {
        width: 100%;
        min-width: unset;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 700px;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.25rem;
    }
}

@media (max-width: 576px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        height: auto;
        padding: 1rem;
    }
    
    .header-right {
        width: 100%;
    }
    
    .btn-add {
        width: 100%;
        justify-content: center;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .table-actions {
        width: 100%;
    }
    
    .table-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .action-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .bulk-buttons {
        margin-left: 0;
        justify-content: center;
    }
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.data-table tbody tr {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

.data-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.25s; }

/* Scroll personalizado */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}

/* Estados de carga */
.loading-row {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}

.loading-row i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Mensajes de error/éxito */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message.success {
    background: rgba(67, 170, 139, 0.1);
    color: #43aa8b;
    border-left: 4px solid #43aa8b;
}

.message.error {
    background: rgba(247, 37, 133, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.message.warning {
    background: rgba(248, 150, 30, 0.1);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.message i {
    font-size: 1.2rem;
}