/* Global Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    text-align: center;
    background-color: #fff3e0;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-top: 70px; /* Space for fixed header */
}

/* Common Container Styles */
.container, .ad-container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto 10px;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 500;
}

.container {
    flex: 1; /* Expand to push footer down */
}

.ad-container {
    margin-top: 10px; /* Space between container and ad-container */
}

/* Typography */
h1 {
    color: #d32f2f;
    font-size: 2em;
    margin-bottom: 20px;
}

h2 {
    color: #d32f2f;
    font-size: 1.5em;
    margin: 20px 0 10px;
}

/* Header Styles */
.header {
    background-color: #fff;
    border-bottom: 1px solid #d32f2f;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5em;
    font-weight: bold;
    color: #d32f2f;
    text-decoration: none;
}

.header-logo img {
    width: 30px;
    height: 30px;
}

.header-nav {
    display: flex;
    gap: 20px;
}

.header-nav a {
    color: #d32f2f;
    text-decoration: none;
    font-weight: bold;
    font-size: 1em;
    transition: color 0.3s;
}

.header-nav a:hover {
    color: #ffca28;
}

.header-nav a.active {
    color: #ffca28;
    border-bottom: 2px solid #ffca28;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-search input {
    padding: 8px;
    border: 1px solid #d32f2f;
    border-radius: 5px;
    font-size: 0.9em;
    width: 150px;
    max-width: 100%;
}

.header-search button {
    background-color: #ffca28;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    color: #333;
    font-size: 0.9em;
}

.header-search button:hover {
    background-color: #ffb300;
}

.hamburger {
    display: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #d32f2f;
}

.mobile-nav {
    display: none;
    background-color: #fff;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.mobile-nav a {
    color: #d32f2f;
    text-decoration: none;
    font-weight: bold;
    padding: 10px;
    font-size: 1em;
}

.mobile-nav a:hover {
    color: #ffca28;
}

.mobile-nav a.active {
    color: #ffca28;
}

/* Button Styles */
button.primary {
    background-color: #d32f2f !important;
    color: white !important;
    padding: 10px 20px !important;
    border: none !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-size: 1em !important;
    margin: 5px !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

button.primary:hover {
    background-color: #b71c1c !important;
}

/* Input Styles */
input, select {
    padding: 8px;
    border: 1px solid #d32f2f;
    border-radius: 5px;
    font-size: 1em;
    text-align: center;
}

input[type="checkbox"] {
    margin-right: 10px;
    accent-color: #d32f2f;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Ad and Affiliate Styles */
.affiliate-links, .amazon-affiliate, .adsense-placeholder, .bmac-placeholder {
    margin-top: 20px;
}

.affiliate-links a, .amazon-affiliate a, .bmac-placeholder a {
    color: #d32f2f;
    text-decoration: none;
    font-weight: bold;
}

.affiliate-links a:hover, .amazon-affiliate a:hover, .bmac-placeholder a:hover {
    text-decoration: underline;
}

.amazon-affiliate {
    padding: 10px;
    border: 1px solid #d32f2f;
    border-radius: 5px;
    background-color: #fff3e0;
}

.amazon-affiliate a, .bmac-placeholder a {
    background-color: #ffca28;
    color: #333;
    padding: 8px 15px;
    border-radius: 5px;
    margin: 5px;
    display: inline-block;
}

.adsense-placeholder {
    width: 100%;
    max-width: 728px;
    height: 90px;
    background-color: #f0f0f0;
    border: 1px solid #d32f2f;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

/* Footer Styles */
.footer {
    background-color: #fff;
    border-top: 1px solid #d32f2f;
    padding: 10px 20px 20px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section h3 {
    color: #d32f2f;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.footer-section a {
    color: #d32f2f;
    text-decoration: none;
    display: block;
    margin: 5px 0;
    font-size: 0.9em;
}

.footer-section a:hover {
    color: #ffca28;
}

.footer-newsletter form {
    display: flex;
    gap: 10px;
}

.footer-newsletter input {
    padding: 8px;
    border: 1px solid #d32f2f;
    border-radius: 5px;
    flex: 1;
    font-size: 0.9em;
}

.footer-newsletter button {
    background-color: #ffca28;
    color: #333;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.footer-newsletter button:hover {
    background-color: #ffb300;
}

.footer-copyright {
    text-align: center;
    margin-top: 20px;
    font-size: 0.8em;
    color: #666;
    width: 100%;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Pizza Builder Specific Styles */
.toppings-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.topping-item {
    display: flex;
    align-items: center;
    justify-content: flex-start !important;
    text-align: left !important;
    padding: 10px !important;
    border: 1px solid #d32f2f !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.topping-item:hover {
    background-color: #ffca28 !important;
}

.pizza-slice-container {
    position: relative;
    width: 212px;
    height: 300px;
    margin: 20px auto;
    overflow: hidden;
}

.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cheese { z-index: 0; }
.canadian-bacon { z-index: 1; display: none; }
.pepperoni { z-index: 2; display: none; }
.bacon { z-index: 3; display: none; }
.mushrooms { z-index: 4; display: none; }
.green-peppers { z-index: 5; display: none; }
.jalapenos { z-index: 6; display: none; }
.banana-peppers { z-index: 7; display: none; }
.onions { z-index: 8; display: none; }
.sausage { z-index: 9; display: none; }
.olives { z-index: 10; display: none; }
.pineapple { z-index: 11; display: none; }
.chicken { z-index: 12; display: none; }
.sauce { z-index: 13; }
.crust { z-index: 14; }

#pizza-result {
    margin-top: 20px;
    font-size: 1.2em;
    color: #2e7d32;
    animation: fadeIn 1s;
}

/* Pizza Builder Input Group (Restored from original) */
.input-group.pizza-builder {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.input-group.pizza-builder input {
    width: 60px !important;
    padding: 8px !important;
    border: 1px solid #d32f2f !important;
    border-radius: 5px !important;
    text-align: center !important;
    margin: 0 10px !important;
    font-size: 1em !important;
}

.input-group.pizza-builder label {
    font-weight: bold;
    font-size: 1.1em;
}

/* Pizza Calculator Specific Styles */
.input-group:not(.pizza-builder) {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.input-group:not(.pizza-builder) button {
    background-color: #d32f2f;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    margin: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.input-group:not(.pizza-builder) button:hover {
    background-color: #ffca28;
    color: #333;
}

.input-group:not(.pizza-builder) button:active {
    transform: scale(0.95);
}

#result {
    margin-top: 20px;
    font-size: 1.2em;
    color: #2e7d32;
    animation: fadeIn 1s;
}

label:not(.topping-item) {
    display: block;
    margin: 15px 0 5px;
    font-weight: bold;
    font-size: 1.1em;
}

/* Pizza Finder Specific Styles */
.map-wrapper {
    position: relative;
    z-index: 1000;
    overflow: hidden;
    height: 400px;
}

#map-container {
    position: sticky;
    top: 70px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#map {
    height: 400px;
    width: 100%;
    border-radius: 8px;
}

.content-below-map {
    position: relative;
    z-index: 500;
    margin-top: 10px;
}

.search-form {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.search-form input,
.search-form select,
.search-form button {
    padding: 10px;
    font-size: 1em;
    border: 1px solid #d32f2f;
    border-radius: 5px;
}

.search-form input {
    flex: 1;
}

.search-form button {
    background-color: #d32f2f;
    color: white;
    border: none;
    cursor: pointer;
}

.search-form button:hover {
    background-color: #b71c1c;
}

#results {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

.result-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-nav, .header-search {
        display: none;
    }

    .hamburger {
        display: block;
    }

    .mobile-nav.active {
        display: flex;
    }

    .header-search input {
        width: 100%;
        max-width: none;
    }

    .footer {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.5em;
    }

    body {
        padding-top: 65px;
    }

    .container, .ad-container {
        padding: 15px;
        margin-bottom: 5px;
    }

    .ad-container {
        margin-top: 5px;
    }

    .footer {
        padding: 10px 15px 20px;
    }

    .footer-newsletter form {
        flex-direction: column;
    }

    .footer-newsletter input,
    .footer-newsletter button {
        width: 100%;
    }

    .pizza-slice-container {
        width: 159px;
        height: 225px;
    }

    .input-group:not(.pizza-builder) {
        flex-wrap: wrap;
    }

    .input-group:not(.pizza-builder) button {
        width: 25px;
        height: 25px;
        font-size: 1em;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form input,
    .search-form select,
    .search-form button {
        width: 100%;
    }

    #map {
        height: 300px;
    }

    .map-wrapper {
        height: 300px;
    }

    .content-below-map {
        margin-top: 5px;
    }

    #results {
        margin-top: 5px;
    }

    .amazon-affiliate,
    .adsense-placeholder {
        max-width: 100%;
    }
}