/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 3px solid #0066cc;
}

header h1 {
    color: #0066cc;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

/* Controls */
.controls {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.search-section,
.filter-section,
.action-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: start;
}

.action-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

input[type="text"],
select {
    padding: 10px;
    border: 2px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

button {
    padding: 10px 16px;
    background-color: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0052a3;
}

button:active {
    transform: translateY(1px);
}

#clear-filters {
    background-color: #6c757d;
}

#clear-filters:hover {
    background-color: #5a6268;
}

#export-csv,
#export-json {
    background-color: #28a745;
}

#export-csv:hover,
#export-json:hover {
    background-color: #218838;
}

/* Stats */
.stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 10px 0;
    font-weight: 600;
    color: #495057;
}

/* Table */
.parts-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

#parts-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

#parts-table th {
    background-color: #0066cc;
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

#parts-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.85rem;
    vertical-align: top;
}

#parts-table tbody tr:hover {
    background-color: #f8f9fa;
}

#parts-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

/* Table cell specific styling */
.part-id {
    font-weight: 600;
    color: #0066cc;
    text-align: center;
    width: 60px;
}

.fru-number,
.ibm-part-number {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #dc3545;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.fru-number:hover,
.ibm-part-number:hover {
    background-color: #fff3cd;
    border-radius: 3px;
}

.description {
    max-width: 300px;
    word-wrap: break-word;
}

.models-list {
    font-size: 0.8rem;
    color: #6c757d;
    max-width: 150px;
}

.board-type {
    font-weight: 600;
    text-align: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.board-type.type-1 {
    background-color: #d4edda;
    color: #155724;
}

.board-type.type-2 {
    background-color: #d1ecf1;
    color: #0c5460;
}

.board-type.unknown {
    background-color: #f8d7da;
    color: #721c24;
}

.source-page {
    text-align: center;
    font-weight: 600;
    color: #6c757d;
    width: 80px;
}

.actions {
    text-align: center;
    width: 120px;
}

.copy-btn,
.find-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 3px;
    margin: 2px;
    display: inline-block;
    min-width: 45px;
}

.copy-btn {
    background-color: #17a2b8;
}

.copy-btn:hover {
    background-color: #138496;
}

.find-btn {
    background-color: #fd7e14;
}

.find-btn:hover {
    background-color: #e8630e;
}

/* Loading and empty states */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.1rem;
    color: #6c757d;
}

.no-results {
    text-align: center;
    padding: 40px;
    font-size: 1.1rem;
    color: #6c757d;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 1px solid #dee2e6;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    font-weight: 500;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background-color: #dc3545;
}

/* Responsive design */
@media (max-width: 1200px) {
    .controls {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .action-section {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-section {
        grid-template-columns: 1fr;
    }
    
    .action-section {
        flex-direction: column;
    }
    
    .stats {
        flex-direction: column;
        gap: 5px;
    }
    
    #parts-table {
        font-size: 0.8rem;
    }
    
    #parts-table th,
    #parts-table td {
        padding: 8px 4px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .description {
        max-width: 200px;
    }
    
    .models-list {
        max-width: 100px;
    }
}

/* Print styles */
@media print {
    .controls,
    .stats,
    footer,
    .actions {
        display: none;
    }
    
    .container {
        box-shadow: none;
        padding: 0;
    }
    
    #parts-table {
        font-size: 0.7rem;
    }
    
    #parts-table th,
    #parts-table td {
        padding: 4px;
    }
}