/* EduStore Sénégal — Feuille de styles */
:root {
    --edu-blue: #1a56db;
    --edu-blue-light: #3b82f6;
    --edu-dark: #1e3a8a;
    --bg-color: #f0f4ff;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --danger: #ef4444;
    --success: #10b981;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding-bottom: 20px;
}

/* === PWA INSTALL BANNER === */
#pwa-install-banner {
    background: linear-gradient(135deg, var(--edu-dark), var(--edu-blue));
    color: white;
    padding: 10px 15px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
    z-index: 200;
    position: sticky;
    top: 0;
}
.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 600px;
    width: 100%;
}
.pwa-banner-content span { flex: 1; font-weight: 500; }
#pwa-install-btn {
    background: white;
    color: var(--edu-dark);
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}
#pwa-close-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}

/* === AD BANNER === */
#ad-banner {
    background: var(--edu-blue);
    color: white;
    padding: 8px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

/* === HERO BANNER === */
header.main-hero-banner {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(rgba(26,86,219,0.5), rgba(30,58,138,0.85)), url('images/hero_bg.png');
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 -10px 20px rgba(0,0,0,0.2);
}
header.main-hero-banner img#store-logo {
    max-width: 120px; max-height: 120px; object-fit: contain;
    border-radius: 50%; display: block; margin: 5px auto;
    border: 3px solid white; box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
header.main-hero-banner h1#store-name-title {
    text-align: center; font-size: 2.2rem; color: white;
    margin-top: 15px; text-shadow: 2px 2px 4px rgba(0,0,0,0.6); font-weight: 700;
}
header.main-hero-banner p.store-tagline {
    color: rgba(255,255,255,0.95); font-size: 1.1rem; margin-top: 8px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5); font-weight: 500;
}

/* === TOP NAV === */
.top-nav {
    background-color: var(--edu-dark);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.shop-info { display: flex; align-items: center; gap: 12px; }
.shop-avatar img { width: 38px; height: 38px; border-radius: 50%; border: 2px solid white; }
.shop-text h1 { font-size: 1rem; font-weight: 600; }
.shop-text p { font-size: 0.75rem; color: rgba(255,255,255,0.8); }

.icon-btn { background: transparent; border: none; color: white; font-size: 1.2rem; position: relative; cursor: pointer; padding: 4px; }

.lang-btn {
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    transition: background 0.2s;
}
.lang-btn:hover { background: rgba(255,255,255,0.25); }

#cart-count {
    position: absolute; top: -8px; right: -8px;
    background-color: var(--edu-blue-light); color: white;
    font-size: 0.7rem; font-weight: bold;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: flex; justify-content: center; align-items: center; padding: 0 4px;
}

/* === CATÉGORIES === */
.categories-wrapper {
    background: white; padding: 10px 0;
    position: sticky; top: 58px; z-index: 99;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.categories-scroll {
    display: flex; overflow-x: auto; padding: 0 15px; gap: 8px;
    scrollbar-width: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }
.cat-pill {
    white-space: nowrap; padding: 7px 14px; border-radius: 20px;
    border: 1px solid var(--border-color); background: white;
    color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; flex-shrink: 0;
}
.cat-pill.active { background: var(--edu-blue); color: white; border-color: var(--edu-blue); }

/* === FILTRE NIVEAU SCOLAIRE (pills bar) === */
.niveau-filter {
    background: #f8faff; padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}
.niveau-scroll {
    display: flex; overflow-x: auto; padding: 0 15px; gap: 6px;
    scrollbar-width: none;
}
.niveau-scroll::-webkit-scrollbar { display: none; }
.niveau-pill {
    white-space: nowrap; padding: 5px 12px; border-radius: 15px;
    border: 1px solid #c7d7f9; background: white;
    color: var(--edu-blue); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; flex-shrink: 0;
}
.niveau-pill.active { background: var(--edu-dark); color: white; border-color: var(--edu-dark); }

/* === PANNEAU FILTRES LIVRES === */
#livres-filter-panel {
    border-bottom: 2px solid var(--border-color);
    background: white;
}
.filter-group { border-bottom: 1px solid #f0f4ff; padding: 10px 0; }
.filter-group-title {
    padding: 4px 12px 8px;
    font-size: 0.78rem; font-weight: 700;
    color: var(--edu-dark); text-transform: uppercase; letter-spacing: 0.5px;
}
.filter-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px; cursor: pointer; font-size: 0.85rem;
    color: var(--text-main); transition: background 0.15s; gap: 6px;
}
.filter-item:hover { background: #f0f4ff; }
.filter-item.active { color: var(--edu-blue); font-weight: 600; background: #eff6ff; }
.filter-item-label { flex: 1; }
.filter-item-count {
    font-size: 0.72rem; color: var(--text-muted);
    background: #f0f4ff; padding: 1px 6px; border-radius: 10px;
    min-width: 20px; text-align: center;
}
.filter-item.active .filter-item-count { background: var(--edu-blue); color: white; }

/* Breadcrumb */
#livres-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.bc-item { color: var(--edu-blue); cursor: pointer; }
.bc-item:hover { text-decoration: underline; }
.bc-sep { color: var(--text-muted); }
.bc-current { color: var(--text-main); font-weight: 600; }

/* === PRODUCT CARD — livres enrichie === */
.book-card .product-img { height: 160px; object-fit: contain; background: #f8faff; padding: 10px; }
.product-meta { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.product-meta .editeur-tag { color: var(--edu-blue); font-weight: 600; }
.product-meta .classe-tag { }
.product-isbn { font-size: 0.68rem; color: #aaa; margin-top: 2px; font-family: monospace; }

/* Chips de filtres actifs */
.active-filters {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 8px 15px; background: #f8faff;
    border-bottom: 1px solid var(--border-color);
}
.active-filter-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--edu-blue); color: white;
    padding: 3px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 500;
}
.active-filter-chip button {
    background: none; border: none; color: rgba(255,255,255,0.8);
    cursor: pointer; padding: 0; font-size: 0.9rem; line-height: 1;
}

/* Résultats compteur */
.results-header {
    padding: 10px 15px 0;
    font-size: 0.82rem; color: var(--text-muted);
    max-width: 1200px; margin: 0 auto;
}

/* Layout livres desktop : sidebar + grille */
@media (min-width: 768px) {
    #livres-filter-panel > div:last-child { /* le div flex */
        /* sidebar is always shown on desktop */
    }
    #livres-sidebar { display: block !important; }
    #cycle-pills-bar { display: none !important; }
}
@media (max-width: 767px) {
    #livres-sidebar { display: none !important; }
    #cycle-pills-bar { display: block !important; }
}

/* === GRILLE PRODUITS === */
.products-container {
    padding: 15px; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 12px; max-width: 1200px; margin: 0 auto;
}
.product-card { background: var(--card-bg); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; flex-direction: column; position: relative; transition: transform 0.2s, box-shadow 0.2s; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(26,86,219,0.15); }
.product-img { width: 100%; height: 130px; object-fit: cover; background: #f0f0f0; }
.product-info { padding: 10px; display: flex; flex-direction: column; flex-grow: 1; }
.product-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; color: var(--text-main); }
.product-price { font-size: 0.9rem; font-weight: 700; color: var(--edu-dark); margin-bottom: 6px; }
.product-niveau { font-size: 0.72rem; color: var(--edu-blue); background: #eff6ff; padding: 2px 7px; border-radius: 10px; display: inline-block; margin-bottom: 8px; font-weight: 500; }
.add-btn {
    margin-top: auto; background: white; border: 1.5px solid var(--edu-blue);
    color: var(--edu-blue); padding: 7px; border-radius: 6px;
    font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
}
.add-btn:active, .add-btn:hover { background: var(--edu-blue); color: white; }

/* Overlay rupture */
.oos-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.75); display: flex; justify-content: center;
    align-items: center; z-index: 3; font-weight: bold; color: var(--danger);
    font-size: 1.1rem; text-transform: uppercase; pointer-events: none;
}
/* Badge collection */
.collection-badge {
    position: absolute; top: 8px; right: 8px;
    background: var(--edu-blue); color: white;
    padding: 3px 7px; border-radius: 10px; font-size: 0.65rem;
    font-weight: bold; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
/* Badge niveau */
.niveau-badge {
    position: absolute; top: 8px; left: 8px;
    background: #1e3a8a; color: white;
    padding: 3px 7px; border-radius: 10px; font-size: 0.6rem;
    font-weight: bold; z-index: 2;
}

/* === PANIER === */
.cart-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000; opacity: 0;
    pointer-events: none; transition: opacity 0.3s;
}
.cart-overlay.show { opacity: 1; pointer-events: all; }
.cart-bottom-sheet {
    position: fixed; bottom: -100%; left: 0; width: 100%; max-height: 85vh;
    background: white; border-top-left-radius: 20px; border-top-right-radius: 20px;
    z-index: 1001; display: flex; flex-direction: column;
    transition: bottom 0.3s ease-in-out; box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
}
.cart-bottom-sheet.show { bottom: 0; }
@media (min-width: 768px) {
    .cart-bottom-sheet { width: 400px; left: auto; right: 20px; bottom: -100%; border-radius: 20px; max-height: 80vh; }
    .cart-bottom-sheet.show { bottom: 20px; }
}
.cart-header { padding: 18px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.cart-header h2 { font-size: 1.1rem; }
.close-btn { color: var(--text-muted); font-size: 1.4rem; }
.cart-items { padding: 12px 18px; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; gap: 12px; }
.cart-item { display: flex; align-items: center; gap: 12px; }
.cart-item img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.cart-item-details { flex-grow: 1; }
.cart-item-details h4 { font-size: 0.85rem; margin-bottom: 2px; }
.cart-item-details p { font-size: 0.8rem; color: var(--edu-dark); font-weight: 600; }
.qty-control { display: flex; align-items: center; gap: 8px; background: #f0f4ff; border-radius: 20px; padding: 4px; }
.qty-btn { background: white; border: none; width: 24px; height: 24px; border-radius: 50%; font-weight: bold; color: var(--edu-dark); cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.1); font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.cart-footer { padding: 15px 18px; border-top: 1px solid var(--border-color); background: #f0f4ff; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; }
.cart-total-row { display: flex; justify-content: space-between; font-size: 1.05rem; font-weight: 600; margin-bottom: 12px; }
.empty-cart { text-align: center; color: var(--text-muted); padding: 35px 0; }

/* === BOUTONS === */
.edu-btn {
    width: 100%; background: var(--edu-blue); color: white; border: none;
    padding: 13px; border-radius: 25px; font-size: 0.95rem; font-weight: 600;
    display: flex; justify-content: center; align-items: center; gap: 8px;
    cursor: pointer; box-shadow: 0 2px 5px rgba(59,130,246,0.4); transition: background 0.2s;
    text-decoration: none;
}
.edu-btn:active, .edu-btn:hover { background: var(--edu-dark); }

/* === MODALS === */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal.show { display: flex; }
.modal-card { background: white; width: 90%; max-width: 500px; padding: 25px; border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.form-group { margin-bottom: 13px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 0.88rem; color: #444; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 11px 13px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-family: inherit; font-size: 0.95rem; box-sizing: border-box; outline: none; transition: border 0.2s; }
.form-group input:focus, .form-group select:focus { border-color: var(--edu-blue); }

/* Modes de paiement */
.pay-method-card {
    flex: 1; border: 2px solid #e9edef; border-radius: 12px; text-align: center;
    padding: 10px 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem;
    transition: 0.2s; color: #666; min-width: 80px;
}
.pay-method-card.active { border-color: var(--edu-blue); background: #eff6ff; color: var(--edu-dark); }
.payment-info-box { margin-top: 10px; padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; line-height: 1.5; }
.payment-wave { background: #e8f0fe; color: #1a56db; border-left: 3px solid #1a56db; }
.payment-orange { background: #fff3e0; color: #e65100; border-left: 3px solid #e65100; }

/* === TOAST === */
.toast {
    position: fixed; bottom: 20px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main); color: white;
    padding: 10px 20px; border-radius: 20px; font-size: 0.88rem;
    transition: transform 0.3s; z-index: 2000;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* === CHATBOT === */
#chatbot-btn {
    position: fixed; bottom: 22px; right: 22px;
    width: 56px; height: 56px; background-color: var(--edu-blue);
    color: white; border-radius: 50%; display: flex; justify-content: center;
    align-items: center; font-size: 1.6rem; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 9999; transition: transform 0.2s, box-shadow 0.2s;
}
#chatbot-btn:hover { transform: scale(1.05) translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
#chatbot-badge {
    position: absolute; top: -2px; right: -2px; background-color: red; color: white;
    font-size: 0.75rem; font-weight: bold; width: 20px; height: 20px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; border: 2px solid white;
}
#chatbot-window {
    position: fixed; bottom: 88px; right: 22px; width: 330px; background: white;
    border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); z-index: 10000;
    display: none; flex-direction: column; overflow: hidden;
    transform-origin: bottom right; animation: chatPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid #e9edef;
}
@keyframes chatPop { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
#chatbot-header { background: var(--edu-dark); color: white; padding: 13px 18px; display: flex; justify-content: space-between; align-items: center; }
#chatbot-header-info { display: flex; align-items: center; gap: 10px; }
#chatbot-avatar { width: 36px; height: 36px; background: white; color: var(--edu-dark); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.2rem; }
#chatbot-close { cursor: pointer; font-size: 1.4rem; color: rgba(255,255,255,0.8); }
#chatbot-messages { padding: 15px; height: 300px; overflow-y: auto; background: var(--bg-color); display: flex; flex-direction: column; gap: 10px; }
.chat-msg { padding: 10px 13px; border-radius: 12px; max-width: 85%; font-size: 0.9rem; line-height: 1.4; word-wrap: break-word; }
.chat-bot { background: white; align-self: flex-start; border-top-left-radius: 0; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.chat-user { background: #dbeafe; align-self: flex-end; border-top-right-radius: 0; }
.chat-opt { display: block; width: 100%; text-align: left; background: white; border: 1px solid var(--edu-blue); color: var(--edu-blue); padding: 8px 12px; border-radius: 18px; margin-top: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: all 0.2s; }
.chat-opt:hover { background: var(--edu-blue); color: white; }
#chatbot-input-area { display: flex; padding: 12px; background: white; gap: 8px; }
#chatbot-input { flex: 1; border: none; background: #f0f4ff; padding: 10px 16px; border-radius: 22px; font-size: 0.9rem; outline: none; }
#chatbot-send { background: var(--edu-blue); color: white; border: none; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; font-size: 1rem; display: flex; justify-content: center; align-items: center; }

/* === DEVIS SECTION === */
.devis-section {
    background: white; margin: 15px; border-radius: 12px;
    padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--edu-blue);
}
.devis-section h3 { color: var(--edu-dark); margin-bottom: 8px; font-size: 1rem; }
.devis-section p { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 12px; }

/* === ANIMATIONS === */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; }

/* === RESPONSIVE === */
@media (max-width: 400px) {
    .products-container { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px; }
    .pay-method-card { padding: 8px 4px; font-size: 0.75rem; }
    header.main-hero-banner h1#store-name-title { font-size: 1.7rem; }
}
@media (min-width: 1024px) {
    .products-container { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .product-img { height: 160px; }
}

.hide-scrollbar { scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }
