/* Basic Page Resets */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9f9f9;
}

/* Header Styles */
.nd-mart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8rem;
}

.search-bar {
    flex-grow: 1;
    max-width: 700px;
    margin: 0 24px;
    display: flex;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    overflow: hidden;
    background-color: #fff;
}

.search-bar:focus-within {
    border-color: #f3a847;
    box-shadow: 0 0 0 2px rgba(243, 168, 71, 0.5);
}

.search-select {
    background-color: #f3f3f3;
    border: none;
    border-right: 1px solid #dcdcdc;
    padding: 0 12px;
    color: #555;
    cursor: pointer;
    outline: none;
}

.search-bar input {
    flex-grow: 1;
    padding: 10px 16px;
    border: none;
    font-size: 1rem;
    outline: none;
    box-sizing: border-box;
}

.search-btn {
    background-color: #febd69;
    border: none;
    padding: 0 20px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.2s ease;
}

.search-btn:hover {
    background-color: #f3a847;
}

.cart-indicator {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.cart-indicator:hover {
    background-color: #f0f0f0;
}

/* Auth Link */
.auth-link {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: #f3a847;
}

/* Header Actions & Clear Cart Button */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    font-size: 0.95rem;
    outline: none;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.sort-select:focus {
    border-color: #f3a847;
}

.clear-btn {
    padding: 6px 12px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.clear-btn:hover {
    background-color: #c0392b;
}

/* Navigation Strip Styles */
.category-strip {
    display: flex;
    gap: 24px;
    padding: 12px 24px;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto; /* Allows horizontal scrolling on smaller screens */
}

.category-strip a {
    text-decoration: none;
    color: #555555;
    font-weight: 500;
    font-size: 1rem;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.category-strip a.active {
    color: #3498db;
    font-weight: 700;
}

.category-strip a:hover {
    color: #3498db;
}

/* Hero Banner */
.hero-banner {
    position: relative;
    width: 100%;
}

.carousel-container {
    position: relative;
    height: 300px;
    overflow: hidden;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.hero-content {
    padding: 0 24px;
}

.hero-banner h2 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
}

.hero-banner p {
    margin: 0;
    font-size: 1.2rem;
    color: #d1d5db;
}

/* Carousel Controls */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    padding: 16px;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 2;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-btn.prev { left: 16px; }
.carousel-btn.next { right: 16px; }

.carousel-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.dot {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: #ffffff;
}

/* Footer Styles */
footer {
    background-color: #232f3e;
    color: #ffffff;
    margin-top: 40px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 80px;
    padding: 40px 24px;
    flex-wrap: wrap;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-column h4 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

.footer-column a {
    color: #dddddd;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-column a:hover {
    text-decoration: underline;
}

.footer-bottom {
    background-color: #131921;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
}

.footer-bottom p {
    margin: 0;
}

/* Container for the grid */
.grid-container {
    display: grid;
    /* Creates responsive columns that automatically fit without media queries */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    padding: 20px 0;
}

/* Individual product card */
.product-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden; /* Ensures the image doesn't break outside the border-radius */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

/* Hover effect for a nice interactive feel */
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover; /* Prevents the image from stretching weirdly */
    cursor: pointer;
}

/* Product info section */
.product-card .info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
}

.product-card h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    color: #333;
}

.product-card .rating {
    margin: 0 0 12px;
    font-size: 0.9rem;
}

.product-card .price {
    margin: 0 0 16px;
    font-size: 1.25rem;
    font-weight: bold;
    color: #2c3e50;
}

/* Grouping for action buttons */
.card-actions {
    margin-top: auto; /* Pushes buttons to the bottom of the card */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* The Add to Cart button */
.add-btn {
    padding: 10px 16px;
    background-color: #ffd814;
    color: #0f1111;
    border: 1px solid #fcd200;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-btn:hover {
    background-color: #f7ca00;
    border-color: #f2c200;
}

/* The Buy Now button */
.buy-btn {
    padding: 10px 16px;
    background-color: #ffa41c;
    color: #0f1111;
    border: 1px solid #ff8f00;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.buy-btn:hover {
    background-color: #fa8900;
    border-color: #e57a00;
}

/* Product Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: #ffffff;
    padding: 24px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.close-modal-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #555;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: #000;
}

.modal-image-container {
    max-width: 250px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
    cursor: crosshair;
}

.modal-image:hover {
    transform: scale(2);
}

.modal-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.modal-info h2 {
    margin: 0 0 4px 0;
    font-size: 1.5rem;
    color: #2c3e50;
}

.modal-info .price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #b12704;
    margin: 0 0 24px 0;
}

/* Product Code & Description */
.product-code {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
    display: block;
}

.product-desc {
    font-size: 0.9rem;
    color: #555;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.modal-code {
    font-size: 0.95rem;
    color: #888;
    margin-bottom: 4px;
    display: block;
}

.modal-desc {
    font-size: 1.05rem;
    color: #444;
    margin-bottom: 16px;
    line-height: 1.5;
}

.user-rating-section {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.95rem;
    color: #555;
}

.star-rating {
    display: flex;
    gap: 2px;
}

.star-rating span {
    font-size: 1.5rem;
    color: #dcdcdc;
    cursor: pointer;
    transition: color 0.2s ease;
}

.star-rating span.hover,
.star-rating span.active {
    color: #ffa41c;
}

.rating-feedback {
    color: #007185;
    font-size: 0.9rem;
}

/* Review Section */
.review-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
}

.review-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    box-sizing: border-box;
}

.review-section textarea:focus {
    border-color: #f3a847;
    outline: none;
    box-shadow: 0 0 0 2px rgba(243, 168, 71, 0.5);
}

.submit-review-btn {
    align-self: flex-start;
    padding: 6px 16px;
    background-color: #ffffff;
    color: #0f1111;
    border: 1px solid #d5d9d9;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.submit-review-btn:hover {
    background-color: #f7fafa;
}

/* Past Reviews Section */
.past-reviews-section {
    margin-top: 16px;
    border-top: 1px solid #e0e0e0;
    padding-top: 16px;
    width: 100%;
}

.past-reviews-section h3 {
    font-size: 1.1rem;
    margin: 0 0 12px 0;
    color: #333;
}

.past-reviews-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 8px;
}

.past-reviews-container::-webkit-scrollbar { width: 6px; }
.past-reviews-container::-webkit-scrollbar-track { background: #f1f1f1; }
.past-reviews-container::-webkit-scrollbar-thumb { background: #cccccc; border-radius: 4px; }

.review-item {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.review-author {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.review-stars {
    color: #ffa41c;
    margin-bottom: 6px;
    font-size: 1.1rem;
}

.review-text {
    color: #555;
    margin: 0;
    line-height: 1.4;
}

/* Utility class to hide products when filtered */
.hidden {
    display: none !important;
}

/* Cart Drawer Styles */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px; /* Hidden off-screen by default */
    width: 100%;
    max-width: 400px;
    height: 100%;
    background-color: #ffffff;
    z-index: 1002;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    right: 0;
}

.cart-drawer-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-drawer-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-cart-btn {
    font-size: 1.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    transition: color 0.2s;
}

.close-cart-btn:hover {
    color: #000;
}

.cart-drawer-body {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Custom Scrollbar for Cart Drawer */
.cart-drawer-body::-webkit-scrollbar {
    width: 6px;
}

.cart-drawer-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cart-drawer-body::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 4px;
}

.cart-drawer-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cart-item-title, .cart-item-price {
    margin: 0 0 4px 0;
    color: #333;
}

.cart-item-quantity {
    font-size: 0.95rem;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
    color: #0f1111;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f0f2f2;
    border-radius: 4px;
    padding: 2px 4px;
    border: 1px solid #d5d9d9;
}

.qty-btn {
    background-color: #ffffff;
    border: 1px solid #d5d9d9;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: #0f1111;
    transition: background-color 0.2s ease;
}

.qty-btn:hover {
    background-color: #e3e6e6;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #007185;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
}

.remove-item-btn:hover {
    text-decoration: underline;
    color: #c40000;
}

.cart-total {
    margin-top: 20px;
    font-size: 1.2rem;
    text-align: right;
}

.cart-drawer-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Checkout Page Styles */
.checkout-main {
    padding: 40px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.checkout-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.checkout-form-section {
    flex: 2;
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e0e0e0;
}

.order-summary-section {
    flex: 1;
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e0e0e0;
    position: sticky;
    top: 100px;
}

.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.checkout-form label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.checkout-form input {
    padding: 12px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.checkout-form input:focus {
    border-color: #f3a847;
    outline: none;
    box-shadow: 0 0 0 2px rgba(243, 168, 71, 0.5);
}

.checkout-total {
    margin-top: 20px;
    font-size: 1.5rem;
    text-align: right;
    border-top: 1px solid #eee;
    padding-top: 20px;
    color: #b12704;
    font-weight: bold;
}

/* Success Page Styles */
.success-main {
    padding: 60px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.success-container {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* Auth Pages Styles */
.auth-main {
    padding: 60px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-container {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    width: 100%;
    max-width: 400px;
}

.auth-container h2 {
    margin-top: 0;
    margin-bottom: 24px;
    color: #2c3e50;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.auth-form input {
    padding: 12px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.auth-form input:focus {
    border-color: #f3a847;
    outline: none;
    box-shadow: 0 0 0 2px rgba(243, 168, 71, 0.5);
}

.auth-toggle {
    margin-top: 24px;
    text-align: center;
    font-size: 0.9rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 16px;
}

.auth-toggle a {
    color: #007185;
    text-decoration: none;
    font-weight: 600;
}

.auth-toggle a:hover {
    text-decoration: underline;
    color: #c40000;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Move search bar to its own row */
    .nd-mart-header {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }

    .search-bar {
        order: 3;
        margin: 0;
        max-width: 100%;
        flex-basis: 100%;
    }

    /* Scale down hero banner */
    .carousel-container {
        height: 220px;
    }

    .hero-banner h2 {
        font-size: 1.8rem;
    }

    .hero-banner p {
        font-size: 1rem;
    }

    /* Allow slightly smaller product cards */
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }

    /* Stack footer links and center modal info */
    .footer-links, .modal-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-links {
        gap: 32px;
    }

    /* Stack checkout columns */
    .checkout-container {
        flex-direction: column;
    }

    .order-summary-section {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Toast Notification Styles */
.toast-notification {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 4px;
    padding: 12px 16px;
    position: fixed;
    z-index: 2000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s, visibility 0.3s;
}

.toast-notification.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

.toast-undo-btn {
    background: none;
    border: none;
    color: #f3a847;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.toast-undo-btn:hover {
    color: #febd69;
    text-decoration: underline;
}