:root {
    --bleu-ciel: #87CEEB;
    --bleu-roi: #1E40AF;
    --bleu-medium: #3498DB;
    --bleu-fonce: #2980B9;
    --blanc: #FFFFFF;
    --text-dark: #2C3E50;
}

/* Style pour la barre de recherche */
.search-section {
    width: 100%;
    margin: 0;
    padding: 0;
}

    .detail-image {
    max-width: 150%;
    
}

    .search-input {
        width: 100%;
        padding: 1rem;
        border: 2px solid var(--bleu-medium);
        border-radius: 50px;
        font-size: 1.1rem;
        text-align: center;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    }

    .search-input:focus {
        outline: none;
        border-color: var(--bleu-roi);
        box-shadow: 0 4px 20px rgba(30, 64, 175, 0.2);
    }

    .no-results {
        text-align: center;
        color: #777;
        font-style: italic;
        margin-top: 2rem;
        font-size: 1.2rem;
    }

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, var(--bleu-ciel), #B3E5FC);
    font-family: 'Segoe UI', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.header {
    background: linear-gradient(180deg, #0b2f6f 0%, #3f8fdf 100%);
    color: white;
    padding: 2rem;
    height: 220px;
    box-sizing: border-box;
    text-align: center;
    position: relative;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.header-nav {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.header-left-links {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    width: max-content;
    margin-left: calc(150px - (50vw - 50%));
}

.header-left-top,
.header-left-bottom {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.header-left-bottom {
    width: 100%;
}

.header-left-bottom .home-btn {
    flex: 1 1 0;
}

.header-main {
    max-width: 1200px;
    margin: 0 auto;
}

.header-title-stack {
    position: absolute;
    top: 50%;
    right: 200px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
}

.nav-links {
    display: flex;
    gap: 0.8rem;
}

.header-title-stack .nav-links {
    justify-content: center;
    margin-bottom: 0.35rem;
}

.home-btn, .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    height: 38px;
    min-height: 38px;
    padding: 0 1.2rem;
    border-radius: 30px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
    font-size: 1rem;
    line-height: 1.1;
    font-weight: 500;
    box-sizing: border-box;
}

.home-btn:hover, .nav-link:hover {
    background: var(--bleu-roi);
    border-color: var(--bleu-roi);
    color: #ffffff;
    transform: translateY(-1px);
}

.header-title-stack .nav-link {
    font-weight: 600;
}

.header-left-links .home-btn {
    font-weight: 500;
}

.header-nav .header-left-links > .a11y-toggle-btn {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    border-radius: 30px;
    height: 38px;
    min-height: 38px;
    padding: 0 1.2rem;
    font-size: 1rem;
    line-height: 1.1;
    font-weight: 700;
    transition: all 0.3s ease;
}

.header-nav .header-left-links > .a11y-toggle-btn:hover,
.header-nav .header-left-links > .a11y-toggle-btn:focus-visible {
    background: var(--bleu-roi);
    border-color: var(--bleu-roi);
    color: #ffffff;
    transform: translateY(-1px);
    outline: none;
}

.header h1 {
    margin: 0 0 0.35rem;
    text-align: center;
    font-size: clamp(1.9rem, 4vw, 2.7rem);
    line-height: 1.15;
    text-shadow: none;
}

.header .subtitle {
    margin: 0;
    text-align: center;
    font-size: 1rem;
    opacity: 0.95;
}

.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 3rem;
    align-items: start;
}

.add-tool-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-left: 5px solid var(--bleu-roi);
}

.tools-feed-column {
    display: grid;
    gap: 1rem;
}

.add-tool-section h2 {
    color: var(--bleu-roi);
    margin-bottom: 1.5rem;
    text-align: center;
}

.tool-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group input,
.form-group textarea {
    padding: 1rem;
    border: 2px solid var(--bleu-medium);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--bleu-roi);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.file-label {
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

input[type="file"] {
    border: 2px dashed var(--bleu-medium);
    padding: 1rem;
    background: #f8f9fa;
    cursor: pointer;
}

input[type="file"]:hover {
    background: #e3f2fd;
}

.image-preview-container {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
}

.image-preview-thumb {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--bleu-medium);
}

.submit-btn {
    background: linear-gradient(135deg, var(--bleu-roi), #2C5282);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.tool-card {
    background: var(--blanc);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    position: relative;
    border: 1px solid #e0e0e0;
}

.tool-card:hover {
    transform: translateY(-5px);
}

.tool-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.tool-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.tool-card h3 {
    font-size: 1.4rem;
    color: var(--bleu-fonce);
    margin-bottom: 0.5rem;
}

.tool-card p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1rem;
}

.age {
    background-color: var(--bleu-ciel);
    color: var(--bleu-fonce);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.tool-actions {
    margin-top: 0.7rem;
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.tool-action-btn {
    border: 1px solid #9ec2eb;
    border-radius: 8px;
    background: #eff7ff;
    color: #0b3f7a;
    padding: 0.36rem 0.62rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.tool-action-btn:hover {
    background: #dfeeff;
}

.tool-favorite-btn.is-active {
    border-color: #caa95f;
    background: #fff7df;
    color: #7c5b14;
}

.detail-tool-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--bleu-roi);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.delete-btn:hover {
    opacity: 1;
    color: #c0392b;
}

.footer {
    background: linear-gradient(135deg, #0b2f6f, #1f5ea8);
    color: white;
    text-align: center;
    padding: 0.7rem 1rem;
    margin-top: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.app-native-tools-chrome,
.app-native-tools-bottom-bar,
.app-native-tools-close-create-btn {
    display: none;
}

/* Preload natif: on masque la version web immédiatement pour éviter le flash. */
html.native-preload body.page-outils {
    background: #eef3f8;
}

html.native-preload body.page-outils .header,
html.native-preload body.page-outils .footer,
html.native-preload body.page-outils .container {
    visibility: hidden !important;
    pointer-events: none !important;
}

html.native-preload body.page-outils .app-native-tools-chrome,
html.native-preload body.page-outils .app-native-tools-bottom-bar {
    display: block !important;
}

/* ================= Mode App Native: Outils ================= */
body.is-native-app .app-native-tools-chrome,
body.is-native-app .app-native-tools-bottom-bar,
body.is-native-app .app-native-tools-close-create-btn {
    display: block;
}

body.is-native-app {
    background: #eef3f8;
}

body.is-native-app .header,
body.is-native-app .footer {
    display: none;
}

body.is-native-app .container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 4.25rem 0 4.2rem;
    display: block;
}

body.is-native-app .app-native-tools-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: 4.05rem;
    z-index: 5500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    background: linear-gradient(180deg, #1a4f94 0%, #2f79cd 100%);
    color: #ffffff;
}

body.is-native-app .app-native-tools-topbar h2 {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1;
    font-weight: 800;
}

body.is-native-app .app-native-tools-subtitle {
    margin: 0;
    font-size: 0.66rem;
    line-height: 1.1;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.96);
}

body.is-native-app .app-native-tools-menu-btn {
    position: absolute;
    top: 0.4rem;
    left: 0.45rem;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

body.is-native-app .app-native-tools-menu-btn span {
    width: 34px;
    height: 3px;
    border-radius: 2px;
    background: #ffffff;
}

body.is-native-app .app-native-tools-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(24, 54, 94, 0.25);
    z-index: 5600;
}

body.is-native-app .app-native-tools-drawer {
    position: fixed;
    top: 0.7rem;
    left: 0.38rem;
    width: min(220px, 66vw);
    border-radius: 32px;
    background: #ffffff;
    padding: 0.95rem 1rem;
    box-shadow: 0 12px 24px rgba(10, 53, 104, 0.35);
    transform: translateX(-120%);
    transition: transform 0.22s ease;
    z-index: 5610;
}

body.is-native-app.app-native-tools-drawer-open .app-native-tools-drawer {
    transform: translateX(0);
}

body.is-native-app .app-native-tools-drawer a,
body.is-native-app .app-native-tools-drawer button {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(40, 118, 195, 0.7);
    color: #1974d2;
    font-size: 0.96rem;
    line-height: 1.2;
    padding: 0.54rem 0.2rem 0.4rem;
    margin: 0;
    cursor: pointer;
}

body.is-native-app .app-native-tools-drawer a.is-active {
    font-weight: 700;
    border-bottom-width: 2px;
}

body.is-native-app .tools-feed-column {
    gap: 0;
}

body.is-native-app .search-section {
    margin: 0;
    padding: 0.52rem 0.45rem;
    background: #b9def0;
}

body.is-native-app .search-input {
    width: 100%;
    border-radius: 999px;
    border: 2px solid #3e8cdc;
    padding: 0.74rem 1rem;
    text-align: left;
    font-size: 0.98rem;
    box-shadow: none;
}

body.is-native-app .tools-grid {
    grid-template-columns: 1fr;
    gap: 0.56rem;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

body.is-native-app .tool-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0 0 0.25rem;
    background: #ffffff;
}

body.is-native-app .tool-link {
    position: relative;
    display: block;
}

body.is-native-app .tool-image {
    width: 100%;
    height: 56vh;
    min-height: 290px;
    max-height: 520px;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
}

body.is-native-app .tool-card h3 {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.35rem 0.55rem 0.38rem;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
    background: rgba(35, 42, 55, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

body.is-native-app .tool-card > p {
    display: none;
}

body.is-native-app .age {
    margin: 0.42rem 0.45rem 0;
}

body.is-native-app .tool-actions {
    margin: 0.32rem 0.45rem 0;
}

body.is-native-app .delete-btn {
    top: 0.35rem;
    right: 0.35rem;
    color: #ffb3ab;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.2rem 0.45rem;
    opacity: 1;
}

body.is-native-app .add-tool-section {
    position: fixed;
    inset: 3.35rem 0 4.2rem 0;
    z-index: 5700;
    margin: 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    padding: 0.78rem;
    background: #ffffff;
    transform: translateX(103%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.24s ease, opacity 0.24s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.is-native-app.app-native-tools-create-open .add-tool-section {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

body.is-native-app .app-native-tools-close-create-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: rgba(31, 94, 168, 0.1);
    color: #1f5ea8;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
}

body.is-native-app .add-tool-section h2 {
    margin: 0 2.2rem 0.8rem 0;
    font-size: 1.65rem;
}

body.is-native-app .add-tool-section .tool-form {
    gap: 0.75rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

body.is-native-app .steps-container {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding-right: 0.1rem;
    padding-bottom: 0.35rem;
}

body.is-native-app .add-tool-section .submit-btn {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: 0.25rem;
    margin-bottom: 0;
    box-shadow: 0 -6px 14px rgba(255, 255, 255, 0.9);
}

body.is-native-app .app-native-tools-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4.2rem;
    z-index: 5650;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(180deg, #1a4f94 0%, #2f79cd 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
}

body.is-native-app .native-tools-publish-btn {
    height: 100%;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.34);
    background: transparent;
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
}

body.is-native-app .native-tools-plus-sign {
    font-size: 2.35rem;
    line-height: 1;
    vertical-align: middle;
    margin-left: 0.2rem;
}

body.is-native-app .native-tools-camera-btn {
    height: 100%;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 2.05rem;
    font-weight: 700;
    cursor: pointer;
}

body.is-native-app .app-native-tools-camera-launcher,
body.is-native-app .app-native-tools-step-modal {
    position: fixed;
    inset: 0;
    z-index: 5800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem;
    box-sizing: border-box;
    background: rgba(7, 28, 56, 0.5);
}

body.is-native-app .app-native-tools-camera-launcher[hidden],
body.is-native-app .app-native-tools-step-modal[hidden] {
    display: none !important;
}

body.is-native-app .app-native-tools-camera-launcher-card,
body.is-native-app .app-native-tools-step-card {
    width: min(480px, 94vw);
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #dbe7fb;
    box-shadow: 0 14px 32px rgba(8, 37, 75, 0.28);
    padding: 0.95rem;
    position: relative;
}

body.is-native-app .app-native-tools-camera-launcher-quit {
    position: absolute;
    top: 0.35rem;
    right: 0.4rem;
    border: 0;
    background: transparent;
    color: #315274;
    font-size: 1.35rem;
    cursor: pointer;
}

body.is-native-app .app-native-tools-camera-launcher-card h3,
body.is-native-app .app-native-tools-step-card h3 {
    margin: 0 0 0.5rem;
    color: #1a4f94;
    font-size: 1.15rem;
    text-align: center;
}

body.is-native-app .app-native-tools-camera-launcher-card p {
    margin: 0 0 0.8rem;
    text-align: center;
    color: #48617f;
}

body.is-native-app .app-native-tools-camera-open-btn {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, #1f5ea8, #2f7ed1);
    cursor: pointer;
}

body.is-native-app #appNativeToolsStepImagePreview {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #d4e5fb;
    margin-bottom: 0.65rem;
}

body.is-native-app #appNativeToolsStepText {
    width: 100%;
    min-height: 96px;
    border: 1px solid #bcd8fa;
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
    resize: vertical;
    box-sizing: border-box;
}

body.is-native-app .app-native-tools-step-actions {
    margin-top: 0.65rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
}

body.is-native-app .app-native-tools-step-actions button {
    border: 0;
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

body.is-native-app #appNativeToolsStepValidateBtn {
    background: linear-gradient(135deg, #0b8f4f, #15a55f);
}

body.is-native-app #appNativeToolsStepAddBtn {
    background: linear-gradient(135deg, #1f5ea8, #2f7ed1);
}

body.is-native-app #appNativeToolsStepRetryBtn {
    background: linear-gradient(135deg, #8c98ab, #6f7a8c);
}

.tools-skeleton {
    animation: toolsPulse 1.1s ease-in-out infinite alternate;
}

.tools-skeleton .skeleton-media,
.tools-skeleton .skeleton-line {
    background: rgba(255, 255, 255, 0.24);
    border-radius: 10px;
}

.tools-skeleton .skeleton-media {
    height: 210px;
    margin-bottom: 0.75rem;
}

.tools-skeleton .skeleton-line {
    height: 14px;
    margin-top: 0.55rem;
}

.tools-skeleton .skeleton-line-lg {
    width: 72%;
    height: 18px;
}

@keyframes toolsPulse {
    from { opacity: 0.55; }
    to { opacity: 1; }
}

@media (max-width: 768px) {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    body {
        overflow-x: hidden;
    }

    .header {
        height: auto;
        min-height: 220px;
    }

    .header-nav {
        flex-direction: column;
        gap: 0.6rem;
    }

    .header-left-links {
        margin-left: 0;
        width: 100%;
        align-items: center;
        justify-content: center;
    }

    .header-left-top,
    .header-left-bottom {
        justify-content: center;
        flex-wrap: wrap;
    }

    .header-nav .header-left-links > .a11y-toggle-btn {
        width: auto;
    }

    .header-title-stack {
        position: static;
        transform: none;
        gap: 0.3rem;
    }

    .header-title-stack .nav-links {
        justify-content: center;
        flex-wrap: wrap;
        margin-bottom: 0.15rem;
    }

    .container {
        width: 100%;
        max-width: 100%;
        margin: 1rem auto;
        padding: 0 0.75rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .search-section {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .add-tool-section,
    .tools-grid {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
    }

    .add-tool-section,
    .tools-grid,
    .tool-card {
        overflow: hidden;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tool-card {
        min-width: 0;
    }

    .detail-image {
        max-width: 100%;
    }

    .tool-image,
    .image-preview-thumb {
        display: block;
        max-width: 100%;
        height: auto;
    }
}
