/* =========================================
   FANOMART - Global Styles (Premium Dynamic Theme)
   ========================================= */

:root {
    --primary-color: #ff6600;
    --secondary-color: #2ecc71;
    --accent-color: #3498db; 
    --btn-gradient: linear-gradient(135deg, var(--primary-color), var(--primary-color));
    --main-font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    
    --header-bg: #ffffff;
    --footer-bg: #111418;
    --body-bg: #f4f6f9;
    --text-main: #111111;
    --text-muted: #555555;
    --white: #ffffff;
    
    --transition-fast: 0.3s ease;
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.1); 
    --border-radius: 6px;

    /* =========================================
       ADMIN-CONTROLLED BRANDING TOKENS
       -----------------------------------------
       These are the single application path for everything the admin panel
       controls under Site Settings. js/config-fetcher.js only assigns values
       to these variables; it never writes inline styles on elements.

       The values below are fallbacks used before the config loads and if it
       ever fails, so the site never renders unstyled.

       To make a new admin setting affect the UI:
         1. add a token here with a sensible default
         2. use var(--token) in the stylesheet that owns that element
         3. map the config field to the token in config-fetcher.js
       ========================================= */

    /* Logo wordmark */
    --brand-word1-color: #ff6600;
    --brand-word2-color: #2c3e50;
    --brand-word1-size: 26px;
    --brand-word2-size: 22px;
    --brand-word-gap: 2px;

    /* Navigation strip */
    --nav-bg: #111418;
    --nav-text-color: #ffffff;
    --nav-font-size: 13px;
    --nav-font-weight: 600;

    /* Header icon row */
    --header-text-color: #333333;
    --header-font-size: 14px;
    --header-font-weight: 600;

    /* Search bar */
    --search-border-color: #ff6600;
    --search-icon-color: #ffffff;
    --search-btn-bg: #ff6600;

    /* Footer
       --footer-bg falls out of the site theme (admin/theme-settings.html).
       --footer-bg-color follows it unless Site Settings sets a specific
       footer colour, so there is one chain rather than two sources fighting
       over the same surface. */
    --footer-bg-color: var(--footer-bg, #111418);
    --footer-heading-color: #1abc9c;
    --footer-link-color: #94a3b8;
    --footer-link-hover-color: #ff6600;
    --footer-text-color: #a0aab2;
    --footer-bottom-color: #64748b;
    --footer-heading-size: 14px;
    --footer-link-size: 13px;
}

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

body {
    font-family: var(--main-font);
    background-color: var(--body-bg);
    color: var(--text-main);
    line-height: 1.6;
    font-weight: 500; 
    overflow-x: hidden;
}

/* --- Links --- */
a {
    text-decoration: none;
    color: var(--text-main); 
    font-weight: 600; 
    transition: var(--transition-fast);
}

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

ul {
    list-style: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Headings --- */
h1, h2, h3, h4, h5, h6 {
    color: #000000;
    margin-bottom: 10px;
    font-weight: 800; 
}

/* --- Global Buttons (Using dynamic variables) --- */
.hero-btn, .btn-primary, .add-to-cart-dynamic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--btn-gradient) !important;
    color: var(--white) !important; 
    padding: 12px 25px;
    border: none !important;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 800; 
    cursor: pointer;
    text-align: center;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-light);
}

.hero-btn:hover, .btn-primary:hover, .add-to-cart-dynamic:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    opacity: 0.9;
}

/* --- Inputs --- */
input, select, textarea {
    font-family: var(--main-font);
    color: var(--text-main); 
    font-weight: 500;
    border: 1px solid #dddddd;
}

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

/* =========================================
   FOOTER - Professional Style
   ========================================= */
footer, .footer, #footer-placeholder > div {
    background-color: var(--footer-bg) !important;
    color: #ffffff !important;
    border-top: 4px solid var(--primary-color) !important;
    padding: 50px 0 20px;
    margin-top: 40px;
}

footer h4, .footer h4 {
    color: var(--primary-color) !important;
    margin-bottom: 20px;
    text-transform: uppercase;
    font-size: 16px;
    font-weight: 800;
}

footer a, .footer a {
    color: #a0aab2 !important;
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
}

footer a:hover, .footer a:hover {
    color: var(--primary-color) !important;
}

/* =========================================
   Mobile View: 2 Products in a Row
   ========================================= */
@media (max-width: 768px) {
    .products-grid { 
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 10px !important; 
    }

    .product-card {
        padding: 10px !important;
    }
    
    .product-card h3 {
        font-size: 12px !important;
        margin-bottom: 5px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .product-card .price {
        font-size: 14px !important;
    }
    
    /* This rule was for the full-width Add to Cart / Buy Now buttons on
       any other .product-card (there is none left without its own rule -
       see the exclusions). Without excluding the small round/pill corner
       buttons, it also caught them: the view button (S-07) stretched into
       a huge oval covering the photo, and the wishlist heart and the
       partner-link pill (shown in Partner mode) were silently stretched
       the same way. index.html and shop.html's Add to Cart / Buy Now are
       excluded too now: their own .action-buttons rule already sizes them
       for every width, and this !important padding/font-size was
       overriding the slimmer padding chosen for those two buttons,
       so they stayed at the old thickness on mobile only. */
    .product-card button:not(.card-view-btn):not(.card-wishlist-btn):not(.card-partner-btn):not(.add-cart-btn):not(.buy-now-btn),
    .product-card .hero-btn {
        padding: 8px 5px !important;
        font-size: 11px !important;
        width: 100% !important;
    }
}

/* =========================================
   Mobile View: Empty White Space & Overflow Fix
   ========================================= */
/* M-40: 'clip' stops sideways scrolling like 'hidden' did, but without
   turning the page into a scroll container, which broke position: sticky
   (the header) and could trap scrolling inside the page on mobile.
   'hidden' stays first as the fallback for older browsers. */
html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
    overflow-x: clip !important;
    position: relative;
}

* {
    box-sizing: border-box !important;
}

header, 
.header, 
#header-placeholder, 
.search-box, 
.top-nav {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden;
    overflow-x: clip !important;
}

/* =========================================
   MOBILE BOTTOM NAVIGATION BAR (100% FIX)
   ========================================= */
.app-bottom-nav {
    display: none !important; 
}

@media (max-width: 768px) {
    body, main, .container { 
        padding-bottom: 85px !important; 
    }

    .app-bottom-nav {
        display: flex !important; 
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        background-color: #ffffff !important;
        opacity: 1 !important; 
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15) !important;
        z-index: 2147483647 !important; 
        justify-content: space-around !important;
        align-items: center !important;
        padding: 12px 0 15px 0 !important;
        border-top: 1px solid #e1e8ed !important;
        margin: 0 !important;
    }

    .app-bottom-nav a {
        text-decoration: none !important;
        color: #7f8fa6 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        font-size: 11px !important;
        font-weight: bold !important;
        gap: 5px !important;
        transition: 0.3s;
        background: transparent !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .app-bottom-nav a i { 
        font-size: 22px !important; 
    }

    .app-bottom-nav a.active, 
    .app-bottom-nav a:hover, 
    .app-bottom-nav a.active i, 
    .app-bottom-nav a:hover i { 
        color: var(--primary-color) !important; 
    }

    .nav-cart-wrapper { position: relative !important; }
    .nav-cart-badge {
        position: absolute !important;
        top: -6px !important;
        right: -12px !important;
        background-color: #e74c3c !important;
        color: #ffffff !important;
        font-size: 10px !important;
        font-weight: 900 !important;
        padding: 2px 6px !important;
        border-radius: 12px !important;
        border: 2px solid #ffffff !important;
    }
}

/* ==========================================
   🦋 BUTTERFLY ANIMATION
   ========================================== */
.butterfly-icon {
    position: fixed;
    font-size: 28px;
    color: #ff6600;
    z-index: 999999;
    pointer-events: none;
    transition: none;
    filter: drop-shadow(0 4px 8px rgba(255, 102, 0, 0.3));
    animation: butterflyFloat 0.4s ease-in-out infinite alternate;
}

@keyframes butterflyFloat {
    0% { transform: translateY(0) rotate(-5deg) scale(1); }
    100% { transform: translateY(-8px) rotate(5deg) scale(1.05); }
}

.butterfly-icon.flying {
    transition: all 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.butterfly-icon.landed {
    transform: scale(0) !important;
    opacity: 0 !important;
    transition: all 0.3s ease-out;
}

.butterfly-trail {
    position: fixed;
    width: 6px;
    height: 6px;
    background: rgba(255, 102, 0, 0.3);
    border-radius: 50%;
    pointer-events: none;
    z-index: 999998;
    animation: trailFade 0.8s ease-out forwards;
}

@keyframes trailFade {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
#toast-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #2c3e50;
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transform: translateY(20px);
    animation: showToast 0.3s forwards, hideToast 0.3s forwards 2.7s;
}

.toast.success {
    background: #2ecc71;
    border-left: 4px solid #27ae60;
}

.toast.error {
    background: #e74c3c;
    border-left: 4px solid #c0392b;
}

@keyframes showToast {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes hideToast {
    to { opacity: 0; transform: translateY(-20px); }
}
/* S-07: discount badge and "view image" button on product cards.
   Badge sits top-left (the stock badge is top-right); the view button sits
   on the image's bottom-right corner, outside the card link so it opens the
   viewer instead of the product page. */
.product-card { position: relative; }
.card-discount-badge {
    position: absolute; top: 8px; left: 8px; z-index: 6;
    background: #16a34a; color: #fff; font-size: 11px; font-weight: 700;
    padding: 3px 7px; border-radius: 4px; line-height: 1.3; pointer-events: none;
}
.card-view-btn {
    position: absolute; z-index: 6; width: 32px; height: 32px; border-radius: 50%;
    border: 0; background: rgba(255,255,255,0.92); color: #2c3e50; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.card-view-btn:hover { background: #fff; color: var(--primary-color, #ff6600); }
.card-view-btn:focus-visible { outline: 2px solid var(--primary-color, #ff6600); outline-offset: 2px; }

/* The wishlist heart used to float over the image, in the same spot as the
   Partner-mode "copy link" pill. It now lives in the action-button row
   instead (index.html / shop.html's own <style>, next to Add to Cart and
   Buy Now), which is both more specific than css/components.css's old
   .wishlist-btn rule and where this file's rule does not need to be. */

/* Accessible, crawlable text that is not shown on screen. */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* S-12: partner-only card action, visible only in Partner mode. */
.card-partner-btn { display: none; position: absolute; z-index: 6; height: 30px; padding: 0 10px; border-radius: 15px; border: 0; background: #2c3e50; color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; align-items: center; gap: 6px; }
body.fano-partner-mode .card-partner-btn { display: inline-flex; }
.card-partner-btn.copied { background: #16a34a; }
.card-partner-btn:focus-visible { outline: 2px solid var(--primary-color, #ff6600); outline-offset: 2px; }

/* Accessibility floor: a visible focus ring for keyboard users, and motion
   kept to what the visitor asked for. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--primary-color, #ff6600);
    outline-offset: 2px;
    border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
