/* Products Page Specific Styles */

.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: var(--spacing-lg) 0;
    text-align: center;
}

.page-header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: var(--spacing-xs);
}

.page-subtitle {
    font-size: 1.125rem;
    opacity: 0.95;
}

.page-header-cta {
    margin-top: var(--spacing-sm);
    display: inline-block;
}

/* Filters Section */
.filters-section {
    background-color: var(--bg-light);
    padding: var(--spacing-md) 0;
    border-bottom: 2px solid var(--border-color);
}

.filters-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: var(--spacing-sm);
    align-items: end;
    margin-bottom: var(--spacing-sm);
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: var(--spacing-sm);
    padding-right: 40px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-color: var(--primary-color);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.filter-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.875rem;
}

.filter-group select {
    padding: var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--bg-color);
    cursor: pointer;
    transition: var(--transition);
}

.filter-group select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-color: var(--primary-color);
}

.clear-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--text-light);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.clear-btn:hover,
.clear-btn:focus {
    background-color: var(--text-color);
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.results-info {
    margin-top: var(--spacing-sm);
}

.results-info p {
    color: var(--text-light);
    font-weight: 500;
}

/* Products Table Section */
.products-table-section {
    padding: var(--spacing-md) 0 var(--spacing-xl);
}

.table-wrapper {
    overflow-x: auto;
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-color);
}

thead {
    background-color: var(--primary-color);
    color: white;
}

th {
    padding: var(--spacing-sm);
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sort-btn {
    background: none;
    border: none;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    width: 100%;
    text-align: left;
    transition: var(--transition);
}

.sort-btn:hover,
.sort-btn:focus {
    opacity: 0.8;
    outline: 2px solid white;
    outline-offset: 2px;
}

.sort-indicator {
    font-size: 0.75rem;
    opacity: 0.5;
}

.sort-btn[aria-sort="ascending"] .sort-indicator::before {
    content: "▲";
    opacity: 1;
}

.sort-btn[aria-sort="descending"] .sort-indicator::before {
    content: "▼";
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

tbody tr:hover,
tbody tr:focus-within {
    background-color: var(--bg-light);
}

tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

tbody tr:nth-child(even):hover,
tbody tr:nth-child(even):focus-within {
    background-color: var(--bg-light);
}

td {
    padding: var(--spacing-sm);
    color: var(--text-color);
}

td:first-child {
    font-weight: 600;
    color: var(--primary-color);
}

.loading-message,
.no-results {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-light);
    font-style: italic;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.pagination-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled),
.pagination-btn:focus:not(:disabled) {
    background-color: var(--secondary-color);
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.pagination-btn:disabled {
    background-color: var(--border-color);
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.5;
}

#page-info {
    color: var(--text-color);
    font-weight: 500;
}

/* RFQ button and select column */
.rfq-actions {
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}
.rfq-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.col-select {
    width: 2.5rem;
    text-align: center;
    vertical-align: middle;
}
.col-select input[type="checkbox"] {
    cursor: pointer;
}

.col-rfq-qty {
    width: 5rem;
    padding: var(--spacing-xs);
}
.col-rfq-qty input {
    width: 100%;
    max-width: 4rem;
    padding: 0.25rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
}
.col-rfq-qty input:disabled {
    background: var(--bg-light);
    cursor: not-allowed;
    color: var(--text-light);
}
.col-rfq-qty input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* RFQ modal */
.rfq-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
}
.rfq-modal[hidden] {
    display: none;
}
.rfq-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.rfq-modal-content {
    position: relative;
    background: var(--bg-color);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    max-width: 420px;
    width: 100%;
    padding: var(--spacing-md);
}
.rfq-modal-content h2 {
    margin-bottom: var(--spacing-xs);
    color: var(--primary-color);
    font-size: 1.5rem;
}
.rfq-modal-intro {
    margin-bottom: var(--spacing-md);
    color: var(--text-light);
    font-size: 0.875rem;
}
.rfq-field {
    margin-bottom: var(--spacing-sm);
}
.rfq-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}
.rfq-field input {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}
.rfq-field input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.required {
    color: var(--error-color);
}
.rfq-modal-buttons {
    margin-top: var(--spacing-md);
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}
.rfq-cancel-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}
.rfq-cancel-btn:hover,
.rfq-cancel-btn:focus {
    border-color: var(--primary-color);
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Visually Hidden (for screen readers) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .filters-wrapper {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: var(--spacing-xs);
    }
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }
    
    .table-wrapper {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.5rem 0.25rem;
    }
    
    /* Hide less important columns on mobile (col 1=select, 2=#, 3=dept, 4=name, 5=desc, 6=size, 7=thick, 8=unit, 9=weight, 10=rfq qty) */
    th:nth-child(4),
    td:nth-child(4),
    th:nth-child(8),
    td:nth-child(8),
    th:nth-child(9),
    td:nth-child(9) {
        display: none;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.75rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    th:nth-child(6),
    td:nth-child(6),
    th:nth-child(7),
    td:nth-child(7) {
        display: none;
    }
}
