/* Variables CSS */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --radius: 0.5rem;
    --radius-lg: 1rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-dark));
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border: #475569;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    overflow-x: hidden;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* =================================== */
/* HEADER AMÉLIORÉ */
/* =================================== */

.header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 8px 32px var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: nowrap;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo:hover {
    transform: scale(1.05);
}

/* =================================== */
/* NAVIGATION PRINCIPALE AVEC MEGA MENU */
/* =================================== */

nav {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: visible; /* CORRECTION: Suppression de overflow-x: auto */
}

.main-nav {
    overflow: visible; /* CORRECTION: S'assurer que le menu ne soit pas caché */
}

.nav {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}

.nav li {
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav a,
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    position: relative;
    font-weight: 500;
    font-size: 0.95rem;
}

.dropdown-arrow {
    font-size: 0.8rem;
    transition: var(--transition);
    margin-left: 0.25rem;
}

.nav-item:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Effet hover simplifié */
.nav a:hover,
.nav-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.nav a.active,
.nav-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* =================================== */
/* MEGA MENU */
/* =================================== */

.mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px var(--shadow-lg);
    padding: 1.5rem; /* Réduit de 2rem à 1.5rem */
    min-width: 800px;
    max-width: 1000px;
    /* NOUVELLES PROPRIÉTÉS POUR LE SCROLL */
    max-height: 80vh; /* Limiter à 80% de la hauteur viewport */
    overflow-y: auto; /* Scroll vertical */
    overflow-x: hidden; /* Pas de scroll horizontal */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
    backdrop-filter: blur(20px);
    margin-top: 0.5rem;
}

.nav-item:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.menu-category {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.menu-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-lg);
    border-color: var(--primary);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.category-icon {
    font-size: 1.3rem;
}

.category-title {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    font-size: 0.95rem; /* Ajouté - taille de police réduite */
}

.tool-count {
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.4rem; /* Réduit de 0.25rem 0.5rem */
    border-radius: 1rem;
    font-size: 0.7rem; /* Réduit de 0.75rem à 0.7rem */
    font-weight: 500;
}

.category-tools {
    display: flex;
    flex-direction: column;
    gap: 0.4rem; /* Réduit de 0.5rem à 0.4rem */
}

.tool-link {
    display: flex;
    align-items: center;
    gap: 0.4rem; /* Réduit de 0.5rem à 0.4rem */
    padding: 0.4rem 0.6rem; /* Réduit de 0.5rem 0.75rem */
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.85rem; /* Réduit de 0.9rem à 0.85rem */
}

.tool-link:hover {
    background: var(--primary);
    color: white;
    transform: translateX(5px);
}

.tool-icon {
    font-size: 0.9rem; /* Réduit de 1rem à 0.9rem */
}

/* Featured category */
.menu-featured {
    background: var(--gradient-primary) !important;
    color: white;
    border: none !important;
}

.menu-featured .category-title {
    color: white;
}

.menu-featured .tool-link {
    color: rgba(255, 255, 255, 0.8);
}

.menu-featured .tool-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.menu-featured .tool-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Menu footer pour l'IA */
.menu-footer {
    margin-top: 1.25rem; /* Réduit de 1.5rem */
    padding-top: 1.25rem; /* Réduit de 1.5rem */
    border-top: 1px solid var(--border);
}

.ai-assistant-section {
    display: flex;
    align-items: center;
    gap: 0.8rem; /* Réduit de 1rem à 0.8rem */
    padding: 0.8rem; /* Réduit de 1rem à 0.8rem */
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.ai-assistant-section:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.ai-title {
    font-weight: 600;
    font-size: 0.9rem; /* Réduit de 1rem à 0.9rem */
}

.ai-subtitle {
    font-size: 0.8rem; /* Réduit de 0.85rem à 0.8rem */
    opacity: 0.8;
}

/* =================================== */
/* QUICK MENU */
/* =================================== */

.quick-menu {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px var(--shadow-lg);
    padding: 1.5rem;
    min-width: 300px;
    position: absolute;
    top: 100%;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
    margin-top: 0.5rem;
    backdrop-filter: blur(20px);
}

.nav-item:hover .quick-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

.quick-tool {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

.quick-tool:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* =================================== */
/* SEARCH BOX AMÉLIORÉE */
/* =================================== */

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 250px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    width: 300px;
}

.search-suggestion {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestion.enhanced {
    /* Styles déjà définis ci-dessus */
}

/* =================================== */
/* AI BUTTON */
/* =================================== */

.ai-button {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ai-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

/* Theme toggle */
.theme-toggle {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 8px 25px var(--shadow-lg);
}

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

.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-nav-toggle span {
    width: 24px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

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

.mobile-nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* =================================== */
/* BREADCRUMB */
/* =================================== */

.breadcrumb {
    background: var(--bg-secondary);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.breadcrumb-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-link:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* =================================== */
/* NEW BADGE */
/* =================================== */

.new-badge {
    background: var(--success);
    color: white;
    padding: 0.2rem 0.4rem; /* Réduit de 0.25rem 0.5rem */
    border-radius: 1rem;
    font-size: 0.65rem; /* Réduit de 0.7rem à 0.65rem */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: auto;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* =================================== */
/* MAIN CONTENT */
/* =================================== */

.main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

.view {
    display: none;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
    display: block;
}

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* Hero Section avec gradient animé */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--gradient-primary);
    color: white;
    margin-bottom: 3rem;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Categories Grid avec animations */
.categories-grid, .tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.category-card, .tool-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.category-card::before, .tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
    z-index: 0;
}

.category-card:hover::before, .tool-card:hover::before {
    left: 0;
    opacity: 0.1;
}

.category-card:hover, .tool-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px var(--shadow-lg);
    border-color: var(--primary);
}

.category-card > *, .tool-card > * {
    position: relative;
    z-index: 1;
}

.category-icon, .tool-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    transition: var(--transition);
}

.category-card:hover .category-icon,
.tool-card:hover .tool-icon {
    transform: scale(1.2) rotate(5deg);
}

.category-card h3, .tool-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    transition: var(--transition);
}

.category-card:hover h3, .tool-card:hover h3 {
    color: var(--primary-dark);
}

/* Tool Features avec animations */
.tool-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tool-features span {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.tool-card:hover .tool-features span {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* Category Header */
.category-header {
    margin-bottom: 2rem;
}

.category-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tool Interface */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-header h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px var(--shadow);
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.input-group:focus-within label {
    color: var(--primary);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.input-group textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

/* Checkbox groups */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: normal;
    margin-bottom: 0;
}

.checkbox-group label:hover {
    background: var(--bg-tertiary);
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.regex-flags {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.regex-flags label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
}

.regex-flags input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* Buttons avec effets avancés */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: var(--transition);
    transform: translate(-50%, -50%);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(100, 116, 139, 0.4);
}

.btn-success {
    background: var(--success);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-group {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

/* History avec animations */
.history-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}

.history-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.history-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: var(--transition);
}

.history-item:hover::before {
    transform: scaleY(1);
}

.history-item:hover {
    background: var(--bg-secondary);
    transform: translateX(5px);
}

.history-item:last-child {
    border-bottom: none;
}

/* Messages avec animations */
.floating-message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Color Palette spécifique */
.color-controls {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.color-picker-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.color-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--border);
    background: #3b82f6;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 25px var(--shadow-lg);
}

.color-preview:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 35px var(--shadow-lg);
}

.palette-options {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.palette-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.color-swatch {
    aspect-ratio: 1;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    display: flex;
    align-items: end;
    justify-content: center;
    padding: 0.5rem;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

.color-swatch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: var(--transition);
}

.color-swatch:hover::before {
    opacity: 1;
}

.color-swatch:hover {
    transform: scale(1.05) rotate(2deg);
    z-index: 10;
    box-shadow: 0 12px 35px var(--shadow-lg);
}

/* Regex specific */
.regex-matches {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    min-height: 200px;
    white-space: pre-wrap;
    line-height: 1.6;
    transition: var(--transition);
}

.regex-match {
    background: rgba(59, 130, 246, 0.3);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.regex-match:hover {
    background: rgba(59, 130, 246, 0.5);
    transform: scale(1.05);
}

.regex-explanation {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    line-height: 1.6;
}

/* JSON Diff specific */
.diff-output {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}

.diff-added {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    padding: 0.25rem;
    border-radius: 0.25rem;
    border-left: 3px solid var(--success);
    margin: 0.25rem 0;
    animation: fadeIn 0.5s ease-in;
}

.diff-removed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    padding: 0.25rem;
    border-radius: 0.25rem;
    border-left: 3px solid var(--error);
    margin: 0.25rem 0;
    animation: fadeIn 0.5s ease-in;
}

.diff-modified {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    padding: 0.25rem;
    border-radius: 0.25rem;
    border-left: 3px solid var(--warning);
    margin: 0.25rem 0;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Back button */
.back-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.back-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-5px);
    box-shadow: 0 4px 12px var(--shadow-lg);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 3rem 0;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 0.25rem 0;
}

.footer-section a:hover {
    color: var(--primary);
    transform: translateX(5px);
}

.footer-section p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

/* Loading spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}

/* =================================== */
/* AI ASSISTANT STYLES */
/* =================================== */

.ai-floating-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: var(--transition);
    z-index: 999;
}

.ai-floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.6);
}

.ai-chatbot-drawer {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    box-shadow: -5px 0 20px var(--shadow);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.ai-chatbot-drawer.open {
    right: 0;
}

.ai-chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.ai-chatbot-header h3 {
    margin: 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.ai-close-btn:hover {
    color: var(--error);
    transform: rotate(90deg);
}

.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-message {
    max-width: 80%;
    animation: fadeInUp 0.3s ease-out;
}

.ai-message.ai-user {
    align-self: flex-end;
}

.ai-message.ai-bot {
    align-self: flex-start;
}

.ai-message-content {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    line-height: 1.5;
}

.ai-user .ai-message-content {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.ai-message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9em;
}

.ai-message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.ai-chatbot-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.ai-chatbot-input input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}

.ai-chatbot-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-chatbot-input button {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.ai-chatbot-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ai-action-button {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    display: block;
    width: 100%;
}

.ai-action-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.ai-typing-indicator {
    display: flex;
    gap: 0.25rem;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Suggestions pour regex */
.ai-suggestions-box {
    margin-bottom: 1rem;
}

.ai-quick-suggestions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ai-suggest-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.ai-suggest-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* =================================== */
/* NOUVELLE SECTION AI RELEVANCE */
/* =================================== */

.ai-relevance-section {
    margin-top: 5rem;
    padding: 4rem 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-intro {
    text-align: center;
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 3rem;
    line-height: 1.8;
}

.relevance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    padding: 0 2rem;
}

.relevance-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.relevance-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    opacity: 0;
    z-index: -1;
    transition: var(--transition);
}

.relevance-card:hover::before {
    opacity: 1;
}

.relevance-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px var(--shadow-lg);
    background: var(--bg-primary);
}

.relevance-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

.relevance-card:nth-child(even) .relevance-icon {
    animation-delay: 1.5s;
}

.relevance-card h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.relevance-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.ai-complement-box {
    max-width: 800px;
    margin: 3rem auto 0;
    padding: 2rem;
    background: var(--primary);
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

.ai-complement-box p {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* =================================== */
/* RESPONSIVE AMÉLIORÉ */
/* =================================== */

@media (max-width: 1024px) {
    .mega-menu {
        min-width: 600px;
        max-width: 90vw; /* Limiter à 90% de la largeur viewport */
        left: 0;
        transform: translateX(0);
        max-height: 70vh; /* Réduire encore plus sur tablette */
    }
    
    .nav-item:hover .mega-menu {
        transform: translateX(0) translateY(0);
    }

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

    .category-title {
        font-size: 0.9rem;
    }

    .tool-link {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    /* Sur mobile, convertir le mega menu en liste simple */
    .mobile-active .mega-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: var(--bg-tertiary);
        margin: 0.5rem 0;
        padding: 1rem;
        max-height: none; /* Pas de limite sur mobile */
        overflow-y: visible;
        min-width: auto;
        max-width: none;
    }

    .mobile-active .mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .mobile-active .menu-category {
        padding: 1rem;
    }

    .mobile-active .category-title {
        font-size: 0.9rem;
    }

    .mobile-active .tool-link {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }

    .hero {
        margin-bottom: 2rem;
    }

    .palette-preview {
        grid-template-columns: 1fr;
    }

    .tool-features {
        flex-direction: column;
    }

    .category-card,
    .tool-card {
        padding: 1.5rem;
    }

    .category-icon,
    .tool-icon {
        font-size: 2.5rem;
    }

    .tool-grid {
        grid-template-columns: 1fr;
    }

    .relevance-card {
        padding: 1.5rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .section-intro {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
}

/* Animation pour le mobile */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================== */
/* SCROLLBAR PERSONNALISÉE POUR MEGA MENU */
/* =================================== */

.mega-menu::-webkit-scrollbar {
    width: 6px;
}

.mega-menu::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.mega-menu::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.mega-menu::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Pour Firefox */
.mega-menu {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-tertiary);
}