/* FairPrice Custom Styles */

/* ===== CSS VARIABLES ===== */
:root {
    /* Color palette - Brutalist/Dark */
    --color-primary: #2c3539;
    --color-primary-hover: #1a1f22;
    --color-accent: #e8a568;
    --color-success: #5f8572;
    --color-danger: #c96955;

    /* Navigation colors */
    --nav-color: rgba(255, 255, 255, 0.9);
    --nav-color-hover: rgba(255, 255, 255, 1);

    /* Pico overrides */
    --pico-primary: var(--color-primary);
    --pico-primary-hover: var(--color-primary-hover);
    --pico-primary-focus: rgba(44, 53, 57, 0.125);
}

/* ===== GLOBAL STYLES ===== */

/* Prevent layout shift from font loading */
* {
    font-display: swap;
}

/* Prevent CLS by ensuring body has defined dimensions */
body {
    min-height: 100vh;
}

/* Prevent flash of unstyled content */
main {
    opacity: 1;
}

/* Global h1 styling */
h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--color-accent);
    font-weight: 700;
}

/* ===== NAVIGATION ===== */

/* Brand/logo */
.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--nav-color) !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

.brand:hover {
    color: var(--nav-color-hover) !important;
}

/* Navigation links */
nav a:not([role="button"]):not(.brand) {
    color: var(--nav-color);
    position: relative;
    transition: color 0.2s ease;
    text-decoration: none;
}

nav a:not([role="button"]):not(.brand):hover {
    color: var(--nav-color-hover);
}

/* Animated underline for nav links */
nav a:not([role="button"]):not(.brand)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--color-accent);
    transition: width 0.3s ease;
}

nav a:not([role="button"]):not(.brand):hover::after {
    width: 100%;
}

/* ===== BUTTONS ===== */

/* Primary button */
.btn-gradient {
    background: var(--color-primary);
    border: none;
    color: white;
    transition: all 0.2s ease;
}

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

/* Hero CTA button */
.btn-hero {
    background: var(--color-primary);
    border: none;
    color: white;
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.btn-hero:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
    color: white;
}

/* Outline button */
.btn-outline {
    background-color: transparent;
    color: var(--nav-color);
    border: 1px solid var(--pico-muted-border-color);
    padding: 1rem 2.5rem;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--nav-color-hover);
}

.outline-primary {
    background-color: transparent;
    border: 1px solid var(--pico-primary);
}

.outline-primary:hover {
    background-color: var(--pico-primary-focus);
}

/* Success button */
.success {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.success:hover {
    background-color: #4d7160;
    border-color: #4d7160;
}

/* Small buttons */
button.small, a.small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* ===== BADGES ===== */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background-color: rgba(95, 133, 114, 0.15);
    color: var(--color-success);
}

.badge-danger {
    background-color: rgba(201, 105, 85, 0.15);
    color: var(--color-danger);
}

.badge-warning {
    background-color: rgba(232, 165, 104, 0.15);
    color: var(--color-accent);
}

.badge-info {
    background-color: rgba(44, 53, 57, 0.15);
    color: var(--pico-color);
}

/* ===== CARDS & SECTIONS ===== */

/* Standard card */
.card {
    padding: 3rem 2.5rem;
    background: var(--pico-card-background-color);
    border-radius: 1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.card-sm {
    padding: 2rem;
}

.card-accent {
    border: 2px solid var(--color-accent);
}

/* Content section wrapper */
.section {
    padding: 3rem 2rem;
    background: var(--pico-card-background-color);
    border-radius: 1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 3rem;
}

/* Reusable tile/card styles */
.tile {
    padding: 2rem;
    background: var(--pico-card-background-color);
    border-radius: 1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
}

/* ===== PROMOTIONAL COMPONENTS ===== */

.promo-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.promo-banner {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.price-crossed {
    font-size: 2rem;
    font-weight: 700;
    color: var(--pico-muted-color);
    text-decoration: line-through;
    opacity: 0.6;
}

.price-promo {
    font-size: 3.5rem;
    font-weight: 700;
    color: #ff6b6b;
}

.savings-badge {
    background: #ffe5e5;
    color: #d63031;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: inline-block;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== TYPOGRAPHY UTILITIES ===== */

.text-muted {
    opacity: 0.7;
}

.text-muted-light {
    opacity: 0.8;
}

.text-muted-lighter {
    opacity: 0.9;
}

.text-accent {
    color: var(--color-accent);
}

.text-success {
    color: var(--color-success);
}

.text-danger {
    color: var(--color-danger);
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.25rem;
}

.text-xl {
    font-size: 1.5rem;
}

.text-2xl {
    font-size: 1.75rem;
}

.text-3xl {
    font-size: 2.5rem;
}

.text-4xl {
    font-size: 3rem;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

/* ===== SPACING UTILITIES ===== */

/* Margins */
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 2.5rem; }
.mb-6 { margin-bottom: 3rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 2.5rem; }
.mt-6 { margin-top: 3rem; }

/* Padding */
.p-2 { padding: 2rem; }
.p-3 { padding: 3rem; }

.px-2 { padding-left: 2rem; padding-right: 2rem; }
.px-3 { padding-left: 3rem; padding-right: 3rem; }

.py-2 { padding-top: 2rem; padding-bottom: 2rem; }
.py-3 { padding-top: 3rem; padding-bottom: 3rem; }

/* ===== LAYOUT UTILITIES ===== */

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-gap-1 {
    gap: 1rem;
}

.flex-gap-2 {
    gap: 2rem;
}

/* ===== GRID LAYOUTS ===== */

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* ===== LINK UTILITIES ===== */

/* Animated underline for content links */
.link-animated {
    position: relative;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.link-animated:hover {
    border-bottom-color: var(--color-accent);
}

/* Default hover effect for all content links (not nav, not buttons) */
main a:not([role="button"]):not(.no-hover) {
    color: var(--nav-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
}

main a:not([role="button"]):not(.no-hover):hover {
    color: var(--nav-color-hover);
}

main a:not([role="button"]):not(.no-hover)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--color-accent);
    transition: width 0.3s ease;
}

main a:not([role="button"]):not(.no-hover):hover::after {
    width: 100%;
}

/* ===== COMPONENTS ===== */

/* Feature boxes for "How it Works" sections */
.feature-box {
    text-align: center;
}

.feature-icon {
    background: var(--color-primary);
    color: white;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.feature-icon.success {
    background: var(--color-success);
}

.feature-title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.feature-description {
    opacity: 0.8;
    font-size: 0.95rem;
}

/* Info boxes with left border */
.info-box {
    padding: 1.5rem;
    background: var(--pico-background-color);
    border-radius: 0.5rem;
}

.info-box.border-danger {
    border-left: 3px solid var(--color-danger);
}

.info-box.border-success {
    border-left: 3px solid var(--color-success);
}

.info-box.border-accent {
    border-left: 3px solid var(--color-accent);
    border: 2px solid var(--color-accent);
}

/* Why FairPrice grid items */
.why-item {
    text-align: center;
}

.why-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.why-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.why-description {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Link box for sharing */
.link-box {
    background-color: var(--pico-card-background-color);
    border: 2px dashed var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 1.5rem;
    text-align: center;
    margin: 1.5rem 0;
}

.link-box input {
    font-family: monospace;
    text-align: center;
    margin-bottom: 1rem;
}

/* Spinner animation */
.spinner {
    border: 4px solid var(--pico-muted-border-color);
    border-top: 4px solid var(--pico-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Flash messages */
.flash-messages {
    margin: 1rem auto;
    max-width: 1200px;
}

/* ===== MOBILE/RESPONSIVE ===== */

/* Responsive breakpoints */
@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Mobile hamburger menu */
.hamburger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--pico-color);
    margin: 5px 0;
    transition: 0.3s;
}

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

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

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

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    nav ul:last-child {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--pico-card-background-color);
        flex-direction: column;
        padding: 5rem 2rem 2rem;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        transition: right 0.3s ease;
        z-index: 1000;
        margin: 0;
    }

    nav ul:last-child.active {
        right: 0;
    }

    nav ul:last-child li {
        width: 100%;
        margin: 0.5rem 0;
    }

    nav ul:last-child li a,
    nav ul:last-child li details {
        width: 100%;
    }

    nav ul:last-child li a[role="button"] {
        text-align: center;
    }

    /* Mobile overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .mobile-overlay.active {
        display: block;
    }

    h1 {
        font-size: 2rem !important;
    }

    .btn-hero {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }
}

/* ===== FOOTER ===== */

footer.site-footer {
    text-align: center;
    padding: 3rem 2rem;
    border-top: 1px solid var(--pico-muted-border-color);
    margin-top: 4rem;
    background: rgba(0, 0, 0, 0.2);
}

.footer-links {
    margin-bottom: 2rem;
    font-size: 1rem;
}

.footer-links a {
    color: var(--nav-color) !important;
    margin: 0 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    position: relative;
}

.footer-links a:hover {
    color: var(--nav-color-hover) !important;
}

.footer-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--color-accent);
    transition: width 0.3s ease;
}

.footer-links a:hover::after {
    width: 100%;
}

.footer-separator {
    opacity: 0.4;
    margin: 0 0.5rem;
    color: var(--nav-color);
}

.footer-badge {
    margin: 2rem 0;
}

.footer-badge img {
    width: 250px;
    height: 54px;
    transition: opacity 0.2s ease;
}

.footer-badge img:hover {
    opacity: 0.8;
}

footer small {
    opacity: 0.8;
    font-size: 0.9rem;
    line-height: 1.6;
}

footer small a {
    color: var(--nav-color) !important;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

footer small a:hover {
    color: var(--nav-color-hover) !important;
}
