/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
}

/* GLOBAL STYLES */
body {
    background-color: #f0f0f0;
    color: #000;
    line-height: 1.5;
    font-size: 14px;
}

button {
    background-color: #000;
    color: #fff;
    border: 1px solid #000;
    padding: 6px 10px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: background-color 0.1s, color 0.1s;
}

button:hover {
    background-color: #fff;
    color: #000;
}

button:disabled {
    background-color: #888;
    cursor: not-allowed;
}

input, select {
    border: 1px solid #000;
    padding: 6px;
    width: 100%;
    font-size: 14px;
    margin-bottom: 8px;
}

/* HEADER */
header {
    background-color: #000;
    color: #fff;
    padding: 15px;
    border-bottom: 2px solid #888;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

h1 {
    font-size: 24px;
    letter-spacing: 1px;
}

/* MAIN LAYOUT */
main {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    gap: 30px;
}

/* SIDEBAR */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    border: 1px solid #000;
    padding: 15px;
    background-color: #fff;
}

.sidebar h3 {
    margin-bottom: 10px;
    border-bottom: 1px solid #000;
    padding-bottom: 5px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group h4 {
    margin-bottom: 8px;
}

.filter-checkbox {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
}

.filter-checkbox input {
    margin-right: 5px;
    width: auto;
    margin-top: 2px;
    flex-shrink: 0;
}

.filter-checkbox label {
    flex: 1;
}

#reset-filters {
    width: 100%;
    margin-top: 10px;
}

/* Updated search container styles */
.search-container {
    margin-bottom: 20px;
}

.search-input-group {
    display: flex;
    gap: 8px;
}

.search-input-group input {
    flex: 1;
    margin-bottom: 0;
}

.search-input-group button {
    white-space: nowrap;
}

/* Updated manufacturer filter styles */
.toggle-manufacturers-btn {
    width: 100%;
    margin-top: 10px;
    background-color: #fff;
    color: #000;
    border: 1px solid #000;
    padding: 5px;
    font-size: 12px;
}

.toggle-manufacturers-btn:hover {
    background-color: #000;
    color: #fff;
}

/* PRODUCT LISTING */
.content {
    flex: 1;
    min-width: 0; 
}

#product-listing-view {
    display: flex;
    width: 100%;
    gap: 30px;
}

.product-listing {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.product-card {
    border: 1px solid #000;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    transition: transform 0.1s;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 0 #000;
}

.product-image-container {
    height: 200px;
    overflow: hidden;
    border-bottom: 1px solid #000;
    background-color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-info {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
}

.product-manufacturer {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.product-price {
    font-weight: bold;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.in-stock {
    color: #008000;
    font-size: 12px;
    white-space: nowrap;
}

.back-ordered {
    display: none;
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* REVIEWS STYLES */
.reviews-summary {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
    padding-bottom: 15px;
}

.reviews-average {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.average-rating {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 5px;
}

.review-count {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.star-rating {
    font-size: 24px;
    letter-spacing: 2px;
}

.star-rating.small {
    font-size: 16px;
}

.star {
    display: inline-block;
}

.star.full {
    color: #ffd700;
}

.star.half {
    color: #ffd700;
    position: relative;
}

.star.empty {
    color: #ddd;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-item {
    padding: 15px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.review-headline {
    font-weight: bold;
    font-size: 16px;
}

.review-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px;
    color: #666;
}

.review-text {
    line-height: 1.4;
}

/* PAGINATION */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

/* PRODUCT DETAILS PAGE */
.product-details-container {
    width: 100%;
}

.back-button-container {
    margin-bottom: 20px;
}

.product-details {
    border: 1px solid #000;
    background-color: #fff;
    padding: 20px;
}

.product-header {
    display: flex;
    margin-bottom: 20px;
}

.product-details-image {
    width: 300px;
    height: 300px;
    object-fit: contain;
    border: 1px solid #000;
    background-color: #f8f8f8;
}

.product-details-info {
    margin-left: 20px;
    flex: 1;
}

.product-details-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

.product-details-manufacturer {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.product-details-price {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
}

.add-to-cart-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.quantity-input {
    width: 80px;
    height: 38px; /* Match button height */
    text-align: center;
    font-size: 16px;
    border: 1px solid #000;
    padding: 6px;
    margin-bottom: 0px;
}

.add-to-cart-btn {
    width: fit-content;
    height: 38px;
    padding: 0 20px;
    font-size: 16px;
    white-space: nowrap;
}

.product-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.product-description h3 {
    margin-bottom: 10px;
}

/* Product Details Expandable Section */
.product-details-expandable {
    margin-top: 20px;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.expand-details-btn {
    width: 100%;
    text-align: left;
    font-weight: bold;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.expand-icon {
    display: inline-block;
    width: 20px;
    font-size: 18px;
    font-weight: bold;
    margin-right: 10px;
}

.detailed-specs-content {
    display: none;
    border: 1px solid #ddd;
    padding: 15px;
    background-color: #f9f9f9;
}

.technical-specs-content {
    font-size: 14px;
    line-height: 1.6;
}

.technical-specs-content h2 {
    font-size: 18px;
    margin: 20px 0 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}

.technical-specs-content h3 {
    font-size: 16px;
    margin: 15px 0 10px;
}

.technical-specs-content p {
    margin: 0 0 15px;
}

.technical-specs-content ul,
.technical-specs-content ol {
    margin: 0 0 15px;
    padding-left: 20px;
}

.technical-specs-content li {
    margin-bottom: 5px;
}

.technical-specs-content .nested-list {
    margin: 5px 0 5px 20px;
}

.technical-specs-content .level-1 {
    margin-left: 20px;
}

.technical-specs-content .level-2 {
    margin-left: 40px;
}

.technical-specs-content .level-3 {
    margin-left: 60px;
}

/* CART PAGE */
.cart-container {
    width: 100%;
}

.cart-items {
    border: 1px solid #000;
    background-color: #fff;
    margin-bottom: 20px;
}

.cart-item {
    padding: 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    transition: transform 0.1s;
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 0 #000;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border: 1px solid #000;
    background-color: #f8f8f8;
}

.cart-item-details {
    margin-left: 15px;
    flex: 1;
}

.cart-item-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.cart-item-price {
    font-weight: bold;
}

.remove-from-cart {
    background-color: #ff0000;
    color: #fff;
    border: 1px solid #ff0000;
}

.remove-from-cart:hover {
    background-color: #fff;
    color: #ff0000;
}

.cart-item button {
    z-index: 1;
}

.cart-item-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    width: 100%;
    align-items: center;
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #000;
    background-color: #fff;
    margin-top: 10px;
}

.cart-total {
    font-size: 18px;
    font-weight: bold;
}

.checkout-btn {
    padding: 10px 20px;
}

.empty-cart-message {
    padding: 30px;
    text-align: center;
    font-weight: bold;
}

/* LOADING INDICATORS */
.loading-message {
    padding: 30px;
    text-align: center;
    font-weight: bold;
    grid-column: 1 / -1;
}

.loading-image {
    background-color: #ddd;
    animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* FOOTER */
footer {
    background-color: #000;
    color: #fff;
    text-align: center;
    padding: 15px;
    margin-top: 30px;
    font-size: 12px;
}

/* RESPONSIVE STYLES */
@media (max-width: 900px) {
    main {
        flex-direction: column;
    }
    
    #product-listing-view {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .product-listing {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .product-header {
        flex-direction: column;
    }
    
    .product-details-image {
        width: 100%;
        height: auto;
        max-height: 300px;
        margin-bottom: 15px;
    }
    
    .product-details-info {
        margin-left: 0;
    }
}

/* CHECKOUT PAGE STYLES */
.checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.checkout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.order-number {
    font-size: 18px;
    font-weight: bold;
}

.checkout-content {
    display: flex;
    gap: 30px;
}

.checkout-column {
    flex: 1;
}

.checkout-section {
    background: #fff;
    border: 1px solid #000;
    padding: 20px;
    margin-bottom: 20px;
}

.checkout-section h3 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #000;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #000;
    background: #f8f8f8;
    font-family: 'Courier New', monospace;
}

.payment-flex {
    display: flex;
    gap: 15px;
}

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

.shipping-estimate {
    padding: 15px;
    background: #f8f8f8;
    border: 1px solid #000;
}

.order-items {
    margin-bottom: 20px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.order-item:last-child {
    border-bottom: none;
}

.order-item-info {
    flex: 1;
    padding-right: 15px;
}

.order-item-quantity {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.order-item-price {
    font-weight: bold;
}

.order-totals {
    border-top: 2px solid #000;
    padding-top: 15px;
    margin-top: 20px;
}

.total-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.grand-total {
    font-size: 18px;
    font-weight: bold;
    border-top: 1px solid #000;
    padding-top: 10px;
    margin-top: 10px;
}

.confirm-payment-btn {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    margin-top: 20px;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 3px solid #fff;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Confirmation Page */
.confirmation-message {
    text-align: center;
    padding: 50px 20px;
    background: #fff;
    border: 1px solid #000;
}

.checkmark {
    font-size: 48px;
    color: #008000;
    margin-bottom: 20px;
}

.confirmation-message h2 {
    margin-bottom: 10px;
}

.confirmation-details {
    max-width: 600px;
    margin: 20px auto;
    line-height: 1.6;
}

.continue-shopping-btn {
    display: inline-block;
    background: #000;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    margin-top: 20px;
    font-weight: bold;
}

.continue-shopping-btn:hover {
    background: #fff;
    color: #000;
    border: 1px solid #000;
}

/* Responsive checkout */
@media (max-width: 900px) {
    .checkout-content {
        flex-direction: column;
    }
}