/* Tables styling */
.table-responsive {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-on-accent);
}

.data-table th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

.data-table th:hover {
    background: rgba(255,255,255,0.1);
    cursor: pointer;
}

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

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

.data-table tbody tr:hover {
    background-color: var(--primary-soft);
    transform: scale(1.01);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table actions */
.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.table-actions button {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 15px;
    min-width: auto;
}

/* Table sorting */
.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable::after {
    content: " ⇅";
    opacity: 0.5;
    margin-left: 0.5rem;
}

.sortable.sort-asc::after {
    content: " ↑";
    opacity: 1;
    color: var(--text-on-accent);
}

.sortable.sort-desc::after {
    content: " ↓";
    opacity: 1;
    color: var(--text-on-accent);
}

/* Table pagination */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.pagination-btn {
    background: var(--surface);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary);
    color: var(--text-on-accent);
}

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

.pagination-btn.active {
    background: var(--primary);
    color: var(--text-on-accent);
}

/* Table filters */
.table-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.9rem;
}

/* Table empty state */
.table-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.table-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.table-empty h3 {
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

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

/* Status indicators in tables */
.status-active {
    background: var(--success);
    color: var(--text-on-success);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-inactive {
    background: var(--danger);
    color: var(--text-on-danger);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-pending {
    background: var(--warning);
    color: var(--text-on-warning);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Price highlighting */
.price-cell {
    font-weight: 600;
    color: var(--success);
}

.price-high {
    color: var(--danger);
}

.price-medium {
    color: var(--warning);
}

.price-low {
    color: var(--success);
}

/* Quantity indicators */
.quantity-low {
    color: var(--danger);
    font-weight: 600;
}

.quantity-medium {
    color: var(--warning);
    font-weight: 600;
}

.quantity-high {
    color: var(--success);
    font-weight: 600;
}

/* Expandable rows */
.expandable-row {
    cursor: pointer;
}

.expandable-row:hover {
    background-color: var(--primary-soft) !important;
}

.expandable-row.expanded {
    background-color: var(--primary-soft) !important;
}

.expanded-content {
    display: none;
    background: var(--primary-soft);
    padding: 1rem;
    border-left: 4px solid var(--primary);
}

.expanded-content.show {
    display: block;
}

/* Table loading state */
.table-loading {
    text-align: center;
    padding: 2rem;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.table-loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--surface-alt);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* Responsive tables */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .table-actions {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .table-actions button {
        width: 100%;
    }
    
    .table-filters {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .table-pagination {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Print styles for tables */
@media print {
    .table-actions,
    .table-pagination,
    .table-filters {
        display: none !important;
    }
    
    .data-table {
        border: 1px solid #000;
    }
    
    .data-table th,
    .data-table td {
        border: 1px solid #000;
        padding: 0.3rem;
    }
    
    .data-table thead {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
}
/* Smart Order Form */
.smart-order-container {
    max-width: 100%;
}

.smart-order-toolbar input[type="text"],
.smart-order-toolbar select {
    font-size: 0.95rem;
}

#smart-inventory-table {
    font-size: 0.85rem;
}

#smart-inventory-table .order-input {
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: border-color 0.2s;
}

#smart-inventory-table .order-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

#smart-inventory-table .row-total {
    font-weight: bold;
    color: var(--primary);
}

.smart-order-summary {
    animation: fadeIn 0.3s ease;
}

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

/* Large modal support */
.modal-content.large {
    max-width: 1200px;
    width: 95%;
}
