/* ========================================
   AMERICAN MEAT - SHARED STYLES
   Version: 2.0 - Firebase Integration
======================================== */

/* Import Google Fonts and Font Awesome */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');
/* Font Awesome loaded via <link> tag in each HTML file with SRI integrity hash */

/* ========================================
   ROOT VARIABLES & RESETS
======================================== */
:root {
    --primary-color: #2c6e7f;
    --secondary-color: #f4a261;
    --hover-color: #1f4b57;
    --accent-red: #bb0000;
    --accent-red-hover: #c01818;
    --text-color: #333;
    --background-color: #f0f4f8;
    --background-color-alt: #e8ecef;
    --card-background: #ffffff;
    --border-color: #ddd;
    --error-color: #f44336;
    --warning-color: #ffc107;
    --success-color: #4CAF50;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', Arial, sans-serif;
    margin: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(187, 0, 0, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(44, 110, 127, 0.03) 0%, transparent 50%),
        linear-gradient(135deg, var(--background-color) 0%, var(--background-color-alt) 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-width: 320px;
    position: relative;
    overflow-x: hidden;
}

/* Subtle marble texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.02) 10px,
            rgba(255, 255, 255, 0.02) 20px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 10px,
            rgba(0, 0, 0, 0.01) 10px,
            rgba(0, 0, 0, 0.01) 20px
        );
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}


/* Ensure content stays above background */
body > * {
    position: relative;
    z-index: 1;
}

html {
    scroll-behavior: smooth;
}

/* ========================================
   HEADER & NAVIGATION
======================================== */
header {
    background: var(--card-background);
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 400;
}

/* Star clipping container - prevents stars from overflowing */
header .star-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* Star shape for header */
.star {
    position: absolute;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    background: rgba(187, 0, 0, 0.4);
    pointer-events: none;
    z-index: 0;
}

/* Individual stars created with pseudo-elements inside star container */
header .star-container::before {
    content: '';
    position: absolute;
    top: 25%;
    left: 2%;
    width: 72px;
    height: 72px;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    background: rgba(187, 0, 0, 0.4);
    animation: starTwinkle1 4s ease-in-out infinite;
    transform: rotate(15deg);
    pointer-events: none;
}

header .star-container::after {
    content: '';
    position: absolute;
    top: 60%;
    left: 18%;
    width: 48px;
    height: 48px;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    background: rgba(187, 0, 0, 0.4);
    animation: starTwinkle2 5s ease-in-out infinite;
    transform: rotate(-25deg);
    pointer-events: none;
}

@keyframes starTwinkle1 {
    0%, 100% {
        opacity: 0.4;
        transform: rotate(15deg) scale(1);
        filter: brightness(1);
    }
    50% {
        opacity: 0.8;
        transform: rotate(15deg) scale(1.05);
        filter: brightness(1.3);
    }
}

@keyframes starTwinkle2 {
    0%, 100% {
        opacity: 0.35;
        transform: rotate(-25deg) scale(1);
        filter: brightness(1);
    }
    50% {
        opacity: 0.75;
        transform: rotate(-25deg) scale(1.08);
        filter: brightness(1.4);
    }
}

@keyframes starTwinkle3 {
    0%, 100% {
        opacity: 0.4;
        transform: rotate(10deg) scale(1);
        filter: brightness(1);
    }
    50% {
        opacity: 0.7;
        transform: rotate(10deg) scale(1.06);
        filter: brightness(1.25);
    }
}

/* Ensure header content stays above stars */
header > * {
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.logo-icon {
    width: 90px;
    height: 90px;
    display: block;
    transition: transform 0.3s ease;
    margin-bottom: -10px;
}

.logo-icon:hover {
    transform: scale(1.05);
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Navigation */
nav ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
}

nav ul li {
    margin: 0;
}

nav ul li a {
    text-decoration: none;
    color: var(--primary-color);
    background: white;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 6px;
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
    display: inline-block;
}

nav ul li a:hover {
    background: #d6e9f0;
}

nav ul li a.active {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}

nav ul li a.active:hover {
    background: var(--accent-red);
}

#cart-link i {
    margin-right: 5px;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 15px;
    top: 20px;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ========================================
   FOOTER
======================================== */
footer {
    text-align: center;
    padding: 20px;
    background: var(--card-background);
    margin-top: 20px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
}

.footer-contact-link,
.footer-faq-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.footer-contact-link:hover,
.footer-faq-link:hover {
    color: var(--hover-color);
}

/* ========================================
   BUTTONS & COMMON COMPONENTS
======================================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #f5f5f5;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

/* ========================================
   LOADING & ERROR STATES
======================================== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-container {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.error {
    background-color: #ffebee;
    border: 1px solid var(--error-color);
    color: #d32f2f;
}

.warning {
    background-color: #fff8e1;
    border: 1px solid var(--warning-color);
    color: #ff8f00;
}

.success {
    background-color: #e8f5e8;
    border: 1px solid var(--success-color);
    color: #2e7d32;
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */
@media (max-width: 1024px) {
    header {
        padding: 15px;
    }

    .logo {
        /* Logo stays centered in full header width */
        margin-left: auto;
        margin-right: auto;
    }

    .logo-text {
        font-size: 1.4rem;
    }

    .logo-icon {
        width: 70px;
        height: 70px;
        margin-bottom: -10px;
    }

    .hamburger {
        display: flex;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 101;
    }

    /* Adjust star sizes on mobile */
    header::before {
        width: 50px;
        height: 50px;
    }

    header::after {
        width: 36px;
        height: 36px;
    }

    .star {
        width: 40px !important;
        height: 40px !important;
    }

    /* Reposition specific stars to prevent overlap */
    .star-1 { left: 20% !important; }
    .star-2 {
        left: 35% !important;
        width: 50px !important;
        height: 50px !important;
    }
    .star-3 { left: 55% !important; }
    .star-4 {
        left: 75% !important;
        width: 48px !important;
        height: 48px !important;
    }
    .star-5 { left: 90% !important; }
    .star-6 {
        left: 95% !important;
        width: 38px !important;
        height: 38px !important;
    }
    .star-7 {
        left: 40% !important;
        width: 44px !important;
        height: 44px !important;
    }
    .star-8 {
        left: 70% !important;
        width: 40px !important;
        height: 40px !important;
    }

    #main-nav {
        display: none;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        z-index: 99;
    }

    #main-nav.active {
        display: block;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        margin: 10px 0;
        gap: 8px;
    }

    nav ul li {
        margin: 0;
        width: 90%;
    }

    nav ul li a {
        font-size: 1rem;
        width: 100%;
        text-align: center;
    }
}

/* ========================================
   UTILITY CLASSES
======================================== */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }
.visible { display: block; }

/* Focus states for accessibility */
button:focus,
select:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ========================================
   PROMOTIONAL DISCOUNT BANNER
======================================== */
.promo-banner {
    background: #bb0000;
    color: white;
    overflow: hidden;
    padding: 8px 0;
    position: relative;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    z-index: 1;
    /* Stretch full width inside header's padding, flush with bottom edge */
    margin: 10px -20px -20px -20px;
}

.promo-banner-track {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: promoBannerScroll 30s linear infinite;
}

.promo-banner:hover .promo-banner-track {
    animation-play-state: paused;
}

.promo-banner-item {
    flex-shrink: 0;
    padding: 0 1.5rem;
}

.promo-banner-item .promo-text {
    letter-spacing: 0.3px;
}

.promo-banner-item .promo-text strong {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.promo-banner-separator {
    flex-shrink: 0;
    opacity: 0.5;
    font-size: 0.7rem;
}

@keyframes promoBannerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@media (max-width: 768px) {
    .promo-banner {
        font-size: 0.8rem;
        padding: 6px 0;
    }

    .promo-banner-track {
        animation-duration: 20s;
    }
}