:root {
    /* Mode clair */
    --primary-color: #7B2CBF;
    --secondary-color: #5A189A;
    --accent-color: #D94400; /* Darker Orange for WCAG AA on White */
    --text-color: #2D2D2D;
    --text-muted: #4B5563;
    --light-gray: #F8F9FA;
    --dark-gray: #343A40;
    --white: #FFFFFF;
    --success: #198754; /* Darker Green for WCAG AA */
    --warning: #B7791F; /* Darker Amber for text visibility */
    --background-color: var(--white);
    --card-background: var(--white);
    --border-color: #E0E0E0;
    --focus-ring: 0 0 0 3px rgba(123, 44, 191, 0.4);
    --btn-hover-transform: translateY(-2px);
    --btn-active-transform: translateY(1px);
    --btn-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --btn-hover-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    --header-height: 70px;
    
    /* Modern Footer & Navbar Variables */
    --nav-hover-gradient: linear-gradient(135deg, #4f46e5 0%, #5d3b82 100%);
    --footer-bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --footer-text-color: #ffffff;
    --footer-link-color: rgba(255, 255, 255, 0.7);
    --footer-link-hover-color: #818cf8;
    --footer-social-bg: rgba(255, 255, 255, 0.1);
    --footer-social-hover-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Mode sombre */
[data-theme="dark"] {
    --primary-color: #9D4EDD;
    --secondary-color: #7B2CBF;
    --accent-color: #FFB74D;
    --text-color: #E0E0E0;
    --text-muted: #9CA3AF;
    --background-color: #121212;
    --card-background: #1E1E1E;
    --border-color: #333333;
    --focus-ring: 0 0 0 3px rgba(157, 78, 221, 0.4);
    --btn-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --btn-hover-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    
    /* Modern Footer & Navbar Dark Mode Variables */
    --nav-hover-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --footer-bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Styles pour les boutons du header */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cart-button,
.chatbot-button,
.theme-toggle {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-shadow: var(--btn-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cart-button:hover,
.chatbot-button:hover,
.theme-toggle:hover {
    transform: var(--btn-hover-transform);
    box-shadow: var(--btn-hover-shadow);
}

.cart-button:active,
.chatbot-button:active,
.theme-toggle:active {
    transform: var(--btn-active-transform);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-color);
    color: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Footer dark mode */
[data-theme="dark"] footer {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

[data-theme="dark"] .footer-section {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .footer-section:hover {
    background: rgba(255, 255, 255, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
    letter-spacing: -0.01em;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* Amélioration de l'accessibilité */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Focus visible pour tous les éléments interactifs */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Header amélioré */
header {
    background-color: var(--card-background);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s;
    height: auto;
}

.nav-container {
    display: flex;
    align-items: center;
    padding: 0.8rem 12px;
    position: relative;
    max-width: 100vw;
    margin: 0 auto;
    min-height: 60px;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo i {
    margin-right: 0.5rem;
    color: var(--accent-color);
}

/* Navigation améliorée */
.nav-menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 1rem;
    margin: 0;
    padding: 0;
    margin-right: auto;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.3s;
    padding: 0.4rem 0.7rem;
    border-radius: 5px;
    position: relative;
    font-size: 0.95rem;
}

.nav-menu a:hover,
.nav-menu a:focus {
    color: var(--primary-color);
    background-color: var(--light-gray);
}

.nav-menu a[aria-current="page"] {
    color: var(--primary-color);
    font-weight: 600;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.cart-icon {
    position: relative;
    color: var(--text-color);
    font-size: 1.5rem;
    text-decoration: none;
    padding: 0.5rem;
    transition: color 0.3s;
}

.cart-icon:hover {
    color: var(--accent-color);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-color);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
    /* Initially hidden, shown when items are in cart */
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-weight: 500;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.95rem;
}

.btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-accent {
    background-color: var(--accent-color);
}

.btn-accent:hover {
    background-color: #FF7B00;
}

/* Footer Styles */
footer {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><linearGradient id="a" x1="0" x2="0" y1="0" y2="1"><stop offset="0" stop-color="%23ffffff" stop-opacity="0.1"/><stop offset="1" stop-color="%23ffffff" stop-opacity="0"/></linearGradient></defs><rect width="100" height="20" fill="url(%23a)"/></svg>') repeat-x;
    opacity: 0.1;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    position: relative;
    z-index: 1;
}

.footer-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.footer-section:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.footer-section h3 {
    margin-bottom: 1.2rem;
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 2px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.footer-section ul li:hover {
    transform: translateX(5px);
}

.footer-section a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-radius: 6px;
    font-weight: 500;
}

.footer-section a:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
    padding-left: 0.75rem;
}

.footer-section a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.social-links a {
    color: var(--white);
    font-size: 1.8rem;
    transition: all 0.3s ease;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
}

.social-links a:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px) scale(1.1);
    border-color: var(--accent-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Footer copyright */
.footer-bottom {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Responsive footer */
@media (max-width: 768px) {
    footer {
        padding: 2.5rem 15px 1.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer-section {
        padding: 1.2rem;
        margin: 0 5px;
    }

    .footer-section h3 {
        font-size: 1.1rem;
    }

    .footer-section a {
        padding: 0.4rem 0;
        font-size: 0.95rem;
    }

    .social-links {
        gap: 0.6rem;
        flex-wrap: wrap;
    }

    .social-links a {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    footer {
        padding: 2rem 10px 1rem;
    }

    .footer-section {
        padding: 1rem;
        margin: 0;
    }

    .footer-section h3 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .footer-section a {
        font-size: 0.9rem;
        padding: 0.3rem 0;
    }

    .social-links a {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

/* Bouton du menu mobile amélioré */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:focus {
    background-color: var(--light-gray);
    color: var(--primary-color);
}

.mobile-menu-btn i {
    transition: transform 0.3s;
}

.mobile-menu-btn.active i {
    transform: rotate(90deg);
}

/* Media queries améliorées */
@media (max-width: 992px) {
    .mobile-menu-btn {
        display: block;
        position: relative;
        z-index: 1201;
        padding: 0.5rem;
        margin-left: auto;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 60px;
        /* Hauteur du header */
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background: var(--card-background);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 1rem;
        z-index: 1000;
        overflow-y: auto;
        transform: translateY(-100%);
        transition: transform 0.3s ease-in-out;
    }

    .nav-menu.active {
        display: flex;
        transform: translateY(0);
    }

    .nav-menu li {
        margin: 0;
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu a {
        display: block;
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        color: var(--text-color);
        text-align: left;
    }

    .nav-menu a:hover,
    .nav-menu a:focus {
        background-color: var(--light-gray);
        color: var(--primary-color);
    }

    /* Overlay pour le menu mobile */
    .mobile-nav-overlay {
        display: none;
        position: fixed;
        top: 60px;
        /* Hauteur du header */
        left: 0;
        width: 100vw;
        height: calc(100vh - 60px);
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .mobile-nav-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Ajuster le contenu principal pour le header fixe */
    main {
        margin-top: 60px;
        /* Hauteur du header */
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0.8rem 15px;
        min-height: 55px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .mobile-menu-btn {
        font-size: 1.4rem;
        padding: 0.6rem;
        min-width: 44px;
        min-height: 44px;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .nav-menu {
        top: 55px;
        height: calc(100vh - 55px);
        padding: 0.5rem;
    }

    .nav-menu a {
        padding: 1.2rem 1rem;
        font-size: 1.1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .mobile-nav-overlay {
        top: 55px;
        height: calc(100vh - 55px);
    }

    main {
        margin-top: 55px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.6rem 12px;
        min-height: 50px;
    }

    .logo {
        font-size: 1.1rem;
    }

    .mobile-menu-btn {
        font-size: 1.3rem;
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }

    .nav-menu {
        top: 50px;
        height: calc(100vh - 50px);
        padding: 0.3rem;
    }

    .nav-menu a {
        padding: 1rem 0.8rem;
        font-size: 1rem;
        min-height: 48px;
    }

    .mobile-nav-overlay {
        top: 50px;
        height: calc(100vh - 50px);
    }

    main {
        margin-top: 50px;
    }

    .container {
        padding: 0 12px;
    }
}

/* Animation du menu mobile */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.nav-menu.active {
    animation: slideDown 0.3s ease-out forwards;
}

/* Support du mode sombre */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-color: #9D4EDD;
        --secondary-color: #7B2CBF;
        --accent-color: #FFB74D;
        --text-color: #E0E0E0;
        --background-color: #121212;
        --card-background: #1E1E1E;
        --border-color: #333333;
    }
}

/* Animations et transitions */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Support des appareils à écran tactile */
@media (hover: none) {
    .btn:hover {
        transform: none;
    }

    .nav-menu a:hover {
        background-color: transparent;
    }
}

/* Amélioration de l'accessibilité pour les lecteurs d'écran */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.theme-toggle:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
    transform: scale(1.05);
}

.theme-toggle:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

[data-theme="dark"] .theme-toggle {
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .theme-toggle:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

/* Styles pour les états de focus améliorés */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Support du mode de contraste élevé */
@media (forced-colors: active) {

    .btn,
    .nav-menu a {
        border: 2px solid currentColor;
    }
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.back-to-top:active {
    transform: translateY(-1px);
}

[data-theme="dark"] .back-to-top {
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .back-to-top:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

@media (max-width: 900px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.8rem 8px;
        gap: 0.5rem;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        width: 100%;
        padding: 0.7rem 1rem;
        font-size: 1rem;
    }

    .nav-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
}

@media (max-width: 600px) {
    .nav-container {
        max-width: 100vw;
        padding: 0.5rem 8px;
        min-height: 50px;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.3rem;
    }

    .nav-menu a {
        font-size: 0.95rem;
        padding: 0.6rem 0.8rem;
    }

    .logo {
        font-size: 1rem;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    .cart-button,
    .chatbot-button,
    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 0 8px;
    }

    .nav-container {
        padding: 0.4rem 8px;
        flex-wrap: nowrap;
    }

    .logo {
        font-size: 0.9rem;
    }

    .nav-actions {
        gap: 0.3rem;
    }

    .cart-button,
    .chatbot-button,
    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .cart-badge {
        width: 16px;
        height: 16px;
        font-size: 0.65rem;
        top: -3px;
        right: -3px;
    }
}