/* General Styles */
:root {
    --primary-color: violet; /* Tomato */
    --secondary-color: #4CAF50; /* Green */
    --accent-color: #ffc107; /* Amber */
    --text-color: #e0e0e0;
    --bg-color: #1a1a1a;
    --card-bg: #2a2a2a;
    --border-color: #444;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding-bottom: 70px;
}

/* Header and Search */
.header {
    background-color: var(--card-bg);
    padding: 15px 20px;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    margin: 0 0 5px 0;
    font-size: 1.5rem;
    color: gold;
    text-align: center;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.header p {
    text-align: center;
    margin-bottom: 10px;
}
.search-container {
    position: relative;
    width: 100%;
}

.search-bar {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 1em;
    padding-left: 20px;
    background-color: #333;
    color: var(--text-color);
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    width: 100%;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 8px var(--shadow-color);
    max-height: 200px;
    overflow-y: auto;
    z-index: 99;
}

.autocomplete-suggestions div {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #444;
}

.autocomplete-suggestions div:last-child {
    border-bottom: none;
}

.autocomplete-suggestions div:hover {
    background-color: #444;
}

/* Main Content and Layout */
.container {
    padding: 20px 10px;
}

.list-wrapper {
    margin-top: 10px;
}

h2 {
    margin: 15px 0 10px;
    font-size: 1.3em;
    text-transform: uppercase;
    color: var(--primary-color);
    text-align: center;
}

/* Navigation Links */
#navigationLinks {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1em;
    color: #888;
    margin: 10px 0;
    padding: 0 10px;
}
#navigationLinks span {
    cursor: pointer;
    text-decoration: underline;
    color: var(--primary-color);
}
#navigationLinks span:last-child {
    text-decoration: none;
    color: var(--text-color);
}

/* Banner */
.banner-container {
    position: relative;
    height: 160px;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px var(--shadow-color);
}
.banner {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}
.banner.active {
    opacity: 1;
}

/* Category & Product Lists - Horizontal Scroll */
.list-container {
    display: flex;
    overflow-x: auto; /* Enable horizontal scrolling */
    gap: 15px;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
}
.list-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.category-item {
    flex-shrink: 0; /* Prevents items from shrinking */
    text-align: center;
    cursor: pointer;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--shadow-color);
    padding: 10px;
    transition: transform 0.2s;
    width: 100px;
}
.category-item:hover {
    transform: scale(1.05);
}
.category-item.selected {
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    transform: scale(1.05);
    /* Optional: Adds a subtle zoom effect */
    transition: transform 0.3s ease-in-out;
}
    
.category-item img {
    width: 80px;
    height: 80px;
    border-radius: 20%;
    object-fit: cover;
    border: 2px solid #555;
}
.category-item p {
    font-weight: bold;
    margin-top: 5px;
    font-size: 0.9em;
}

.product-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    padding: 0;
    text-align: center;
    transition: transform 0.2s;
}
.product-card:hover {
    transform: translateY(-5px);
}
.product-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
}
.product-details {
    padding: 10px;
}
.product-details h3 {
    font-size: 1rem;
    margin: 5px 0;
    color: #fff;
}
.product-details p {
    font-size: 0.9rem;
    color: #bbb;
    margin: 0;
}

/* --- UPDATED RATINGS CSS --- */
.rating-container {
    position: relative;
    height: 25px; /* Added a fixed height to prevent layout shift */
    margin-bottom: 10px;
}
.rating-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2; /* Ensure rating display is on top */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 1.2em;
    color: var(--accent-color);
    cursor: pointer;
    transition: opacity 0.3s ease-in-out;
}
.rating-display .star-full {
    color: var(--accent-color);
}
.rating-display .star-empty {
    color: var(--border-color);
}
.rating-input {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1; /* Keep rating input below display */
    display: flex;
    flex-direction: row-reverse; /* Right to left stars */
    justify-content: center;
    opacity: 0; /* Hide by default */
    transition: opacity 0.3s ease-in-out;
}

/* Show input stars on hover, hide display stars */
.product-card:hover .rating-input {
    opacity: 1;
    z-index: 3; /* Bring input to top on hover */
}
.product-card:hover .rating-display {
    opacity: 0;
}

/* Rating Stars */
.clickable-star {
    cursor: pointer;
    font-size: 1.5em;
    color: var(--border-color);
    transition: color 0.2s;
}
.clickable-star:hover,
.clickable-star:hover ~ .clickable-star {
    color: var(--accent-color);
}
/* END UPDATED RATINGS CSS */


/* Add to Cart Button */
.add-to-cart-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    width: 90%;
    margin-top: 10px;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: #2a2a2a;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 4px var(--shadow-color);
    z-index: 100;
}
.bottom-nav button {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
    gap: 5px;
    padding: 5px;
    position: relative;
    transition: color 0.3s;
}
.bottom-nav button:hover,
.bottom-nav button:focus {
    color: #fff;
}
.bottom-nav button svg {
    width: 24px;
    height: 24px;
}
.nav-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #e53935;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    line-height: 1;
    transform: translate(50%, -50%);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 8px var(--shadow-color);
    position: relative;
    text-align: center;
}
.modal-content h2 {
    color: #fff;
    margin-top: 0;
}
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
    padding: 10px 0;
}
.cart-item-info {
    flex-grow: 1;
    color: var(--text-color);
    text-align: left;
}
.cart-item-info strong {
    color: #fff;
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cart-item-controls button {
    background-color: #e53935;
    color: white;
    border: none;
    padding: 5px;
    border-radius: 5px;
    cursor: pointer;
}
.modal-total {
    text-align: right;
    margin-top: 20px;
    font-size: 1.2rem;
}
.checkout-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
}
.order-card {
    background-color: #333;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px var(--shadow-color);
    text-align: left;
}
.order-card h3 {
    margin: 0 0 5px;
}
.order-card ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
}
.order-card li {
    font-size: 0.9rem;
    color: #bbb;
}
.account-details {
    text-align: left;
}
#editFields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#editFields input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: #333;
    color: var(--text-color);
    box-sizing: border-box;
}
#editFields button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}
#editFields button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    color: #fff;
}
.status-pending { background-color: #ff9800; }
.status-assigned { background-color: #2196F3; }
.status-accepted { background-color: var(--secondary-color); }
.status-rejected { background-color: #F44336; }
.status-completed { background-color: var(--secondary-color); }
.status-cancelled { background-color: #9E9E9E; }


/* Product Detail Modal Specific Styles */
.product-detail-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.product-detail-content #detailImage {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 15px;
}
.product-detail-content .product-info {
    text-align: left;
    width: 100%;
}
.product-detail-content .product-info h2 {
    font-size: 1.5rem;
    margin: 0;
    color: #fff;
}
.product-detail-content .detail-price {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin: 5px 0 15px;
}
.product-detail-content .detail-description h3 {
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 5px;
}
.product-detail-content .detail-description p {
    font-size: 0.9rem;
    color: #aaa;
    line-height: 1.5;
}
.product-detail-content .add-to-cart-btn {
    width: 100%;
    margin-top: 20px;
}
#variantOptions {
    margin-bottom: 15px;
    width: 100%;
}
#variantOptions h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #fff;
}
.variant-btn {
    background-color: #555;
    color: white;
    border: 1px solid #777;
    padding: 8px 12px;
    margin: 5px;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}
.variant-btn.selected {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
