/* 
 * Chapter Beyond Search System 
 * Version: 1.0.0
 */

/* Barre de recherche principale */
.chapter-search-header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 100;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}

.search-input:focus {
    border-color: #007bff;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.search-input::placeholder {
    color: #999;
    font-style: italic;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 18px;
    pointer-events: none;
}

/* Modal de recherche */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    margin: 5% auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.search-modal.active .search-modal-content {
    transform: translateY(0);
}

/* Header du modal */
.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fafafa;
}

.modal-search-input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s ease;
}

.modal-search-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* Corps du modal */
.modal-body {
    display: flex;
    height: 500px;
    min-height: 400px;
}

/* Sidebar */
.modal-sidebar {
    width: 200px;
    background: #f8f9fa;
    border-right: 1px solid #eee;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: #666;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.sidebar-item:hover {
    background: #e9ecef;
    color: #495057;
    text-decoration: none;
}

.sidebar-item.active {
    background: #e3f2fd;
    color: #1976d2;
    border-left-color: #1976d2;
    text-decoration: none;
}

.sidebar-item .icon {
    margin-right: 10px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-item .count {
    margin-left: auto;
    background: #ddd;
    color: #666;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-item.active .count {
    background: #1976d2;
    color: white;
}

/* Zone de contenu principal */
.modal-content-area {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: white;
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

.see-all {
    color: #1976d2;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.see-all:hover {
    color: #0d47a1;
    text-decoration: underline;
}

/* Grille de cartes */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

/* Cartes membres */
.member-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #f0f0f0;
    position: relative;
    overflow: hidden;
}

.member-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #e0e0e0;
}

.member-card:active {
    transform: translateY(-2px);
}

.member-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.member-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #333;
    line-height: 1.3;
}

.member-location {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* États de chargement et messages */
.loading {
    text-align: center;
    padding: 3rem 2rem;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
}

.loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: #999;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
}

.error {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Animation de rotation pour le loader */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Animation d'apparition des cartes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.member-card {
    animation: fadeInUp 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chapter-search-header {
        padding: 1rem;
    }
    
    .search-modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .modal-body {
        flex-direction: column;
        height: auto;
        min-height: 300px;
    }
    
    .modal-sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 0.5rem 0;
    }
    
    .sidebar-item {
        min-width: 120px;
        flex-shrink: 0;
        padding: 8px 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .sidebar-item.active {
        border-left: none;
        border-bottom-color: #1976d2;
    }
    
    .modal-content-area {
        padding: 1rem;
    }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
    
    .member-card {
        padding: 0.75rem;
    }
    
    .member-avatar {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
        font-size: 16px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .search-container {
        padding: 0 1rem;
    }
    
    .search-input {
        padding: 10px 16px 10px 40px;
        font-size: 14px;
    }
    
    .modal-content-area {
        padding: 0.75rem;
    }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .section-title {
        font-size: 16px;
    }
}