:root {
    --primary-color: #4CAF50; /* A vibrant green */
    --secondary-color: #FFC107; /* A bright yellow/amber for accents */
    --background-color: #FFFFFF;
    --surface-color: #F8F9FA;
    --text-color: #212529;
    --heading-color: #343A40;
    --border-color: #E0E0E0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --font-family: 'Poppins', sans-serif;
}

[data-theme="dark"] {
    --primary-color: #66BB6A; /* A slightly lighter green for dark mode */
    --secondary-color: #FFCA28;
    --background-color: #121212;
    --surface-color: #1E1E1E;
    --text-color: #E0E0E0;
    --heading-color: #FFFFFF;
    --border-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, h4 {
    color: var(--heading-color);
    font-weight: 700;
}

h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

h2 .highlight {
    color: var(--primary-color);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s, border-color 0.3s;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}

.logo img {
    height: 40px;
    width: 40px;
}

.logo h1 {
    font-size: 1.5rem;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

#theme-toggle img {
    height: 24px;
    width: 24px;
    filter: var(--text-color) == #E0E0E0 ? invert(1) : invert(0);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.primary-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

#mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-color);
    cursor: pointer;
}

.hero {
    background: url('hero-background.png') no-repeat center center/cover;
    height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    position: relative;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    padding: 1rem;
}
.hero-content h2 {
    font-size: 3.5rem;
    color: white;
    margin-bottom: 1rem;
}
.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

.hero-content .primary-btn {
    text-decoration: none;
    display: inline-block;
}

.content-section {
    padding: 4rem 5%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.section-header h2 {
    margin-bottom: 0;
    text-align: left;
}

.view-all-btn {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s;
}
.view-all-btn:hover {
    color: var(--heading-color);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.card {
    background-color: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-content h3, .card-content h4 {
    margin-bottom: 0.5rem;
}

.card-content p {
    margin-bottom: 1rem;
    flex-grow: 1;
}

.price {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.sponsored-tag {
    background-color: var(--secondary-color);
    color: #333;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    font-weight: bold;
    vertical-align: middle;
}

.secondary-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
    transition: background-color 0.2s, color 0.2s;
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: var(--surface-color);
}

.filter-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}
.filter-controls input[type="search"] {
    padding: 0.75rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    font-family: var(--font-family);
    min-width: 250px;
}
.filter-controls .filter-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    color: var(--text-color);
    font-weight: 600;
    transition: all 0.2s;
}
.filter-controls .filter-btn:hover {
    background-color: var(--surface-color);
    border-color: var(--primary-color);
}
.filter-controls .filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--surface-color);
    margin: 10% auto;
    padding: 2rem;
    border-radius: 12px;
    max-width: 600px;
    position: relative;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0;}
    to { transform: translateY(0); opacity: 1;}
}

.close-btn {
    color: var(--text-color);
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
}

.signup-options {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.option-card {
    flex: 1;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    transition: border-color 0.2s, transform 0.2s;
}
.option-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
}
.option-card h4 {
    margin-bottom: 0.5rem;
}
.option-card p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.option-card small {
    display: block;
    margin-top: 1rem;
    color: var(--secondary-color);
    font-weight: bold;
}

@media (max-width: 768px) {
    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--surface-color);
        padding: 1rem 0;
        text-align: center;
    }
    nav.active ul {
        display: flex;
    }
    nav li {
        padding: 0.5rem 0;
    }
    #mobile-menu-btn {
        display: block;
    }
    .header-actions .primary-btn {
        display: none;
    }
    .hero-content h2 {
        font-size: 2.5rem;
    }
    .signup-options {
        flex-direction: column;
    }
    .section-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        margin-bottom: 2rem;
    }
    .section-header h2 {
        text-align: center;
    }
}

/* Authentication Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.auth-form h4 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-form input,
.auth-form select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: border-color 0.3s;
}

.auth-form input:focus,
.auth-form select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-form button {
    margin-top: 0.5rem;
}

.form-switch {
    text-align: center;
    margin-top: 1rem;
}

.form-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.form-switch a:hover {
    text-decoration: underline;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

/* Item Actions */
.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.favorite-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.favorite-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}

.favorite-btn .heart {
    font-size: 1.2rem;
    transition: color 0.3s;
}

.buy-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Seller Info */
.seller {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 0.25rem;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.notification-success {
    background-color: #2ed573;
}

.notification-error {
    background-color: #ff4757;
}

.notification-warning {
    background-color: #ffa502;
}

.notification-info {
    background-color: #3742fa;
}