/* --- Global Styles & Variables --- */
:root {
    --primary-color: #007BFF;
    --primary-hover: #0056b3;
    --secondary-color: #28a745;
    --secondary-hover: #218838;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333;
    --border-color: #dee2e6;
    --shadow: 0 4px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 20px;
}

/* --- Header / Navigation Bar --- */
header.navbar {
    background-color: var(--card-bg);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* Needed for absolute positioning of mobile menu */
}

header.navbar .logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

/* Style the container that holds the links */
header.navbar .nav-links-container {
    display: flex; /* Keep links visible on desktop */
}

header.navbar .nav-links {
    display: flex; /* Use flexbox for desktop links */
    align-items: center;
}

header.navbar .nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    margin-left: 20px;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.2s;
}
header.navbar .nav-links a:hover {
    background-color: var(--bg-color);
}

/* --- Hamburger Menu Button Styles (Hidden on Desktop) --- */
.menu-toggle {
    display: none; /* Hidden by default */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}
.menu-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: 0.4s;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 18px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-primary { background-color: var(--primary-color); }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: var(--secondary-color); }
.btn-secondary:hover { background-color: var(--secondary-hover); }
.btn-danger { background-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; }

/* --- Form & Card Styles --- */
.form-card {
    background-color: var(--card-bg);
    max-width: 450px;
    margin: 40px auto;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}
.form-card h1 { text-align: center; margin-top: 0; margin-bottom: 25px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-sizing: border-box;
}
.form-card .btn { width: 100%; }
.form-card .link { text-align: center; margin-top: 20px; }
.form-card .link a { color: var(--primary-color); text-decoration: none; }
.form-card .link a:hover { text-decoration: underline; }

/* --- Product Grid (Buyer Page) --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.product-card {
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid #eee;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-card-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.product-card-img.placeholder {
  background: #f3f4f6;
}

.product-card-title {
  font-size: 0.95rem;
  margin: 4px 0 2px 0;
}

.product-card-price {
  font-weight: 600;
  margin-top: 4px;
}

.product-card-original {
  font-weight: 400;
  text-decoration: line-through;
  color: #9ca3af;
  font-size: 0.85rem;
  margin-left: 6px;
}

.product-card-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.btn-small {
  padding: 4px 10px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: none;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

.product-card:hover { transform: translateY(-5px); box-shadow: 0 8px 16px rgba(0,0,0,0.1); }
.product-card-body { padding: 20px; }
.product-card-body h3 { margin: 0 0 10px 0; font-size: 1.25rem; }
.product-card-body .price { font-size: 1.2rem; font-weight: bold; color: var(--secondary-color); margin-bottom: 15px; }
.image-scroller { display: flex; overflow-x: auto; white-space: nowrap; background-color: #f4f4f4; scroll-snap-type: x mandatory; }
.image-scroller img { width: 100%; height: 180px; object-fit: cover; flex-shrink: 0; scroll-snap-align: start; }

/* --- Search Bar --- */
.search-container { margin: 0 auto 30px auto; max-width: 600px; }
.search-form { display: flex; width: 100%; }
.search-form input[type="text"] { flex-grow: 1; padding: 10px 15px; font-size: 1rem; border: 1px solid var(--border-color); border-radius: 5px 0 0 5px; margin: 0; }
.search-form button { padding: 10px 20px; border-radius: 0 5px 5px 0; margin: 0; }

/* --- Product Detail Page (Buyer) --- */
.product-detail { display: flex; gap: 30px; background: var(--card-bg); padding: 30px; border-radius: 8px; box-shadow: var(--shadow); }
.product-detail-info { width: 55%; }
.product-detail-info h1 { margin-top: 0; }
.product-detail-info .price { font-size: 2rem; font-weight: bold; color: var(--secondary-color); margin: 20px 0; }
.product-detail-info .description { font-size: 1.1rem; line-height: 1.7; margin-bottom: 25px; }
.product-actions { display: flex; gap: 10px; margin-top: 20px; }
.product-gallery { width: 45%; }
#main-image { width: 100%; max-height: 400px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-color); margin-bottom: 10px; }
.thumbnail-container { display: flex; gap: 10px; flex-wrap: wrap; }
.thumbnail { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; border: 2px solid var(--border-color); cursor: pointer; transition: border-color 0.2s; }
.thumbnail:hover, .thumbnail.active { border-color: var(--primary-color); }

/* --- Seller Page --- */
.seller-dashboard { background: var(--card-bg); padding: 30px; border-radius: 8px; box-shadow: var(--shadow); }
#add-product-form { background: #fdfdfd; border: 1px solid var(--border-color); border-radius: 8px; padding: 20px; margin-top: 20px; }
.product-list { list-style: none; padding: 0; }
.product-list li { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid var(--border-color); gap: 15px; flex-wrap: wrap; }
.product-list li:last-child { border-bottom: none; }
.product-list .price { color: var(--secondary-color); font-weight: 600; }
.product-list-actions { margin-left: auto; display: flex; gap: 10px; }
.btn-sm { padding: 5px 10px; font-size: 0.9rem; }
.btn-danger-outline { background-color: transparent; color: #dc3545; border: 1px solid #dc3545; }
.btn-danger-outline:hover { background-color: #dc3545; color: #fff; }

/* --- Edit Product Page --- */
.manage-images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 15px; margin-top: 15px; }
.image-thumbnail-container { position: relative; border: 1px solid var(--border-color); border-radius: 5px; overflow: hidden; }
.image-thumbnail-container img { width: 100%; height: 100px; object-fit: cover; display: block; }
.image-thumbnail-container .delete-image-btn { position: absolute; top: 5px; right: 5px; padding: 3px 7px; font-size: 0.8rem; line-height: 1; border-radius: 50%; border: 0; cursor: pointer; }

/* --- Cart Page --- */
.cart-item { display: flex; align-items: center; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.cart-item-info { flex-grow: 1; margin-left: 15px; }
.cart-total { text-align: right; font-size: 1.5rem; margin-top: 20px; }

/* --- Checkout Page --- */
.payment-options { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.payment-option { margin-bottom: 10px; display: block; }
.payment-option input[type="radio"] { margin-right: 10px; }
.order-total-display { margin-top: 20px; font-size: 1.4rem; font-weight: bold; text-align: right; }

/* --- Buyer Order Pages --- */
.order-list-item { display: flex; justify-content: space-between; align-items: center; padding: 20px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 15px; }
.order-summary, .item-list-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 25px; margin-bottom: 20px; }
.order-item { display: flex; align-items: center; padding: 15px 0; border-bottom: 1px solid #eee; }
.order-item:last-child { border-bottom: none; }
.order-item img { width: 80px; height: 80px; object-fit: cover; border-radius: 5px; margin-right: 15px; }
.item-info { flex-grow: 1; }
.item-status { text-align: right; min-width: 150px; }
.status-badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 0.9rem; font-weight: 600; }
.status-Pending { background: #ffc107; color: #333; }
.status-Shipped { background: #007bff; color: #fff; }
.status-Delivered { background: #28a745; color: #fff; }
.status-Canceled { background: #dc3545; color: #fff; }

/* --- Seller Order Page --- */
.order-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.order-header { padding: 15px 20px; background: #f8f9fa; border-bottom: 1px solid var(--border-color); }
.order-header h3 { margin: 0; }
.order-body { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.order-body h4 { margin-top: 0; margin-bottom: 10px; border-bottom: 1px solid #eee; padding-bottom: 5px; }
.status-form { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-end; background: #fdfdfd; padding: 15px; border-radius: 5px; border: 1px solid #eee; }
.status-form .form-group { margin-bottom: 0; flex-grow: 1; }

/* --- Footer --- */
.footer { background-color: #333; color: #f4f4f4; padding: 40px 20px; margin-top: 40px; border-top: 3px solid var(--primary-color); }
.footer-container { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; }
.footer-column { padding: 0 10px; }
.footer-column h4 { color: #fff; margin-top: 0; margin-bottom: 15px; border-bottom: 1px solid #555; padding-bottom: 5px; }
.footer-column ul { list-style: none; padding: 0; margin: 0; }
.footer-column ul li { margin-bottom: 10px; }
.footer-column ul li a { color: #ccc; text-decoration: none; transition: color 0.2s; }
.footer-column ul li a:hover { color: #fff; text-decoration: underline; }
.footer-copyright { text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid #555; font-size: 0.9rem; color: #aaa; }




/* --- Responsive Styles --- */
@media (max-width: 768px) {

    /* --- MOBILE HEADER STYLES --- */
    header.navbar {
        padding: 15px;
    }
    .menu-toggle {
        display: block;
    }

    /* VVVV REVISED RULES VVVV */
    /* Force hide the link container initially */
    .nav-links-container {
        display: none !important; /* Use !important to ensure it's hidden */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--card-bg);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        z-index: 1000;
        border-top: 1px solid var(--border-color); /* Add a top border for separation */
    }

    /* Force show when active */
    .nav-links-container.active {
        display: block !important; /* Use !important to ensure it shows */
    }
    /* ^^^^ END REVISED RULES ^^^^ */

    /* Style the inner links div (No Change) */
    header.navbar .nav-links {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 10px 0;
    }

    /* Style the individual links (No Change) */
    header.navbar .nav-links a {
        margin: 0;
        padding: 15px 20px;
        text-align: left;
        border-bottom: 1px solid #eee;
        border-radius: 0;
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    header.navbar .nav-links a:last-child { border-bottom: none; }
    header.navbar .nav-links a:hover { background-color: var(--bg-color); }
    /* --- END MOBILE HEADER STYLES --- */


    /* --- Keep other mobile styles --- */
    /* ... (product grid, footer, etc. styles remain the same) ... */
    .product-grid { grid-template-columns: 1fr; gap: 20px; }
    .product-card { width: auto; }
    .product-detail { flex-direction: column; }
    .product-detail img, .product-detail .product-gallery, .product-detail-info { width: 100%; }
    .order-body { grid-template-columns: 1fr; }
    .status-form { flex-direction: column; align-items: stretch; }
    .status-form .form-group { margin-bottom: 10px; }
    .status-form button { margin-top: 10px; }
    .footer-container { grid-template-columns: 1fr; text-align: center; }
    .footer-column h4 { border-bottom: none; padding-bottom: 0; }


} /* End of @media query */







/* --- Add these styles to your main style.css file --- */

/* 1. Make the product card have a pointer cursor to show it's clickable */
.product-card {
    cursor: pointer;
    /* Add a transition for a smooth hover effect */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 2. Define the product grid layout */
.product-grid {
    display: grid;
    
    /* DEFAULT (MOBILE): 2 columns with a 15px gap */
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* 3. MEDIA QUERY (TABLET & DESKTOP) */

/* When the screen is 768px wide or more... */
@media (min-width: 768px) {
    .product-grid {
        /* ...show 3 columns */
        grid-template-columns: repeat(3, 1fr);
        gap: 20px; /* Use a slightly larger gap */
    }
}

/* When the screen is 1024px wide or more... */
@media (min-width: 1024px) {
    .product-grid {
        /* ...show 4 columns */
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
}

/* Fix price layout in product cards on mobile */
.product-card-price-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;        /* spacing between prices */
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.product-card-price-main {
    font-size: 1.2rem;
    font-weight: 700;
    color: #007bff;
}

.product-card-price-original {
    font-size: 0.9rem;
    text-decoration: line-through;
    color: #777;
}

.product-card-discount {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e53935;
}

/* MOBILE RESPONSIVE FIX */
@media (max-width: 480px) {
    .product-card-price-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}





.color-variants-row {
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:8px 0;
}
.color-variant-card {
  min-width:90px;
  border:1px solid #ddd;
  border-radius:8px;
  padding:4px;
  text-align:center;
  text-decoration:none;
  color:#111;
  font-size:0.8rem;
}
.color-variant-card img {
  width:100%;
  height:80px;
  object-fit:cover;
  border-radius:6px;
}
.color-variant-card.active {
  border-color:#ff4b6a;
  box-shadow:0 0 0 2px rgba(255,75,106,0.35);
}
.color-name { margin-top:2px; }



/* === Product detail image viewer === */

.product-media-layout {
    display: grid;
    grid-template-columns: 80px minmax(0, 1.2fr) minmax(0, 1.2fr);
    gap: 12px;
    align-items: stretch;
}

.product-thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 480px;
    overflow-y: auto;
}

.product-thumb-btn {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0;
    background: #fff;
    cursor: pointer;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.product-thumb-btn.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.25);
}

.product-main-image-wrap {
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    background: #fff;
}

.product-main-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* square */
    overflow: hidden;
}

.product-main-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f9fafb;
}

/* Zoom pane on right */
.product-zoom-pane {
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background:#fff;
    overflow: hidden;
    position: relative;
    min-height: 280px;
    display: none; /* hidden until hover on desktop */
}

.product-zoom-pane img {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    max-width:none;
}

/* Lens */
.zoom-lens {
    position: absolute;
    border: 1px solid #93c5fd;
    background-color: rgba(191,219,254,0.25);
    width: 40%;
    height: 40%;
    display: none;
    pointer-events: none;
}

/* Mobile: simpler (no zoom pane) */
@media (max-width: 768px) {
    .product-media-layout {
        grid-template-columns: 70px minmax(0, 1fr);
        grid-template-rows: auto;
    }
    .product-zoom-pane {
        display: none !important;
    }
}



