/* General Body Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

/* Header and Navigation */
header {
    background-color: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: #555;
    font-weight: bold;
    transition: color 0.3s;
}

nav a:hover {
    color: #007bff;
}

/* Container for Cart and Auth buttons */
.nav-icons {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.5rem;
    color: #333;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: bold;
    border: 2px solid white;
}

/* Auth Container Styles */
.auth-container button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-container button:hover {
    background-color: #0056b3;
}

#logout-button {
    background-color: #dc3545;
}

#logout-button:hover {
    background-color: #c82333;
}

/* --- Styles for Auth Controls Logout Button --- */
#auth-controls button {
    background-color: #e53935 !important; /* Bright red */
    color: #fff !important;
    border: none;
    padding: 12px 20px !important;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 24px !important;
    font-size: 1.1rem !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: background 0.2s;
    display: inline-block !important;
    position: relative !important;
    z-index: 2001 !important;
}
#auth-controls button:hover {
    background-color: #b71c1c !important;
}

/* Main Content */
main {
    padding: 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background-color: #007bff;
    color: white;
    border-radius: 8px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Products Section */
.products {
    margin-top: 3rem;
}

.products h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.product-item {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.product-item img {
    max-width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.product-item h3 {
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

.product-item .price {
    font-size: 1.1rem;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 1rem;
}

.product-item p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.product-item button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    background-color: #333;
    color: white;
}

/* --- Login/Signup Modal Styles --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 1.5rem;
}

.modal-tabs .tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: bold;
    color: #888;
    border-bottom: 3px solid transparent;
}

.modal-tabs .tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.form-content {
    display: none;
}

.form-content.active {
    display: block;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box; /* Important for padding */
}

.modal-content button {
    width: 100%;
    padding: 0.8rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

.modal-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.modal-footer a {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
}

#auth-error {
    color: red;
    margin-bottom: 1rem;
    text-align: center;
    display: none; /* Hidden by default */
}


/* --- Shopping Cart Modal Styles --- */

.cart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.cart-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.cart-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.cart-modal-content h2 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

#cart-items-list {
    list-style: none;
    padding: 0;
    max-height: 40vh; /* Make the list scrollable if it gets too long */
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cart-item-details img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

.cart-item-details h4 {
    margin: 0;
    font-size: 1rem;
}

.cart-item-price {
    font-weight: bold;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid #333;
}

#confirm-order-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: background-color 0.3s;
}

#confirm-order-btn:hover {
    background-color: #218838;
}

.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: #888;
    cursor: pointer;
    border: none;
    background: none;
}