﻿/* ==========================================================================
   Table - Data Display & Inventory Table
   ========================================================================== */

.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 2500px;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
    overflow: visible;
    z-index: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: fixed;
}

/* Table Headers */
th {
    background: #667eea;
    color: white;
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
}

th.sortable-header {
    user-select: none;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

th.sortable-header:hover {
    background: #5a6fd8;
}

th.sortable-header.sorted {
    background: #764ba2;
}

/* Column Widths - Using inline styles */
th {
    text-align: center;
}

th.sortable-header {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* BDQ Special Header */
th.bdq-header {
    background: #ff6b35;
    position: relative;
    text-align: center;
}

th.bdq-header::after {
    content: "⭐";
    margin-left: 0.5rem;
    font-size: 0.8rem;
}

/* Resizer Handle */
.resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    cursor: col-resize;
    user-select: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

th:hover .resizer {
    opacity: 1;
}

.resizer:hover {
    background: rgba(255, 255, 255, 0.6);
    opacity: 1 !important;
}

.resizer.resizing {
    background: rgba(255, 255, 255, 0.8);
    opacity: 1 !important;
}

.resize-info {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 1000;
    display: none;
}

/* Table Cells */
td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
    position: relative;
}

/* Column-specific styles using classes */
td.qty-cell {
    text-align: center;
    border-right: 1px solid #e0e0e0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tooltip for truncated content */
.cell-content {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-content:hover {
    z-index: 100;
}

/* Product Name Tooltip */
.product-name-cell {
    position: relative;
    cursor: pointer;
    text-align: left;
}

.product-name-link {
    color: inherit;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-name-link:hover {
    color: #667eea;
    text-decoration: underline;
}

.product-name-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    max-width: none;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    line-height: 1.2;
}

.product-name-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 1rem;
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.95);
}

/* BDQ Special Cells */
td.bdq-cell {
    background-color: #fff5f0;
    border-left: 3px solid #ff6b35;
    border-right: 3px solid #ff6b35;
    font-weight: bold;
}

tr:hover {
    background-color: #f8f9ff;
}

tr:hover td.bdq-cell {
    background-color: #ffe8e0;
}

/* Quantity Cells */
.qty-cell {
    text-align: center;
    font-weight: 600;
}

.qty-positive {
    color: #28a745;
    font-weight: bold;
}

.qty-zero {
    color: #000000;
    font-weight: normal;
}

.bdq-cell.qty-positive {
    color: #d63031;
    font-size: 1.05em;
}

.bdq-cell.qty-zero {
    color: #636e72;
}

/* Action Buttons (Notify, Hide, Low Stock) */
.notify-btn,
.hide-btn,
.low-stock-btn {
    display: inline-block;
    font-size: 1.2rem;
    text-decoration: none;
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
}

.notify-btn:hover,
.hide-btn:hover,
.low-stock-btn:hover {
    background-color: #f0f0f0;
    transform: scale(1.2);
}

.notify-btn:active,
.hide-btn:active,
.low-stock-btn:active {
    transform: scale(1.1);
}

/* Empty States */
.no-data {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #667eea;
}

/* Depot Badge (for watched items) */
.depot-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #e8f5e8;
    color: #2e7d32;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}