@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700;800;900&display=swap');

/* Theme: shared by every page. Variables, base styles, the site header and footer, and the product cards. */

/* CSS Variables */
:root {
    --primary: #FF4438;
    --secondary: #C796E4;
    --accent: #DCFF1C;
    --info: #7FDBFE;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    --dark: #163342;
    --text: #4C4C4C;
    --text-muted: #808080;
    --light: #FAFAFA;
    --white: #FFFFFF;
    --border: 3px solid #163342;
    --shadow: 2px 2px 0px 0px #163342;
    --shadow-hover: 6px 6px 0px 0px #163342;
    --shadow-hover-medium: 4px 4px 0px 0px #163342;
    --shadow-hover-thin: 2px 2px 0px 0px #163342;
    --shadow-active: 2px 2px 0px 0px #163342;
    --border-medium: 2px solid var(--dark);
    --border-thin: 1px solid var(--dark);
    --transition: all 0.1s ease;
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Bebas Neue', cursive;
    --font-page: 'Inter', 'Space Grotesk', sans-serif;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-page);
    background: var(--light);
    min-height: 100vh;
    color: var(--dark);
    overflow-x: hidden;
}

.neo-brutalist-theme {
    font-family: var(--font-page);
    font-weight: 400;
    line-height: 1.4;
    background-color: var(--light);
    color: var(--dark);
}

/* Main Header */
.header {
    background: var(--white);
    border-bottom: var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

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

.site-logo {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 400;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;

    & i {
        font-size: 2rem;
        color: var(--primary);
    }
}

.search-bar {
    display: flex;
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.main-search {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: var(--border);
    outline: none;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark);
    transition: var(--transition);

    &::placeholder {
        text-transform: uppercase;
    }

    &:focus {
        box-shadow: var(--shadow-hover);
        transform: translate(-2px, -2px);
    }
}

.search-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    border: var(--border);
    color: var(--white);
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 700;
    transition: var(--transition);
    box-shadow: var(--shadow);

    &:hover {
        background: var(--secondary);
        box-shadow: var(--shadow-hover);
        transform: translate(-2px, -2px);
    }

    &:active {
        box-shadow: var(--shadow-active);
        transform: translate(2px, 2px);
    }
}

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

.user-info, .cart-info, .github-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    background: var(--white);
    padding: 0.75rem 1rem;
    border: var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
}

.user-info:hover, .cart-info:hover, .github-link:hover {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-hover);
    transform: translate(-2px, -2px);
}

.github-link {
    text-decoration: none;
    font-size: 1.2rem;
}

/* Always visible at the bottom of the page */
.site-footer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 900;
    background: var(--white);
    border-top: var(--border-thin);
    padding: 0.6rem 1rem;
    text-align: center;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text);

    & a {
        color: var(--dark);
        text-decoration: underline;
    }

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

.cart-count {
    background: var(--dark);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 900;
    min-width: 20px;
    text-align: center;

    /* The script adds this for a moment when the count changes */
    &.pulse {
        transform: scale(1.3);
    }
}

/* Products Grid */
.products-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--white);
    border: var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);

    &:hover {
        box-shadow: var(--shadow-hover);
        transform: translate(-2px, -2px);
    }
}

.product-image {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.product-info h4 {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.product-price {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--primary);
    margin-bottom: 1rem;
}

.old-price {
    text-decoration: line-through;
    color: var(--dark);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--accent);
    color: var(--dark);
    border: var(--border);
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    box-shadow: var(--shadow);

    &:hover {
        background: var(--info);
        color: var(--dark);
        box-shadow: var(--shadow-hover);
        transform: translate(-2px, -2px);
    }

    &:active {
        box-shadow: var(--shadow-active);
        transform: translate(2px, 2px);
    }

    /* The script adds this for a moment after a click */
    &.pulse {
        transform: scale(0.95);
    }
}

/* The header gets two rows when the left column is narrow (the chat takes the rest of the window) */
@container (max-width: 900px) {
    .header-container {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .search-bar {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        margin: 0;
    }
}

/* Notifications. They slide in from the right and out again. */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: black;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transform: translateX(100%);
    transition: all 0.3s ease;

    &.success {
        background: var(--accent);
    }

    &.error {
        background: var(--danger);
    }

    &.visible {
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .search-bar {
        margin: 0;
        order: 3;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}
