/* Reset & Basic Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Header Styles */
.site-header {
    background-color: #161616;
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    /* Logo left, Nav center/right, Cart right */
    align-items: center;
    position: relative;
}

.logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

/* Navigation */
.main-nav ul {
    display: flex;
    gap: 20px;
}

.site-auth {
    display: flex;
    align-items: center;
}

.site-auth-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.site-auth-status {
    font-size: 0.85rem;
    color: #d7d7d7;
}

.site-auth-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.site-auth-links a,
.site-auth-button {
    color: #fff;
    font-size: 0.9rem;
}

.site-auth-logout-form {
    margin: 0;
}

.site-auth-button {
    border: 1px solid #515151;
    background: transparent;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
}

.site-auth-button:hover {
    background: #2b2b2b;
}

.main-nav a {
    color: #ccc;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: #fff;
}

/* Cart & Hover Effect (Requirement 4) */
.header-cart {
    position: relative;
    /* Context for absolute positioning of dropdown */
    padding: 10px 0;
    /* Increase hover area */
    cursor: pointer;
}

.cart-icon {
    color: #fff;
    font-weight: bold;
}

.cart-hover-content {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    z-index: 1000;
    /* Requirement 4: Overlay elements behind it */
}

/* Validates Requirement 4: CSS :hover */
.header-cart:hover .cart-hover-content {
    display: block;
}

.btn-checkout {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #2daf4b;
    color: white;
    border: none;
    margin-top: 10px;
    cursor: pointer;
}

.btn-checkout:hover {
    background-color: #218838;
}

.cart-item-row {
    display: grid;
    grid-template-columns: 1fr 70px auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.cart-item-name {
    font-size: 0.95rem;
}

.cart-item-qty {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.cart-item-remove {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
}

.cart-item-remove:hover {
    background: #f3f3f3;
    border-color: #cfcfcf;
}

.cart-hover-total {
    margin-top: 10px;
    font-weight: bold;
}

/* Main Content & Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.flash-message {
    margin: 0 0 1rem;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
}

.flash-success {
    background: #ebf7ee;
    border-color: #bcdcc5;
    color: #1b5e2b;
}

.flash-error {
    background: #fff1f0;
    border-color: #f0c6c2;
    color: #8a1f16;
}

.main-layout {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

/* Breadcrumbs (Requirement 6) */
.breadcrumbs {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #666;
}

.breadcrumbs a {
    color: #007bff;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Sidebar Styling */
.sidebar {
    flex: 0 0 180px;
    /* Fixed width sidebar, no grow, no shrink */
    background-color: #fcfcfc;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
}

.sidebar h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #333;
    padding-bottom: 5px;
}

.category-nav ul {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-nav a {
    color: #555;
    display: block;
    padding: 5px 0;
    transition: color 0.2s, padding-left 0.2s;
}

.category-nav a:hover {
    color: #007bff;
    padding-left: 5px;
}

/* Product Section */
.products-section {
    flex: 1;
    /* Take the remaining space */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .site-header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .site-auth,
    .site-auth-content,
    .site-auth-links {
        width: 100%;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        flex: none;
        width: 100%;
        margin-bottom: 20px;
    }
}

.products-section h2 {
    margin-bottom: 30px;
    text-align: center;
}

/* Requirement 3: CSS Grid Product List (Tableless) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.product-grid p {
    color: #666;
}

.product-card {
    border: 1px solid #eee;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    background: #fff;
    border-radius: 8px;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.product-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 15px;
}

.product-name {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #333;
}

.product-price {
    font-weight: bold;
    color: #e44d26;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.btn-add-cart {
    background-color: #2daf4b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-add-cart:hover {
    background-color: #218838;
}

/* Product Detail Page (Requirement 5) */
.product-detail-container {
    display: flex;
    flex-wrap: wrap;
    /* Responsive: stack on small screens */
    gap: 40px;
    margin-top: 30px;
}

.product-visuals {
    flex: 1;
    min-width: 300px;
}

/* Requirement 7: Pure CSS Image Slider */
.product-slider {
    position: relative;
    width: 100%;
}

.slider-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #eee;
    border-radius: 8px;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.slider-wrapper::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.slider-wrapper {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
}

.slide img {
    width: 100%;
    height: auto;
    display: block;
}

.slider-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.slider-nav a {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ddd;
    transition: background-color 0.3s;
}

.slider-nav a:hover {
    background-color: #007bff;
}

.product-info {
    flex: 1;
    min-width: 300px;
}

.product-title {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #333;
}

.product-price-large {
    font-size: 1.8rem;
    color: #e44d26;
    font-weight: bold;
    margin-bottom: 25px;
}

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

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

.purchase-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.purchase-actions input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
}

.btn-add-cart-large {
    background-color: #2daf4b;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 5px;
    cursor: pointer;
}

.btn-add-cart-large:hover {
    background-color: #218838;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 50px;
    background-color: #e7e8e9;
    border-top: 1px solid #eee;
    color: #666;
}