/* ============================================
   1. IMPORTS & FONTS
============================================ */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ============================================
   2. VARIABLES GLOBALES
============================================ */
:root {
    --primary: #1d5cbb;
    --secondary: #aebdd8;
    --accent: #FF6B00;
    --accent-light: #FF8C35;
    --accent-glow: rgba(255, 107, 0, 0.28);
    --blue: #1E5FBF;
    --blue-light: #3A7FE8;
    --light: #F8F9FC;
    --white: #ffffff;
    --success: #00B37E;
    --danger: #E63946;
    --mid-gray: #8894A8;
    --border: #3A7FE8;
    --shadow-sm: blue;
    --shadow-md: #3A7FE8;
    --shadow-lg: #3A7FE8;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 32px;
    --transition: all 0.3s ease;
    --font-display: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
}

/* ============================================
   3. RESET & BASE
============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Structure globale pour que le footer reste en bas */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
     width: 100%;
      display: flex;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
     width: 100%;
}

.main-content {
    flex: 1;  /* Pousse le footer vers le bas */
    padding: 2rem;
    max-width: 14000px;
    margin: 800px ;
    width: 100%;
}

.site-footer {
    margin-top: auto;  /* Colle le footer en bas */
    width: 100%;
}

/* ============================================
   4. SCROLLBAR
============================================ */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

/* ============================================
   5. HEADER & NAVIGATION
============================================ */
.main-header {
    background: var(--primary);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 8px 24px;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.logo-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-box img {
    height: 38px;
    width: auto;
}

.logo-box h2 {
    color: var(--white);
    font-size: 1.3rem;
    margin: 0;
}

/* Navigation avec mega-menu */
.mega-wrap {
    position: static;
}

.nav-arrow {
    font-size: 10px;
    margin-left: 3px;
    display: inline-block;
    transition: transform 0.25s;
    vertical-align: middle;
}

.mega-wrap:hover .nav-arrow {
    transform: rotate(180deg);
}

.mega-menu {
    display: none;
    position: fixed;
    top: 54px;
    left: 0;
    width: 100vw;
    background: #ffffff;
    border-top: 3px solid var(--accent);
    box-shadow: 0 12px 40px rgba(10, 22, 40, 0.18);
    z-index: 9000;
    animation: megaFadeIn 0.2s ease;
}

@keyframes megaFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mega-wrap:hover .mega-menu {
    display: block;
}

.mega-menu--sm .mega-inner {
    max-width: 860px;
}

.mega-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 28px 32px 32px;
}

.mega-menu--sm .mega-inner {
    grid-template-columns: repeat(3, 1fr);
}

.mega-col {
    padding: 0 24px 0 0;
    border-right: 1px solid #f0f0f0;
    margin-right: 8px;
}

.mega-col:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.mega-col-title {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
    width: 100%;
}

.mega-list {
    list-style: none;
    padding: 0;
    margin: 0 0 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mega-list li a {
    display: block;
    padding: 5px 8px 5px 14px;
    font-size: 13px;
    color: #3a3a3a;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s, padding-left 0.15s;
    position: relative;
}

.mega-list li a::before {
    content: '•';
    position: absolute;
    left: 4px;
    color: var(--accent);
    font-size: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.mega-list li a:hover {
    background: #fff5ef;
    color: var(--accent);
    padding-left: 18px;
}

/* Barre de recherche */
.search-box {
    flex: 1;
    max-width: 450px;
    display: flex;
    gap: 6px;
}

.search-box .search-input {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    outline: none;
    font-size: 13px;
}

.search-box .search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.search-box .search-input:focus {
    background: rgba(255, 255, 255, 0.15);
}

.search-box .search-btn {
    background: var(--accent);
    border: none;
    border-radius: 28px;
    padding: 8px 18px;
    cursor: pointer;
    color: var(--white);
    font-size: 14px;
    transition: var(--transition);
}

.search-box .search-btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

/* Actions du header */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-btn,
.register-btn,
.login-btn,
.dashboard-btn,
.logout-btn {
    padding: 6px 14px;
    border-radius: 28px;
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}

.cart-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.cart-btn:hover {
    background: var(--blue);
}

.register-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.register-btn:hover {
    background: var(--blue);
}

.login-btn,
.dashboard-btn {
    background: var(--accent);
    color: var(--white);
}

.login-btn:hover,
.dashboard-btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

.logout-btn {
    background: rgba(230, 57, 70, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.logout-btn:hover {
    background: var(--danger);
    color: var(--white);
}

/* ============================================
   6. CONTENU PRINCIPAL
============================================ */
.main-content {
    margin-top: 62px;
    padding: 24px 30px;
}

/* ============================================
   7. GRILLE & CARDS
============================================ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-top: 30px;
    width: 100%;
}

.product-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transition: 0.3s ease;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-8px);
}

.product-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 15px;
}

.card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.file-card {
    background: var(--white);
    border-radius: 16px;
    padding: 18px;
    border: 1px solid #177ee5;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.file-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #c084fc, #e9d8fd, var(--white));
    transition: height 0.4s ease;
    z-index: 0;
}

.file-card:hover::before {
    height: 50%;
}

.file-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px) scale(1.02);
}

.file-card>* {
    position: relative;
    z-index: 1;
}

.file-icon {
    font-size: 34px;
    margin-bottom: 12px;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.file-meta {
    font-size: 12px;
    color: #5f6368;
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 15px;
}

.price {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent);
}

.total-card {
    margin-top: 30px;
    text-align: center;
}

/* ============================================
   8. BOUTONS
============================================ */
.btn {
    background: var(--accent);
    color: var(--white);
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    font-family: var(--font-body);
}

.btn:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.btn-blue {
    background: var(--blue);
}

.btn-blue:hover {
    background: var(--blue-light);
}

button {
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.action-group {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.action-link {
    text-decoration: none;
    color: #1a73e8;
    background: #e8f0fe;
    padding: 6px 10px;
    border-radius: 14px;
    font-size: 13px;
    transition: var(--transition);
}

.action-link:hover {
    background: #d2e3fc;
}

/* ============================================
   9. FORMULAIRES
============================================ */
form {
    background: var(--white);
    border-radius: 18px;
    border: 1px solid #e8eaed;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    width: 100%;
    padding: 16px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid #dadce0;
    outline: none;
    font-size: 14px;
    margin-bottom: 14px;
    font-family: var(--font-body);
    background: var(--white);
    color: #202124;
}

input:focus,
textarea:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.12);
}

.upload-zone {
    border: 2px dashed #1a73e8;
    padding: 40px;
    text-align: center;
    border-radius: 18px;
    background: #f8fbff;
    margin-bottom: 20px;
    transition: var(--transition);
}

.upload-zone:hover {
    background: #e8f0fe;
}

.upload-zone.drag {
    background: #e8f0fe;
    border-color: #1a73e8;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    margin-top: 15px;
}

.progress {
    height: 100%;
    width: 0%;
    background: #1a73e8;
    border-radius: 10px;
    transition: width 0.2s;
}

/* ============================================
   10. ALERTES
============================================ */
.alert-success {
    background: #e6f4ea;
    color: #137333;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fce8e6;
    color: #c5221f;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* ============================================
   11. ASSISTANT FLOTTANT (CHATBOT)
============================================ */
.floating-assistant {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 290px;
    background: white;
    border-radius: 18px;
    border: 2px solid #FF6B00;
    overflow: hidden;
    z-index: 9999;
    box-shadow: 0 15px 40px rgba(10, 22, 40, 0.20);
}

.floating-assistant .assistant-header {
    background: #0a1628;
    color: white;
    padding: 14px;
    font-size: 14px;
    font-weight: bold;
}

.floating-assistant .assistant-chat {
    height: 220px;
    overflow-y: auto;
    padding: 12px;
    background: white;
}

.floating-assistant .message-bot {
    background: rgba(255, 107, 0, 0.08);
    color: #0a1628;
    padding: 10px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 8px;
}

.floating-assistant .assistant-input-area {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.floating-assistant input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 25px;
}

.floating-assistant button {
    background: #FF6B00;
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 50%;
    cursor: pointer;
}

/* Ancien chatbot (gardé pour compatibilité) */
.chatbot-box {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 260px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 999;
    overflow: hidden;
}

#reponse {
    height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: var(--light);
}

.user-message {
    background: var(--blue);
    color: var(--white);
    padding: 10px;
    margin: 8px;
    border-radius: 12px;
    text-align: right;
    font-size: 13px;
    animation: fadeIn 0.3s ease-in;
}

.bot-message {
    background: var(--accent);
    color: var(--white);
    padding: 10px;
    margin: 8px;
    border-radius: 12px;
    font-size: 13px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   12. FOOTER
============================================ */
footer {
    text-align: center;
    padding: 20px 30px;
    background: var(--primary);
    color: var(--white);
    font-size: 14px;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

/* ============================================
   13. THEME SOMBRE
============================================ */
body.dark {
    background: #07142a;
    color: var(--white);
}

body.dark .card,
body.dark .file-card,
body.dark .dropdown-menu {
    background: #2d3748;
    color: var(--white);
}

body.dark input,
body.dark select,
body.dark textarea {
    background: #1a2f55;
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ============================================
   14. RESPONSIVE
============================================ */
@media (max-width: 900px) {
    .header-container {
        flex-wrap: wrap;
    }

    .search-box {
        order: 3;
        max-width: 100%;
        width: 100%;
        margin-top: 8px;
    }

    .main-content {
        margin-top: 108px;
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .floating-assistant {
        width: 260px;
        right: 15px;
        bottom: 15px;
    }
}

@media (max-width: 600px) {
    .main-header {
        padding: 8px 16px;
    }

    .logo-box h2 {
        font-size: 1.1rem;
    }

    .logo-box img {
        height: 30px;
    }

    .cart-btn span,
    .register-btn span,
    .login-btn span,
    .dashboard-btn span {
        display: none;
    }

    .cart-btn,
    .register-btn,
    .login-btn,
    .dashboard-btn,
    .logout-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .three-dots-btn {
        padding: 5px 10px;
    }

    .three-dots-btn span {
        font-size: 16px;
    }

    .dropdown-menu {
        position: fixed;
        top: 55px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }

    .main-content {
        margin-top: 92px;
        padding: 12px;
    }

    .grid,
    .files-grid {
        grid-template-columns: 1fr;
    }

    .chatbot-box {
        width: calc(100vw - 20px);
        right: 10px;
    }
}


/* ========== RÉDUIRE L'ESPACE AVANT LE FOOTER ========== */
/* Supprime les marges et paddings des dernières sections */
.articles-section:last-of-type {
    margin-bottom: 5px !important;
    padding-bottom: 5px !important;
}

/* Réduit l'espace après le dernier bloc de contenu */
.articles-section,
.products-blocks {
    margin-bottom: 10px !important;
}

/* Ajuste le footer si nécessaire */
footer, .footer {
    margin-top: 0 !important;
    padding-top: 15px !important;
}

/* Supprime les marges additionnelles */
body > :last-child {
    margin-bottom: 10px;
}

/* Si vous avez un conteneur principal */
main, .main-content, .container {
    padding-bottom: 5px !important;
    margin-bottom: 5px !important;
}


/* ===== AMÉLIORATION DES CARTES PRODUITS ===== */
.product-block {
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(255,107,0,0.05));
    border-radius: 24px;
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.product-block:hover::before {
    opacity: 1;
}

/* ===== EFFET DE SURVOL POUR LES ARTICLES ===== */
.article-card {
    position: relative;
    overflow: hidden;
}

.article-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.article-card:hover::after {
    left: 100%;
}

/* ===== SCROLLBAR PERSONNALISÉE ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #2a2a2a;
}

/* ===== SÉLECTION DE TEXTE ===== */
::selection {
    background: var(--accent);
    color: white;
}

/* ===== FOCUS VISIBLE ACCESSIBILITÉ ===== */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}