/* Inventory Section Styles */
/* Global body styles now in global.css */

/* Table container and common table styles now in admin-sections-shared.css */

/* Inventory Search Input */
#inventory-search-input {
    padding: 8px 12px;
    border: 0.5px solid #c1c1c1;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    width: 200px;
    background: white;
    color: #6c757d;
    transition: all 0.2s ease;
}

#inventory-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#inventory-search-input::placeholder {
    color: #9ca3af;
    opacity: 0.7;
}

#inventory-table {
    width: 100%;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 14px;
}

/* Sticky header - position relative to viewport when scrolling */
#inventory-section main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    min-width: 0;
}

#inventory-items-section {
    position: relative;
    display: flex;
    flex-direction: column;
    /* Height is managed dynamically by JavaScript based on item count */
    width: 100%;
    min-width: 0;
}

#inventory-section .table-container {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    width: 100%;
    min-width: 0;
}

#inventory-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f1f1f1;
}

#inventory-table th {
    position: sticky;
    top: 0;
    background-color: #f1f1f1;
    z-index: 10;
}

#inventory-table th,
#inventory-table td {
    vertical-align: top;
}

#inventory-table tbody tr {
    transition: all 0.2s ease;
    background-color: transparent;
}

#inventory-table tbody tr:nth-child(odd) {
    background-color: transparent;
}

#inventory-table tbody tr td {
    border-bottom: 1px solid #e9ecef;
}

/* Amount cell styling */
.amount-cell {
    font-weight: 600;
    color: #2d3748;
}

/* Category badge styling */
.category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}

.category-electronics {
    background-color: #e3f2fd;
    color: #1565c0;
}

.category-office_supplies {
    background-color: #e3f2fd;
    color: #1565c0;
}

.category-furniture {
    background-color: #fce4ec;
    color: #c2185b;
}

.category-tools {
    background-color: #fff3e0;
    color: #ef6c00;
}

.category-materials {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.category-equipment {
    background-color: #e0f2f1;
    color: #00695c;
}

.category-consumables {
    background-color: #ede7f6;
    color: #5e35b1;
}

.category-other, .category-none {
    background-color: #f5f5f5;
    color: #616161;
}

/* Actions column */
.actions-cell {
    white-space: nowrap;
    width: 1%;
    text-align: right;
    padding: 8px 4px !important;
}

#inventory-table th:last-child,
#inventory-table td:last-child {
    text-align: center;

    width: 1%;
    white-space: nowrap;
    min-width: 80px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    margin-right: 4px;
    transition: all 0.2s ease;
}

.action-btn.edit {
    color: #007bff;
}

.action-btn.edit:hover {
    background-color: #e7f3ff;
}

.action-btn.delete {
    color: #dc3545;
}

.action-btn.delete:hover {
    background-color: #fdeaea;
}

/* Modal Styles - using global modal styles from global.css */

.inventory-form {
    padding: 0 24px 24px 24px;
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* Locations quantities container */
.locations-quantities-container {
    margin-top: 10px;
}

.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.location-quantity-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.location-quantity-group label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

.location-quantity-group input[type="number"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    transition: border-color 0.2s ease;
}

.location-quantity-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

@media (max-width: 768px) {
    .locations-grid {
        grid-template-columns: 1fr;
    }
}

/* File upload styling */
.file-upload-container {
    position: relative;
}

.file-input {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background-color: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-label:hover {
    border-color: #667eea;
    background-color: #f3f4f6;
    color: #667eea;
}

.file-upload-label i {
    font-size: 20px;
}

.image-preview {
    margin-top: 10px;
    text-align: center;
}

.image-preview img {
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        padding: 15px;
    }

    .table-container {
        margin-top: 15px;
    }

    #inventory-table th,
    #inventory-table td {
      
        font-size: 13px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #495057;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 30px;
}

/* Error state */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* Inventory Header Tabs - styling now in global.css */

.inventory-tab-content {
    display: none;
}

.inventory-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* History Section Styles */
#inventory-history-section {
    position: relative;
    flex-direction: column;
    height: calc(100vh - 100px);
}

#inventory-history-section.active {
    display: flex;
}

/* Sticky header for history table - same as inventory table */
#inventory-history-section .table-container {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
}

#inventory-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

#inventory-history-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f1f1f1;
}

#inventory-history-table th {
    position: sticky;
    top: 0;
    background-color: #f1f1f1;
    z-index: 10;
}

#inventory-history-table th,
#inventory-history-table td {
    text-align: left;
    vertical-align: top;
}

#inventory-history-table tbody tr {
    transition: all 0.2s ease;
    background-color: transparent;
}

#inventory-history-table tbody tr:nth-child(odd) {
    background-color: transparent;
}

#inventory-history-table tbody tr td {
    border-bottom: 1px solid #e9ecef;
}

@media (max-width: 768px) {
    #inventory-history-table th,
    #inventory-history-table td {
        padding: 12px 8px;
        font-size: 13px;
    }
}

/* Status badge styling for history */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-badge.status-fulfilled {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.status-unfulfilled {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.status-updated {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  
    padding: 5px;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    gap: 10px;
}

.pagination-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-totals {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 14px;
    font-weight: 600;
    overflow-x: auto;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
    margin-left: auto;
}

.pagination-totals .totals-cell {
    flex: 0 0 auto;
    padding: 0 8px;
    text-align: center;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-totals .totals-value {
    font-weight: 600;
}


.pagination-info {
    font-size:9px;
    color: #495057;
    font-weight: lighter;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    padding: 5px 8px;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #495057;
    border-radius: 4px;
    font-size: 7px;
    font-weight: lighter;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

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

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pagination-page-btn {
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #495057;
    border-radius: 4px;
    font-size: 9px;
    font-weight: lighter;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-page-btn:hover {
    background-color: #000;
   
    color: #667eea;
}

.pagination-page-btn.active {
    background: linear-gradient(var(--gradient-angle, 90deg), var(--gradient-start, #667eea), var(--gradient-end, #7085f4));
    
    color: #fff;
}

.pagination-page-btn.active:hover {
    background-color: #000;
   
}

.pagination-ellipsis {
    padding: 0 4px;
    color: #6c757d;
    font-weight: lighter;
    font-size: 7px;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-info {
        text-align: center;
    }

    .pagination-controls {
        justify-content: center;
        flex-wrap: wrap;
    }

    .pagination-pages {
        flex-wrap: wrap;
        justify-content: center;
    }
}
