/**
 * Frontend styles for Founs Core
 *
 * @since      1.0.0
 * @package    Founs_Core
 * @subpackage Founs_Core/assets/css/frontend
 */

/* Global styles */
.founs-content-wrapper {
    width: 100% !important; 
    margin-left: auto; 
    margin-right: auto;
    padding: 0 20px;
    position: relative;
    display: flex;
    flex-wrap: wrap;
}

.founs-content {
    margin: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
}

/* Breadcrumb styles */
.founs-breadcrumb {
    width: 100%;
    padding: 10px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
    font-size: 14px;
}

.founs-breadcrumb a {
    color: #666;
    text-decoration: none;
    margin-right: 5px;
}

.founs-breadcrumb .separator {
    margin: 0 5px;
    color: #999;
}

.founs-breadcrumb .current {
    font-weight: 600;
    color: #333;
}

/* Fiche-outil styles */
.founs-fiche-outil {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    display: flex;
    flex-wrap: wrap;
}

/* Table of contents (Sommaire) */
.founs-toc-sidebar {
    width: 250px;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 20px 0;
    margin-right: 30px;
    scrollbar-width: thin;
}

.founs-toc-sidebar::-webkit-scrollbar {
    width: 6px;
}

.founs-toc-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.founs-toc-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--founs-accent-color, #C70039);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.founs-search-container {
    position: relative;
    margin-bottom: 20px;
}

.founs-search-container input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 30px;
    font-size: 14px;
    outline: none;
}

.founs-search-container input:focus {
    border-color: #aaa;
}

.founs-search-container .founs-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    color: #666;
    cursor: pointer;
}

.founs-search-container .founs-search-reset-btn {
    position: absolute;
    right: 36px; /* Positionné à gauche du bouton de recherche */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    color: #666;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.founs-search-container .founs-search-reset-btn:hover {
    opacity: 1;
}

/* Style pour les résultats de recherche */
#founs-search-results {
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
    min-height: 20px;
    font-weight: 600;
}

/* Nouveaux styles pour le compteur de résultats */
.founs-search-counter {
    display: inline-block;
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

/* Style amélioré pour les résultats surlignés */
mark.founs-search-highlight,
span.founs-search-highlight {
    background-color: rgba(255, 230, 0, 0.6);
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(255, 230, 0, 0.8);
    transition: background-color 0.2s;
}

.founs-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.founs-toc-item {
    padding: 6px 0;
    font-size: 14px;
    line-height: 1.3;
}

.founs-toc-item.active > a {
    color: var(--founs-accent-color, #C70039);
    font-weight: 600;
}

.founs-toc-link {
    color: #333;
    text-decoration: none;
    display: block;
    padding-left: 12px;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.founs-toc-link:hover {
    color: var(--founs-accent-color, #C70039);
    text-decoration: none;
}

.founs-toc-item.active > .founs-toc-link {
    border-left-color: var(--founs-accent-color, #C70039);
}

.founs-toc-list .founs-toc-list {
    padding-left: 15px;
    /* Le display: none a été supprimé pour permettre l'affichage de tous les niveaux par défaut */
}

/* Style optionnel pour la gestion des ouvertures/fermetures des sections */
.founs-toc-item.open > .founs-toc-list {
    /* Le style de visibilité est toujours appliqué pour les éléments avec classe .open */
    display: block;
}

/* Suppression du toggle pour le sommaire */

/* Main content area */
.founs-main-content {
    flex: 1;
    min-width: 0;
    padding: 30px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.founs-fiche-outil-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 1rem;
}

.founs-fiche-outil-header h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.3;
}

.founs-fiche-outil-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.founs-fiche-outil-meta-item {
    display: flex;
    align-items: center;
}

.founs-fiche-outil-meta-item svg {
    margin-right: 0.5rem;
    width: 16px;
    height: 16px;
}

.founs-fiche-outil-content {
    margin-bottom: 2rem;
    line-height: 1.6;
    color: #333;
}

.founs-fiche-outil-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.6rem;
    color: #333;
    font-weight: 600;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 0.5rem;
}

.founs-fiche-outil-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
    color: #333;
    font-weight: 600;
}

.founs-fiche-outil-content p {
    margin-bottom: 1rem;
}

.founs-fiche-outil-content ul,
.founs-fiche-outil-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.founs-fiche-outil-content li {
    margin-bottom: 0.5rem;
}

.founs-fiche-outil-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 4px;
}

.founs-fiche-outil-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.founs-fiche-outil-content table th,
.founs-fiche-outil-content table td {
    padding: 0.75rem;
    border: 1px solid #ddd;
    text-align: left;
}

.founs-fiche-outil-content table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.founs-fiche-outil-content blockquote {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-left: 4px solid #0073aa;
    font-style: italic;
}

.founs-fiche-outil-taxonomies {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eaeaea;
}

.founs-taxonomy-section {
    margin-bottom: 1rem;
}

.founs-taxonomy-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #555;
}

.founs-taxonomy-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.founs-taxonomy-item {
    background-color: #f0f0f0;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-size: 0.85rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.founs-taxonomy-item:hover {
    background-color: #e0e0e0;
    text-decoration: none;
}

.founs-patient-fiches {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f5f8fa;
    border-radius: 8px;
}

.founs-patient-fiches-title {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: #333;
    font-weight: 600;
}

.founs-patient-fiches-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.founs-patient-fiches-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e5e5;
}

.founs-patient-fiches-item:last-child {
    border-bottom: none;
}

.founs-patient-fiches-link {
    display: flex;
    align-items: center;
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.founs-patient-fiches-link svg {
    margin-right: 0.5rem;
    width: 16px;
    height: 16px;
}

.founs-patient-fiches-link:hover {
    text-decoration: underline;
}

/* Content title and header */
.founs-fiche-outil-title {
    font-size: 2rem;
    color: #333;
    margin: 10px 0 20px;
    font-weight: 600;
    line-height: 1.3;
}

/* Action buttons */
.founs-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 20px;
    gap: 15px;
}

.founs-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 5px;
}

.founs-action-button:hover {
    color: var(--founs-accent-color, #C70039);
}

.founs-action-button.active svg {
    stroke: var(--founs-accent-color, #C70039);
    fill: var(--founs-accent-color, #C70039);
}

.founs-action-button svg {
    width: 18px;
    height: 18px;
    margin-right: 5px;
}

.founs-action-button .founs-button-text {
    display: inline-block;
}

/* Positionnement des boutons d'action en haut sur mobile */
@media (max-width: 767px) {
    .founs-action-buttons {
        position: fixed;
        bottom: auto;
        top: 10px;
        right: 10px;
        z-index: 100;
        background-color: rgba(255, 255, 255, 0.9);
        padding: 5px;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .founs-action-button .founs-button-text {
        display: none;
    }
    
    .founs-action-button svg {
        margin-right: 0;
    }
}

/* Styles des favoris supprimés dans la version 1.0.34 */

/* Content sections */
.founs-section {
    margin-bottom: 30px;
}

.founs-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.founs-section-title::before {
    content: '•';
    color: var(--founs-accent-color, #C70039);
    font-size: 1.8rem;
    position: absolute;
    left: -20px;
    top: -8px;
}

/* Update date */
.founs-update-date {
    font-size: 13px;
    color: #666;
    margin-top: 10px;
    font-style: italic;
}

/* Comments section */
.founs-comments {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.founs-comments-title {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.founs-comments-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.founs-comment {
    padding: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.founs-comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.founs-comment-author {
    font-weight: 600;
    color: #333;
}

.founs-comment-date {
    font-size: 12px;
    color: #666;
}

.founs-comment-content {
    color: #444;
    line-height: 1.5;
}

.founs-comment-form {
    margin-top: 30px;
}

.founs-comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 100px;
    margin-bottom: 15px;
    resize: vertical;
}

.founs-comment-form button {
    background-color: var(--founs-accent-color, #C70039);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.founs-comment-form button:hover {
    background-color: #a8002f;
}

/* Back to top button */
.founs-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--founs-accent-color, #C70039);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.founs-back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.founs-back-to-top svg {
    width: 20px;
    height: 20px;
}

/* Fiche-patient styles */
.founs-fiche-patient {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 2rem auto;
}

.founs-fiche-patient-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #eaeaea;
}

.founs-fiche-patient-header h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 2rem;
    font-weight: 600;
}

.founs-fiche-patient-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.founs-professional-info {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #333;
}

.founs-professional-name {
    font-weight: 600;
}

.founs-professional-number {
    font-style: italic;
}

.founs-practice-location {
    margin-top: 0.5rem;
    font-style: normal;
}

.founs-fiche-patient-content {
    line-height: 1.6;
    color: #333;
}

.founs-fiche-patient-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: #333;
    font-weight: 600;
}

.founs-fiche-patient-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
    color: #333;
    font-weight: 600;
}

.founs-fiche-patient-content p {
    margin-bottom: 1rem;
}

.founs-fiche-patient-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eaeaea;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.founs-parent-fiche {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-size: 0.9rem;
}

.founs-parent-fiche-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.founs-parent-fiche-link:hover {
    text-decoration: underline;
}

/* Restricted content message */
.founs-restricted-content {
    padding: 2rem;
    margin: 2rem 0;
    background-color: #f9f9f9;
    border-left: 4px solid var(--founs-warning-color, #dc3232);
    text-align: center;
}

.founs-restricted-content p {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

/* Barre flottante pour le sommaire en version mobile */
.founs-floating-toc-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0 15px;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.founs-floating-toc-bar-title {
    font-weight: 600;
    color: var(--founs-accent-color, #C70039);
    display: flex;
    align-items: center;
    cursor: pointer;
}

.founs-floating-toc-bar-title svg {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.founs-floating-toc-bar-expanded .founs-floating-toc-bar-title svg {
    transform: rotate(180deg);
}

.founs-floating-toc-bar-actions {
    display: flex;
    align-items: center;
}

.founs-floating-toc-bar-search {
    margin-right: 10px;
    cursor: pointer;
    color: #666;
}

.founs-floating-toc-dropdown {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    padding: 20px 15px;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.founs-floating-toc-dropdown.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.founs-floating-search-dropdown {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    padding: 15px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.founs-floating-search-dropdown.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Responsive styling */
@media (max-width: 992px) {
    .founs-fiche-outil {
        flex-direction: column;
    }
    
    .founs-toc-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        margin-right: 0;
        margin-bottom: 30px;
        /* Suppression de la limite de hauteur */
        overflow-y: visible;
        max-height: none;
    }
    
    /* Styles pour le passage à la barre flottante pendant le défilement */
    body.founs-scrolled .founs-floating-toc-bar {
        display: flex;
    }
}

@media (max-width: 768px) {
    .founs-fiche-outil,
    .founs-fiche-patient {
        padding: 1rem;
    }
    
    .founs-fiche-outil-header h1,
    .founs-fiche-patient-header h1,
    .founs-fiche-outil-title {
        font-size: 1.5rem;
    }
    
    .founs-fiche-outil-content h2,
    .founs-fiche-patient-content h2,
    .founs-section-title {
        font-size: 1.3rem;
    }
    
    .founs-fiche-outil-content h3,
    .founs-fiche-patient-content h3 {
        font-size: 1.1rem;
    }
    
    .founs-main-content {
        padding: 15px;
    }
    
    .founs-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

/* Print styles */
@media print {
    /* Hide elements not needed for printing */
    .founs-toc-sidebar,
    .founs-breadcrumb,
    .founs-actions,
    .founs-comments,
    .founs-back-to-top,
    #wpadminbar,
    #site-header,
    #site-footer,
    header,
    footer,
    .site-header,
    .site-footer,
    nav,
    .navigation,
    .menu,
    .widget-area,
    .sidebar,
    .wp-block-search,
    .comment-respond,
    .comment-form {
        display: none !important;
    }
    
    /* Full width container */
    .founs-content-wrapper,
    .founs-content,
    .founs-fiche-outil,
    .founs-main-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        float: none !important;
        display: block !important;
    }
    
    /* Typography for print */
    body {
        font-family: Georgia, 'Times New Roman', Times, serif !important;
        font-size: 12pt !important;
        line-height: 1.5 !important;
        color: #000 !important;
        background: #fff !important;
    }
    
    .founs-fiche-outil-title {
        font-size: 18pt !important;
        margin-bottom: 15pt !important;
    }
    
    .founs-section-title {
        font-size: 14pt !important;
        margin-top: 15pt !important;
        margin-bottom: 10pt !important;
        page-break-after: avoid !important;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
    }
    
    img, table, figure {
        page-break-inside: avoid !important;
        max-width: 100% !important;
    }
    
    p, li {
        orphans: 3 !important;
        widows: 3 !important;
    }
    
    /* Add URL after links */
    a[href]:after {
        content: " (" attr(href) ")" !important;
        font-size: 90% !important;
        color: #666 !important;
    }
    
    /* Don't show URL for internal links */
    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "" !important;
    }
    
    /* Add page information */
    @page {
        margin: 2cm 1.5cm !important;
    }
    
    /* Add custom header and footer for print */
    .founs-print-header,
    .founs-print-footer {
        display: block !important;
    }
    
    .founs-print-header {
        text-align: center !important;
        margin-bottom: 20pt !important;
        padding-bottom: 10pt !important;
        border-bottom: 1pt solid #000 !important;
    }
    
    .founs-print-footer {
        text-align: center !important;
        margin-top: 20pt !important;
        padding-top: 10pt !important;
        border-top: 1pt solid #000 !important;
        font-size: 9pt !important;
        color: #666 !important;
    }
    
    /* Force page breaks */
    .founs-section {
        page-break-inside: avoid !important;
    }
    
    /* Add professional information to print */
    .founs-print-professional-info {
        display: block !important;
        margin-top: 15pt !important;
        padding: 10pt !important;
        border: 1pt solid #999 !important;
        background-color: #f8f8f8 !important;
    }
}
