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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    color: #1e293b;
    line-height: 1.2;
    margin: 0;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

/* ===================================================================
   HEADER
   =================================================================== */
.header {
    background: #1e293b;
    color: white;
    padding: 25px 30px;
    text-align: center;
    position: relative;
}

.header-content h1 {
    font-size: 2.4em;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header-content h1 img {
    vertical-align: middle;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.8;
    font-weight: 300;
    font-style: italic;
}

/* ===================================================================
   MAIN CONTENT
   =================================================================== */
.main-content {
    padding: 25px 30px;
    background: white;
    flex: 1;
}

/* ===================================================================
   SECTION RECHERCHE
   =================================================================== */
.search-section {
    margin-bottom: 25px;
}

.search-container {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 14px 25px 14px 50px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 0.95em;
    background: #f8fafc;
    transition: all 0.3s ease;
    font-family: inherit;
    color: #1e293b;
}

.search-input::placeholder {
    color: #64748b;
    opacity: 0.7;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1.2em;
}

.clear-search-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.1em;
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: 1;
}

.clear-search-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateY(-50%) scale(1.1);
}

.clear-search-btn.visible {
    display: flex;
}

/* ===================================================================
   VUES PRINCIPALES
   =================================================================== */
.main-view {
    display: block;
}

.detail-view {
    display: none;
}

/* ===================================================================
   GRILLE DES PÔLES (CARTES PRINCIPALES)
   =================================================================== */
.poles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 18px;
    margin-top: 10px;
}

.pole-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.06);
    overflow: visible;
}

.pole-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

/* Couleurs spécifiques par pôle */
.pole1-card {
    border-color: #2563eb;
}

.pole1-card:hover {
    border-color: #1d4ed8;
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.15);
}

.pole2-card {
    border-color: #16a34a;
}

.pole2-card:hover {
    border-color: #15803d;
    box-shadow: 0 16px 40px rgba(22, 163, 74, 0.15);
}

.pole3-card {
    border-color: #ea580c;
}

.pole3-card:hover {
    border-color: #dc2626;
    box-shadow: 0 16px 40px rgba(234, 88, 12, 0.15);
}

.pole4a-card {
    border-color: #7c3aed;
}

.pole4a-card:hover {
    border-color: #6d28d9;
    box-shadow: 0 16px 40px rgba(124, 58, 237, 0.15);
}

.pole4b-card {
    border-color: #0891b2;
}

.pole4b-card:hover {
    border-color: #0e7490;
    box-shadow: 0 16px 40px rgba(8, 145, 178, 0.15);
}

/* Barre colorée en haut de chaque carte */
.pole-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    border-radius: 16px 16px 0 0;
    transition: all 0.3s ease;
}

.pole1-card::before {
    background: #2563eb;
}

.pole2-card::before {
    background: #16a34a;
}

.pole3-card::before {
    background: #ea580c;
}

.pole4a-card::before {
    background: #7c3aed;
}

.pole4b-card::before {
    background: #0891b2;
}

/* Header de la carte pôle */
.pole-header {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

.pole-number {
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.0em;
    margin-right: 14px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.pole1-card .pole-number {
    background: #2563eb;
}

.pole2-card .pole-number {
    background: #16a34a;
}

.pole3-card .pole-number {
    background: #ea580c;
}

.pole4a-card .pole-number {
    background: #7c3aed;
}

.pole4b-card .pole-number {
    background: #0891b2;
}

.pole-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.1;
}

.pole-description {
    color: #475569;
    margin-bottom: 14px;
    font-size: 0.9em;
    line-height: 1.3;
}

/* Tags dans les cartes pôles */
.pole-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    position: relative;
}

.tag {
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pole1-card .tag {
    background: #2563eb;
}

.pole1-card .tag:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.pole2-card .tag {
    background: #16a34a;
}

.pole2-card .tag:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.pole3-card .tag {
    background: #ea580c;
}

.pole3-card .tag:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.pole4a-card .tag {
    background: #7c3aed;
}

.pole4a-card .tag:hover {
    background: #6d28d9;
    transform: translateY(-1px);
}

.pole4b-card .tag {
    background: #0891b2;
}

.pole4b-card .tag:hover {
    background: #0e7490;
    transform: translateY(-1px);
}

/* ===================================================================
   TOOLTIPS DES TAGS
   =================================================================== */
.tag-tooltip {
    position: relative;
    cursor: help;
}

.tag-tooltip::before,
.tag-tooltip::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.tag-tooltip::before {
    content: attr(data-examples);
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    padding: 8px 10px;
    font-size: 0.72rem;
    line-height: 1.4;
    border-radius: 6px;
    white-space: pre-line;
    width: max-content;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-align: left;
    font-family: inherit;
}

.tag-tooltip::after {
    content: '';
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
}

.pole1-card .tag-tooltip::before {
    background: #dbeafe;
    border: 2px solid #93c5fd;
    color: #1e293b;
}

.pole1-card .tag-tooltip::after {
    border-top-color: #93c5fd;
}

.pole2-card .tag-tooltip::before {
    background: #d1fae5;
    border: 2px solid #86efac;
    color: #1e293b;
}

.pole2-card .tag-tooltip::after {
    border-top-color: #86efac;
}

.pole3-card .tag-tooltip::before {
    background: #fed7aa;
    border: 2px solid #fdba74;
    color: #1e293b;
}

.pole3-card .tag-tooltip::after {
    border-top-color: #fdba74;
}

.pole4a-card .tag-tooltip::before {
    background: #ede9fe;
    border: 2px solid #c4b5fd;
    color: #1e293b;
}

.pole4a-card .tag-tooltip::after {
    border-top-color: #c4b5fd;
}

.pole4b-card .tag-tooltip::before {
    background: #cffafe;
    border: 2px solid #67e8f9;
    color: #1e293b;
}

.pole4b-card .tag-tooltip::after {
    border-top-color: #67e8f9;
}

.tag-tooltip:hover::before,
.tag-tooltip:hover::after {
    opacity: 1;
}

.tag-tooltip:hover::before {
    transform: translateX(-50%) scale(1);
}

.tag-tooltip:hover {
    transform: translateY(-2px);
}

/* ===================================================================
   VUE DÉTAILLÉE
   =================================================================== */
.detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 12px;
}

.back-btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.2);
}

.back-btn:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(99, 102, 241, 0.3);
}

.detail-title {
    color: #1e293b;
    font-size: 1.6em;
    margin: 0;
    font-weight: 600;
    flex: 1;
}

.search-indicator {
    display: flex;
    align-items: center;
}

.search-indicator span {
    background: #3b82f6;
    color: white;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 0.8em;
    font-weight: 600;
    animation: fadeIn 0.5s ease-out;
}

/* ===================================================================
   CONTAINER DES COMPÉTENCES
   =================================================================== */
.competences-container {
    margin-top: 20px;
}

/* ===================================================================
   GRILLES DE TÂCHES
   =================================================================== */
.tasks-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.tasks-grid.tasks-5 {
    grid-template-columns: repeat(5, 1fr);
}

.tasks-grid.tasks-6 {
    grid-template-columns: repeat(3, 1fr);
}

.tasks-grid.tasks-7 {
    grid-template-columns: repeat(4, 1fr);
}

.tasks-grid.tasks-8 {
    grid-template-columns: repeat(4, 1fr);
}

/* ===================================================================
   CARTES DE TÂCHES (TASK-CARD)
   =================================================================== */
.task-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 18px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #cbd5e1;
    z-index: 10000;
    position: relative;
}

/* Bordures gauches colorées par pôle */
#pole1Detail .task-card {
    border-left: 5px solid #2563eb;
}

#pole1Detail .task-card:hover {
    border-left-color: #1d4ed8;
    background: #f8faff;
}

#pole2Detail .task-card {
    border-left: 5px solid #16a34a;
}

#pole2Detail .task-card:hover {
    border-left-color: #15803d;
    background: #f6fef9;
}

#pole3Detail .task-card {
    border-left: 5px solid #ea580c;
}

#pole3Detail .task-card:hover {
    border-left-color: #c2410c;
    background: #fff7ed;
}

#pole4aDetail .task-card {
    border-left: 5px solid #7c3aed;
}

#pole4aDetail .task-card:hover {
    border-left-color: #6d28d9;
    background: #faf5ff;
}

#pole4bDetail .task-card {
    border-left: 5px solid #0891b2;
}

#pole4bDetail .task-card:hover {
    border-left-color: #0e7490;
    background: #ecfeff;
}

.task-title {
    font-size: 0.95em;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

/* ===================================================================
   HIGHLIGHTING POUR LES RÉSULTATS DE RECHERCHE
   =================================================================== */
.highlighted-exact {
    background: #fff9e6 !important;
    box-shadow: 0 8px 28px rgba(255, 215, 0, 0.25) !important;
    border-left: 4px solid #ffd700 !important;
}

.highlighted-synonym {
    background: #f0f9ff !important;
    box-shadow: 0 8px 28px rgba(135, 206, 235, 0.25) !important;
    border-left: 4px solid #87CEEB !important;
}

.primary-match {
    background-color: #ffd700 !important;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.synonym-match {
    background-color: #87CEEB !important;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

mark {
    background: #fbbf24;
    color: #1e293b;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* ===================================================================
   TOOLTIPS DES TASK-CARDS
   =================================================================== */
.tooltip {
    position: relative;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(50% + 2px);
    left: 50%;
    transform: translateX(-50%);
    color: #1e293b;
    padding: 8px 8px;
    border-radius: 10px;
    font-size: 0.85em;
    line-height: 1.1;
    width: 400px;
    max-width: 95vw;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: all 0.3s ease;
    pointer-events: none;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.pole1-bulle {
    background: #dbeafe;
    border: 2px solid #93c5fd;
}

.pole2-bulle {
    background: #d1fae5;
    border: 2px solid #86efac;
}

.pole3-bulle {
    background: #fed7aa;
    border: 2px solid #fdba74;
    width: 420px;
}

.pole4a-bulle {
    background: #ede9fe;
    border: 2px solid #c4b5fd;
}

.pole4b-bulle {
    background: #cffafe;
    border: 2px solid #67e8f9;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    border: 6px solid transparent;
    left: 50%;
    transform: translateX(-50%);
}

#pole1Detail .tooltip-content::after {
    border-top-color: #93c5fd;
}

#pole2Detail .tooltip-content::after {
    border-top-color: #86efac;
}

#pole3Detail .tooltip-content::after {
    border-top-color: #fdba74;
}

#pole4aDetail .tooltip-content::after {
    border-top-color: #c4b5fd;
}

#pole4bDetail .tooltip-content::after {
    border-top-color: #67e8f9;
}

.tooltip-title {
    font-weight: 600;
    color: #1e293b;
    padding-bottom: 6px;
    font-size: 1.1em;
    border-bottom: 0.5px solid #64748b;
}

.tooltip-savoirs {
    font-size: 0.95em;
    color: #1e293b;
    margin-bottom: 4px;
    margin-top: 6px;
    line-height: 1.5;
}

.tooltip-savoirs strong {
    display: block;
    margin-top: 8px;
    margin-bottom: 4px;
    font-weight: 700;
    color: #0f172a;
}

.tooltip-savoirs strong:first-child {
    margin-top: 0;
}

.tooltip-examples {
    margin-top: 8px;
}

.tooltip-examples strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
    color: #ea580c;
}

/* ===================================================================
   BADGES DE RÉSULTATS
   =================================================================== */
.result-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8em;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
    animation: pulse 2s infinite;
    cursor: help;
}

.has-results {
    background: #f0f9ff !important;
    border-color: #0ea5e9 !important;
    box-shadow: 0 20px 50px rgba(14, 165, 233, 0.15) !important;
}

/* ===================================================================
   FOOTER
   =================================================================== */
.footer {
    text-align: center;
    padding: 14px;
    color: #6b7280;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
    margin-bottom: 20px;
    background: white;
    border-radius: 6px;
}

/* ===================================================================
   ANIMATIONS
   =================================================================== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

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

/* ===================================================================
   RESPONSIVE - MOBILE
   =================================================================== */
@media (max-width: 768px) {
    .header {
        padding: 20px 16px;
    }

    .header-content h1 {
        font-size: 1.8em;
    }

    .main-content {
        padding: 20px 16px;
    }

    .poles-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tasks-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .pole-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .pole-number {
        margin-right: 0;
    }

    .search-input {
        padding: 12px 16px 12px 45px;
    }

    .pole-card {
        padding: 18px;
    }

    .tooltip-content {
        width: 270px;
    }

    .detail-title {
        font-size: 1.4em;
    }

    .tag-tooltip::before {
        max-width: 200px;
        font-size: 0.68rem;
        padding: 6px 8px;
    }

    .pole-tags .tag-tooltip::before {
        left: 0;
        transform: translateX(0) scale(0.95);
    }

    .pole-tags .tag-tooltip::after {
        left: 16px;
        transform: translateX(0);
    }

    .pole-tags .tag-tooltip:hover::before {
        transform: translateX(0) scale(1);
    }
}

.detail-view {
    display: none;
    min-height: 500px;
}

.detail-view[style*="display: block"] {
    display: block !important;
}

.competences-container {
    display: block;
    width: 100%;
    margin-top: 20px;
}

.tasks-grid {
    display: grid !important;
    width: 100%;
}

.task-card {
    display: flex !important;
    min-height: 120px;
}