/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    font-size: 14px;
}

/* Top Navigation */
.top-nav {
    background-color: #666;
    color: white;
    font-size: 12px;
    padding: 6px 20px;
    display: flex;
    justify-content: space-between;
}

.top-nav-links span {
    margin-right: 20px;
    cursor: pointer;
}

.top-nav-right span {
    margin-left: 15px;
    cursor: pointer;
}

.currency {
    color: #00a2ff;
}

/* Main Header */
.main-header {
    background-color: white;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    height: 40px;
    margin-right: 30px;
}

.main-nav {
    display: flex;
    gap: 25px;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 8px 0;
}

.nav-link:hover {
    color: #007bff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-container {
    color: #666;
    cursor: pointer;
}

.order-now-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.user-info, .user-account {
    color: #666;
    font-size: 13px;
}

.cart-icon {
    position: relative;
    color: #666;
    cursor: pointer;
}

.cart-count {
    background-color: #ff4757;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 50%;
    position: absolute;
    top: -8px;
    right: -8px;
}

/* Main Container */
.main-container {
    display: flex;
    min-height: calc(100vh - 120px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.sidebar-menu {
    flex: 1;
    padding: 0;
}

.menu-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    color: #666;
}

.menu-item:hover {
    background-color: #f8f9fa;
}

.menu-item.active {
    background-color: #4a90e2;
    color: white;
}

.menu-item i:first-child {
    margin-right: 10px;
    width: 16px;
}

.menu-item i:last-child {
    margin-left: auto;
}

.submenu {
    background-color: #f8f9fa;
    padding-left: 40px;
}

.submenu-item {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
}

.submenu-item:hover {
    color: #007bff;
}

.submenu-item.active {
    color: #007bff;
    font-weight: 500;
}

.message-count {
    background-color: #ff4757;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Support Section */
.support-section {
    padding: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
}

.support-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.support-info {
    font-size: 12px;
}

.support-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.support-contact {
    color: #666;
    line-height: 1.4;
}

.online {
    color: #28a745;
    font-size: 8px;
}

.support-hours {
    color: #999;
    margin-top: 5px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    background-color: #f8f9fa;
}

.parts-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.parts-cart-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.cart-tabs {
    display: flex;
    gap: 2px;
}

.tab-btn {
    background-color: #e9ecef;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    font-size: 13px;
}

.tab-btn.active {
    background-color: #007bff;
    color: white;
}

.cart-actions {
    display: flex;
    gap: 10px;
}

.export-btn, .add-parts-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
}

.add-parts-btn {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Parts Table Container */
.parts-table-container {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
}

.search-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.search-bar {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 12px;
    background-color: white;
    width: 300px;
}

.search-bar i {
    color: #666;
    margin-right: 8px;
}

.search-bar input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 13px;
}

.stock-filter {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.table-headers {
    display: grid;
    grid-template-columns: 20px 60px 1fr 120px 120px 120px 60px;
    gap: 15px;
    font-weight: 600;
    color: #666;
    font-size: 13px;
    padding: 0 20px;
    align-items: center;
}

/* Position header titles to align with the data columns */
.table-headers .header-col:nth-child(1) { /* Parts Cart */
    grid-column: 3; /* align over part details column */
    text-align: left;
}
.table-headers .header-col:nth-child(2) { /* Unit Price */
    grid-column: 4;
    text-align: center;
}
.table-headers .header-col:nth-child(3) { /* Qty */
    grid-column: 5;
    text-align: center;
}
.table-headers .header-col:nth-child(4) { /* Total Price */
    grid-column: 6;
    text-align: center;
}
.table-headers .header-col:nth-child(5) { /* actions (trash) */
    grid-column: 7;
}

/* Parts List */
.parts-list {
    max-height: 600px;
    overflow-y: auto;
}

.part-row {
    display: grid;
    grid-template-columns: 20px 60px 1fr 120px 120px 120px 60px;
    gap: 15px;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.part-row:hover {
    background-color: #f8f9fa;
}

.part-checkbox input {
    cursor: pointer;
}

.part-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.part-right {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.part-image img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.part-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.part-name {
    font-weight: 500;
    color: #007bff;
    font-size: 13px;
}

.part-number {
    color: #666;
    font-size: 12px;
}

.part-description {
    color: #666;
    font-size: 11px;
    line-height: 1.3;
}

.customer-ref {
    color: #999;
    font-size: 11px;
}

.unit-price, .total-price {
    font-weight: 500;
    text-align: center;
    font-size: 13px;
}

.quantity-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.quantity-controls input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
}

.availability {
    font-size: 11px;
    color: #666;
}

.actions {
    text-align: center;
}

.actions i {
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
}

.actions i:hover {
    color: #c82333;
}

/* Pre-order Section */
.pre-order-section {
    padding: 15px 20px;
    background-color: #fff3cd;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
}

.pre-order-label {
    font-weight: 500;
    color: #856404;
}

.pre-order-note {
    color: #856404;
    line-height: 1.4;
    flex: 1;
}

/* Select All Section */
.select-all-section {
    padding: 15px 20px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.select-note {
    color: #666;
    margin-left: 10px;
}

/* Cart Summary */
.cart-summary {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtotal {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.subtotal-label {
    font-size: 13px;
    color: #666;
}

.subtotal-amount {
    font-size: 20px;
    font-weight: 600;
    color: #ff6b35;
}

.checkout-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.checkout-btn:hover {
    background-color: #0056b3;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .sidebar {
        width: 250px;
    }
    
    .part-row {
        grid-template-columns: 20px 50px 1fr 100px 100px 100px 50px;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .parts-cart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .table-headers {
        display: none;
    }
    
    .part-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .search-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-bar {
        width: 100%;
    }
}

/* Scrollbar Styling */
.parts-list::-webkit-scrollbar {
    width: 6px;
}

.parts-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.parts-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.parts-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Order History Styles */
.order-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select, .date-filter {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 13px;
    cursor: pointer;
}

.order-history-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.order-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.order-header {
    background-color: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.order-number {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.order-date {
    font-size: 13px;
    color: #666;
}

.order-status {
    display: flex;
    align-items: center;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.under-review {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.pending {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-badge.completed {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.cancelled {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.order-parts-table {
    padding: 0;
}

.order-table-headers {
    display: grid;
    grid-template-columns: 60px 1fr 120px 100px 120px;
    gap: 15px;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    color: #666;
    font-size: 13px;
    align-items: center;
}

.order-table-headers .header-col:nth-child(1) {
    grid-column: 1 / 3;
    text-align: left;
}

.order-table-headers .header-col:nth-child(2) {
    text-align: center;
}

.order-table-headers .header-col:nth-child(3) {
    text-align: center;
}

.order-table-headers .header-col:nth-child(4) {
    text-align: center;
}

.order-parts-list {
    max-height: 500px;
    overflow-y: auto;
}

.order-part-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px 100px 120px;
    gap: 15px;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.order-part-row:hover {
    background-color: #f8f9fa;
}

.order-part-row .part-image img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.order-part-row .part-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-part-row .unit-price,
.order-part-row .quantity,
.order-part-row .total-price {
    text-align: center;
    font-weight: 500;
    font-size: 13px;
}

.order-summary {
    padding: 20px;
    background-color: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-total {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.total-label {
    font-size: 13px;
    color: #666;
}

.total-amount {
    font-size: 20px;
    font-weight: 600;
    color: #ff6b35;
}

.order-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.primary {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.action-btn.primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.action-btn.secondary {
    background-color: white;
    color: #666;
    border-color: #ddd;
}

.action-btn.secondary:hover {
    background-color: #f8f9fa;
    color: #333;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 20px;
}

.empty-message h3 {
    font-size: 18px;
    color: #666;
    margin-bottom: 10px;
}

.empty-message p {
    color: #999;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Responsive Design for Order History */
@media (max-width: 1200px) {
    .order-part-row {
        grid-template-columns: 50px 1fr 100px 80px 100px;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .parts-cart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .order-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-select, .date-filter {
        width: 100%;
    }
    
    .order-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .order-table-headers {
        display: none;
    }
    
    .order-part-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .order-summary {
        flex-direction: column;
        gap: 15px;
    }
    
    .order-actions {
        width: 100%;
        justify-content: center;
    }
}
