/* APNC Bibliotek - Styles Frontend */

/* Conteneur principal */
.apnc-bibliotek-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   BULLETINS RÉCENTS (Vue horizontale)
   ======================================== */

.apnc-recent-bulletins {
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.apnc-recent-bulletins h3 {
    color: white;
    font-size: 24px;
    margin: 0 0 25px 0;
    text-align: center;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Ajouter l'icône livre via CSS */
.apnc-recent-bulletins h3:before {
    content: "\1F4DA"; /* Code Unicode pour 📚 */
    margin-right: 10px;
}

.apnc-bulletins-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.apnc-bulletin-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    position: relative;
}

.apnc-bulletin-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.2);
}

.apnc-bulletin-thumbnail {
    width: 100%;
    height: 280px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Styles pour l'image de couverture (miniature PDF) */
.apnc-bulletin-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.apnc-bulletin-card:hover .apnc-bulletin-thumbnail img {
    transform: scale(1.05);
}

/* Icône par défaut si pas d'image */
.apnc-bulletin-thumbnail-icon {
    font-size: 80px;
    color: rgba(255,255,255,0.8);
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Utiliser un pseudo-élément pour l'icône par défaut */
.apnc-bulletin-thumbnail-icon:before {
    content: "\1F4DA"; /* 📚 */
}

/* Badge "NOUVEAU" en overlay */
.apnc-bulletin-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff6b6b;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255,107,107,0.4);
    letter-spacing: 0.5px;
}

.apnc-bulletin-info {
    padding: 15px;
    background: white;
}

.apnc-bulletin-title {
    color: #2c3e50 !important;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px 0;
    text-decoration: none !important;
    line-height: 1.3;
}

.apnc-bulletin-date {
    color: #7f8c8d;
    font-size: 13px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Icône calendrier via CSS */
.apnc-bulletin-date:before {
    content: "\1F4C5"; /* 📅 */
    font-size: 14px;
}

.apnc-bulletin-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ecf0f1;
    font-size: 12px;
    color: #95a5a6;
}

.apnc-bulletin-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Icône document via CSS */
.apnc-bulletin-pages:before {
    content: "\1F4C4"; /* 📄 */
    font-size: 14px;
}

/* Indicateur "Cliquez pour ouvrir" */
.apnc-bulletin-action {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #3498db;
    font-weight: 600;
}

.apnc-bulletin-action:after {
    content: "\2192"; /* → */
    font-size: 14px;
    transition: transform 0.2s;
}

.apnc-bulletin-card:hover .apnc-bulletin-action:after {
    transform: translateX(3px);
}

.apnc-bulletin-thumbnail {
    position: relative;
    overflow: hidden;
}

.apnc-bulletin-hover {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
}

.apnc-bulletin-hover-content {
    font-size: 0.9rem;
    line-height: 1.4;
}

.apnc-bulletin-card:hover .apnc-bulletin-hover {
    opacity: 1;
}


/* Zone de recherche */
.apnc-search-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.apnc-search-box h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Icône loupe via CSS */
.apnc-search-box h2:before {
    content: "\1F50D"; /* 🔍 */
    font-size: 28px;
}

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

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

.apnc-form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.apnc-form-group select,
.apnc-form-group input[type="text"] {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.apnc-form-group select:focus,
.apnc-form-group input[type="text"]:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.apnc-search-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

/* Boutons - FORCER LES COULEURS */
.apnc-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.apnc-btn-primary {
    background: #007bff !important;
    color: white !important;
    border: none !important;
}

.apnc-btn-primary:hover {
    background: #0056b3 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
    text-decoration: none !important;
}

.apnc-btn-primary:visited,
.apnc-btn-primary:focus,
.apnc-btn-primary:active {
    color: white !important;
    text-decoration: none !important;
}

.apnc-btn-secondary {
    background: #6c757d !important;
    color: white !important;
}

.apnc-btn-secondary:hover {
    background: #545b62 !important;
    color: white !important;
}

/* Zone de résultats */
.apnc-results-container {
    margin-top: 20px;
}

.apnc-search-results-header {
    background: #e7f3ff;
    border-left: 4px solid #007bff;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.apnc-search-results-header p {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
}

/* Carte article */
.apnc-article-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.apnc-article-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.apnc-article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.apnc-article-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
    flex: 1;
}

.apnc-article-date {
    background: #e3f2fd;
    color: #1976d2;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.apnc-article-thematique {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.apnc-badge {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Pages */
.apnc-article-pages {
    color: #666;
    font-size: 13px;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #f0f8ff;
    border-left: 3px solid #007bff;
    border-radius: 3px;
}

.apnc-article-pages strong {
    color: #495057;
}

/* Ajouter l'icône via CSS */
.apnc-article-pages strong:before {
    content: "\1F4C4 "; /* 📄 */
}

.apnc-article-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 12px;
}

.apnc-article-description p {
    margin: 0 0 10px 0;
}

.apnc-article-keywords {
    color: #666;
    font-size: 13px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 15px;
}

.apnc-article-keywords strong {
    color: #495057;
}

/* Ajouter l'icône via CSS */
.apnc-article-keywords strong:before {
    content: "\1F3F7 "; /* 🏷️ */
}

/* Origine */
.apnc-article-origine {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 3px;
    margin-bottom: 15px;
    font-size: 13px;
}

.apnc-origine-type,
.apnc-origine-source {
    color: #856404;
}

.apnc-origine-type strong,
.apnc-origine-source strong {
    color: #6c5600;
    margin-right: 5px;
}

.apnc-article-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

/* Ajouter l'icône au bouton PDF via CSS */
.apnc-btn-primary:before {
    content: "\1F4C4"; /* 📄 */
    margin-right: 5px;
}

.apnc-pages-info {
    font-size: 12px;
    color: #666;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Message aucun résultat */
.apnc-no-results {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
}

.apnc-no-results p {
    margin: 0;
    color: #856404;
    font-size: 16px;
}

/* Loader */
.apnc-loader {
    display: none;
    text-align: center;
    padding: 40px;
}

.apnc-loader.active {
    display: block;
}

.apnc-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: apnc-spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes apnc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Classes pour masquer/afficher */
.apnc-hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .apnc-bulletins-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .apnc-search-form {
        grid-template-columns: 1fr;
    }
    
    .apnc-bulletins-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .apnc-bulletin-thumbnail {
        height: 200px;
    }
    
    .apnc-recent-bulletins {
        padding: 20px 15px;
    }
    
    .apnc-recent-bulletins h3 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .apnc-article-header {
        flex-direction: column;
    }
    
    .apnc-article-date {
        align-self: flex-start;
    }
    
    .apnc-search-actions {
        flex-direction: column;
    }
    
    .apnc-btn {
        width: 100%;
        justify-content: center;
    }
    
    .apnc-article-origine {
        flex-direction: column;
        gap: 8px;
    }
    
    .apnc-article-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .apnc-pages-info {
        text-align: center;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    .apnc-bulletin-thumbnail {
        height: 180px;
    }
    
    .apnc-bulletin-title {
        font-size: 14px;
    }
    
    .apnc-bulletin-info {
        padding: 12px;
    }
}

/* Print styles */
@media print {
    .apnc-search-box,
    .apnc-article-actions,
    .apnc-recent-bulletins {
        display: none;
    }
    
    .apnc-article-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}