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

body {
    font-family: arial, sans-serif;
    background: #fff;
    color: #202124;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

header {
    background: white;
    padding: 20px 20px 10px 20px;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: none;
    text-align: center;
    border-bottom: 1px solid #ebebeb;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

header h1 {
    font-size: 20px;
    color: #202124;
    margin-bottom: 5px;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

header h1 i {
    color: #1a73e8;
    font-size: 18px;
}

.search-icon-img {
    width: 128px;
    height: 128px;
    object-fit: contain;
    vertical-align: middle;
}

.subtitle {
    color: #5f6368;
    font-size: 13px;
    margin: 0;
    text-align: center;
}

.document-counter {
    margin: 12px 20px 12px 40px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f0fe 100%);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #5f6368;
    border: 1px solid #e8eaed;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    text-align: center;
}

.counter-label {
    color: #5f6368;
    font-weight: 400;
}

.counter-value {
    color: #1a73e8;
    font-weight: 600;
    font-size: 15px;
}

.counter-icon {
    font-size: 16px;
    color: #1a73e8;
}

.counter-badge {
    background: #1a73e8;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 11px;
    margin-left: 4px;
}

.setup-beta-link {
    margin-left: 8px;
    padding: 4px 10px;
    background: white;
    color: #1a73e8;
    border: 1px solid #dadce0;
    border-radius: 8px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.setup-beta-link:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1557b0;
}

main {
    background: white;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Conteneur pour le formulaire de recherche */
.search-form-container {
    padding: 20px 0 30px 0;
    background: white;
    margin-bottom: 0;
    max-width: 584px;
    margin-left: auto;
    margin-right: auto;
}

/* Centrer verticalement la zone de recherche quand pas de résultats */
main.search-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 300px); /* Hauteur viewport moins header/footer */
}

main.search-centered .search-form-container {
    width: 100%;
    padding: 40px 20px;
}

/* Conteneur pour les résultats */
.results-container {
    padding: 0;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

#searchInput {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    outline: none;
    transition: all 0.1s;
    box-shadow: none;
}

#searchInput:hover {
    box-shadow: 0 2px 5px 1px rgba(64,60,67,.16);
    border-color: rgba(223,225,229,0);
}

#searchInput:focus {
    box-shadow: 0 2px 5px 1px rgba(64,60,67,.16);
    border-color: rgba(223,225,229,0);
    outline: none;
}

.search-btn {
    padding: 11px 16px;
    font-size: 16px;
    background: #1a73e8;
    color: white;
    border: 1px solid #1a73e8;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.search-btn i {
    margin: 0;
}

.search-btn:hover {
    background: #1557b0;
    border-color: #1557b0;
    box-shadow: 0 2px 4px rgba(26, 115, 232, 0.2);
}

.toggle-filters-btn {
    padding: 11px 14px;
    font-size: 14px;
    background: #f8f9fa;
    color: #5f6368;
    border: 1px solid #dadce0;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.toggle-filters-btn:hover {
    background: #e8eaed;
    border-color: #dadce0;
}

.toggle-filters-btn.active {
    background: #e8f0fe;
    color: #1a73e8;
    border-color: #1a73e8;
}

/* Filtres avancés */
.advanced-filters {
    display: none;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 15px;
}

.advanced-filters.active {
    display: block;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    border-color: #667eea;
}

.filters-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-apply {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-apply:hover {
    background: #5568d3;
}

.btn-reset {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.3s;
    display: inline-block;
}

.btn-reset:hover {
    background: #5a6268;
}

.toggle-filters {
    padding: 10px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    color: #667eea;
    font-weight: 600;
    transition: all 0.3s;
}

.toggle-filters:hover {
    background: #f8f9fa;
}

/* Résultats */
.results-header {
    margin-bottom: 20px;
    padding: 0 20px;
    border-bottom: none;
    max-width: 100%;
}

.results-count {
    font-size: 14px;
    color: #70757a;
    font-weight: 400;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
    margin: 0;
    padding: 0 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.result-item {
    padding: 0;
    border: none;
    border-radius: 0;
    transition: none;
    margin-bottom: 24px;
}

.result-item:hover {
    box-shadow: none;
}

.result-item.has-images {
    padding-bottom: 16px;
    border-bottom: 1px solid #ebebeb;
}

.result-content-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.result-main-content {
    flex: 1;
    min-width: 0; /* Permet au contenu de se rétrécir si nécessaire */
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.result-header {
    margin-bottom: 4px;
}

.result-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.result-favicon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 2px;
}

.result-title {
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.result-title a {
    color: #1a0dab;
    text-decoration: none;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3;
    display: inline-block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.result-title a:hover {
    text-decoration: underline;
}

.result-title a:visited {
    color: #609;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 3px;
    line-height: 1.5;
    font-size: 14px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Container pour les images */
.result-images-container {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    box-sizing: border-box;
}

/* Image principale */
.result-main-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
}

.image-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.result-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: block;
}

.image-link:hover .result-main-img {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Miniatures */
.result-thumbnails {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    width: 100%;
}

.thumbnail-link {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.thumbnail-link:hover {
    transform: scale(1.1);
    z-index: 1;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.result-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s ease;
}

.thumbnail-link:hover .result-thumbnail {
    opacity: 0.9;
}

/* Ancien style pour compatibilité (si pas d'images) */
.result-images {
    display: flex;
    gap: 8px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.result-image {
    max-width: 120px;
    max-height: 90px;
    width: auto;
    height: auto;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid #e8eaed;
    cursor: pointer;
    transition: opacity 0.2s;
}

.result-image:hover {
    opacity: 0.8;
}

.result-url {
    color: #006621;
    font-size: 14px;
    word-break: break-all;
    font-weight: 400;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
}

.result-badge {
    background: #f1f3f4;
    color: #5f6368;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 4px;
}

.result-description {
    color: #545454;
    margin: 0;
    line-height: 1.58;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.result-snippets {
    margin: 3px 0 0 0;
}

.result-snippet {
    color: #545454;
    font-size: 14px;
    line-height: 1.58;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.result-snippet em {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-style: normal;
    font-weight: 700;
    color: #202124;
}

.result-footer {
    display: none; /* Masquer le footer pour un look plus épuré */
}

/* Footer masqué pour un look plus épuré */
.result-host,
.result-lang,
.result-date,
.result-links {
    display: none;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    padding: 20px 0;
    border-top: none;
}

.pagination-btn {
    padding: 8px 16px;
    background: #fff;
    color: #1a0dab;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 400;
    font-size: 14px;
    transition: all 0.1s;
    border: 1px solid transparent;
}

.pagination-btn:hover {
    background: #f8f9fa;
    border: 1px solid #dadce0;
    text-decoration: none;
}

.pagination-info {
    color: #70757a;
    font-weight: 400;
    font-size: 14px;
}

/* Messages */
.error-message {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Conseils rotatifs dans le header */
.rotating-tips {
    text-align: center;
    padding: 8px 20px;
    color: #5f6368;
    font-size: 13px;
    background: white;
    border-top: 1px solid #ebebeb;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rotating-tips .tip-text {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
    display: inline-block;
}

.rotating-tips .tip-text.hidden {
    opacity: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: #70757a;
    font-size: 13px;
    background: #fff;
    border-top: 1px solid #ebebeb;
    margin-top: auto; /* Pousse le footer en bas avec flexbox */
}

footer p {
    margin-bottom: 15px;
}

footer a {
    color: #1a73e8;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.footer-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #5f6368;
    font-size: 14px;
    transition: all 0.2s;
}

.footer-nav a:hover {
    background: #e8f0fe;
    color: #1a73e8;
    text-decoration: none;
}

.footer-nav a i {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        width: 100%;
    }
    
    .container {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    main {
        max-width: 100%;
        overflow-x: hidden;
        padding: 0;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .result-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pagination {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .results-list {
        padding: 0 15px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .results-header {
        padding: 0 15px;
    }
    
    /* Sur mobile, empiler les images sous le contenu */
    .result-content-wrapper {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .result-main-content {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .result-images-container {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        flex-direction: row;
        order: -1; /* Afficher les images en premier sur mobile */
        box-sizing: border-box;
    }
    
    .result-main-image {
        flex: 1;
        min-width: 0;
        max-width: 100%;
    }
    
    .result-thumbnails {
        grid-template-columns: repeat(3, 1fr);
        width: auto;
        flex: 0 0 120px;
        max-width: 100%;
    }
    
    .result-title a {
        font-size: 18px;
        word-break: break-word;
    }
    
    .result-url {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .result-images-container {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
    }
    
    .result-thumbnails {
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
        flex: none;
        max-width: 100%;
    }
    
    .result-main-image {
        width: 100%;
        max-width: 100%;
    }
    
    .document-counter {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 6px;
    }
    
    .search-form-container {
        padding: 15px 10px 20px 10px;
    }
}

/* Pages d'information */
.info-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.info-page h1 {
    font-size: 32px;
    color: #202124;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-page h1 i {
    color: #1a73e8;
}

.info-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #ebebeb;
}

.info-section:last-child {
    border-bottom: none;
}

.info-section h2 {
    font-size: 24px;
    color: #202124;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-section h2 i {
    color: #1a73e8;
    font-size: 20px;
}

.info-section h3 {
    font-size: 20px;
    color: #3c4043;
    margin-top: 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h3 i {
    color: #5f6368;
    font-size: 18px;
}

.info-section p {
    color: #5f6368;
    line-height: 1.8;
    margin-bottom: 15px;
    font-size: 15px;
}

.info-section ul,
.info-section ol {
    color: #5f6368;
    line-height: 1.8;
    margin-left: 20px;
    margin-bottom: 15px;
}

.info-section li {
    margin-bottom: 8px;
}

.info-section code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #c7254e;
}

.signal-card,
.policy-card,
.spec-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #1a73e8;
}

.signal-card h3,
.policy-card h3,
.spec-card h3 {
    margin-top: 0;
    color: #202124;
    display: flex;
    align-items: center;
    gap: 8px;
}

.signal-card h3 i,
.policy-card h3 i,
.spec-card h3 i {
    color: #1a73e8;
    font-size: 18px;
}

.signal-card ul,
.policy-card ul,
.spec-card ul {
    margin-top: 10px;
    list-style: none;
    padding-left: 0;
}

.spec-card ul li {
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    color: #5f6368;
}

.spec-card ul li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #1a73e8;
    font-weight: bold;
}

.back-link {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #ebebeb;
}

.back-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.2s;
}

.back-link a:hover {
    background: #e8f0fe;
    text-decoration: none;
}

.back-link a i {
    font-size: 14px;
}

