/**
 * Styles spécifiques pour la page theme.php
 * Affichage d'un thème individuel avec ses recettes
 *
 * Note : Les styles H1 sont gérés dans commun.css (harmonisation globale)
 */

/* ========================================
   BLOC D'INFORMATION DU THÈME
======================================== */

.theme-info-block {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0px;
    margin: 10px 0 0px 0;
    border-radius: 8px;
    overflow: hidden;
}

.theme-info-container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 30px;
    align-items: start;
}

/* Image principale du thème */
.theme-image-wrapper {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.theme-main-image {
    max-height: 220px;
    width: 100%;
    display: block;
    object-fit: cover;
}

.theme-no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: #f0f0f0;
    color: #999;
    text-align: center;
}

.theme-no-image svg {
    margin-bottom: 10px;
    opacity: 0.5;
}

.theme-no-image p {
    margin: 0;
    font-size: 0.9rem;
    color: #999;
}

/* Tags informatifs */
.theme-tags-wrapper {
    padding: 15px 20px 0 0;
}

.theme-tags-title {
    font-size: 1.1rem;
    margin: 0 0 20px 0;
    color: #333;
    font-weight: 600;
}

.theme-tags-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.theme-tag-item {
    display: flex;
    align-items: center;
    padding: 4px 0;
}

.theme-tag-item:last-child {
    border-bottom: none;
}

.theme-tag-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    line-height: 1.5;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    font-size: 1rem;
    align-self: flex-start;
    margin-top: 2px;
}

.theme-tag-icon .icon-lg {
    font-size: 1.1rem;
}

/* Couleurs des icônes par type */
.theme-tag-icon.tag-allergenes {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 107, 107, 0.4);
}

.theme-tag-icon.tag-nutrition {
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(81, 207, 102, 0.4);
}

.theme-tag-icon.tag-temps {
    background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(77, 171, 247, 0.4);
}

.theme-tag-icon.tag-prix {
    background: linear-gradient(135deg, #ffd43b 0%, #fab005 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 14px rgba(255, 212, 59, 0.4);
}

.theme-tag-icon.tag-difficulte {
    background: linear-gradient(135deg, #be4bdb 0%, #9c36b5 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(190, 75, 219, 0.4);
}

.theme-tag-icon.tag-etapes {
    background: linear-gradient(135deg, #ff922b 0%, #fd7e14 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 146, 43, 0.4);
}

.theme-tag-icon.tag-ustensiles {
    background: linear-gradient(135deg, #22b8cf 0%, #15aabf 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(34, 184, 207, 0.4);
}

.theme-tag-icon.tag-ingredients {
    background: linear-gradient(135deg, #94d82d 0%, #82c91e 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 14px rgba(148, 216, 45, 0.4);
}

.theme-tag-content {
    font-size: 1rem;
    line-height: 1.5;
    color: #555;
}

.theme-tag-content strong {
    color: #333;
    font-weight: 600;
}

.no-tags {
    color: #999;
    font-style: italic;
    padding: 20px 0;
}

/* ========================================
   SLOGAN DU THÈME
======================================== */

.theme-slogan {
    font-size: 1.2rem;
    color: #666;
    text-align: center;
    font-style: italic;
    margin: 20px 0 30px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #ff6b35;
}

/* ========================================
   FILTRES PAR CATÉGORIES
======================================== */

.category-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 20px;
}

.category-filter-group label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 0.95rem;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s ease;
    min-width: 200px;
}

.filter-select:hover {
    border-color: #ff6b35;
}

.filter-select:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.results-count {
    font-size: 0.95rem;
    color: #666;
}

.results-count span {
    font-weight: 600;
    color: #ff6b35;
}

/* ========================================
   GRILLE DE RECETTES
======================================== */

/* La grille est désormais gérée par page-categories-recettes-cards.css */
/* Les styles des .recipe-card sont importés depuis components/recipe-card.css */
/* Ne pas surcharger ici pour éviter les conflits */

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
}

/* ========================================
   RESPONSIVE
======================================== */

/* Note : Les media queries pour H1 sont gérées dans commun.css */

@media (max-width: 1200px) {
    .theme-info-container {
        grid-template-columns: 350px 1fr;
    }
}


@media (max-width: 1024px) {
    .theme-info-block {
        padding: 0px;
        margin: 5px 0 0 0;
        border-radius: 8px;
        overflow: hidden;
    }

    .theme-info-container {
        grid-template-columns: auto 1fr;
    }
}

@media (max-width: 768px) {
    .theme-info-block {
        padding: 0px;
        margin: 0px 0 0 0;
    }

    .theme-tags-wrapper {
        padding: 0px 20px 20px 20px;
    }

    .theme-info-container {
        border-radius: 8px 8px 0 0;
        overflow: hidden;
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .theme-image-wrapper {
        max-width: 100%;
    }

    .theme-tags-title {
        margin-bottom: 10px;
        font-size: 1.1rem;
    }

    .theme-slogan {
        font-size: 1.1rem;
        padding: 15px;
    }

    .category-filter-group {
        flex-direction: column;
        align-items: flex-start;
        margin-right: 0;
        margin-bottom: 15px;
    }

    .filter-select {
        width: 100%;
    }

    .recipes-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .theme-info-block {
        padding: 0px;
        margin: 0px;
    }

    .theme-tags-wrapper {
        padding: 0px 20px 20px 20px;
    }

    .theme-info-container {
        border-radius: 8px 8px 0 0;
        overflow: hidden;
        gap: 15px;
    }

    .theme-tags-title {
        font-size: 1.0rem;
        margin-bottom: 10px;
    }

    .theme-tag-icon {
        font-size: 1.2rem;
        margin-right: 10px;
    }

    .theme-tag-content {
        font-size: 0.9rem;
    }
}

/* ========================================
   MODE SOMBRE
======================================== */

/* Note : Les styles H1 dark mode sont gérés dans commun.css */

.dark-mode .theme-info-block {
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.dark-mode .theme-image-wrapper {
    background: transparent;
}

.dark-mode .theme-tags-wrapper {
    background: transparent;
}

.dark-mode .theme-tags-title {
    color: #f0f0f0;
}

.dark-mode .theme-tag-item {
    border-bottom-color: #333;
}

.dark-mode .theme-tag-content {
    color: #bbb;
}

.dark-mode .theme-tag-content strong {
    color: #f0f0f0;
}

.dark-mode .no-tags {
    color: #777;
}

.dark-mode .theme-slogan {
    background: #2d2d2d;
    color: #bbb;
    border-left-color: #ff6b35;
}

.dark-mode .category-filter-group label {
    color: #f0f0f0;
}

.dark-mode .filter-select {
    background: #2d2d2d;
    border-color: #444;
    color: #f0f0f0;
}

.dark-mode .filter-select:hover {
    border-color: #ff6b35;
}

.dark-mode .filter-select:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.dark-mode .results-count {
    color: #bbb;
}

.dark-mode .results-count span {
    color: #ff6b35;
}

/* Les styles de .recipe-card en mode sombre sont gérés par components/recipe-card.css */
/* Ne pas surcharger ici */

.dark-mode .no-results {
    color: #777;
}

.dark-mode .theme-no-image {
    background: #2d2d2d;
    color: #777;
}

.dark-mode .theme-no-image p {
    color: #777;
}

.dark-mode .theme-no-image svg {
    opacity: 0.3;
}

/* ============================================
   SELECT DE CATÉGORIES - UNIFORMISÉ AVEC LE SELECT DE TRI
   ============================================ */

.category-filter-container {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* Styles de base - MODE CLAIR (identiques au .sort-select) */
.category-select {
    /* Layout */
    padding: 0 35px 0 12px !important;
    height: 40px !important;
    width: 200px !important;
    min-width: 200px !important;
    max-width: 200px !important;
    display: inline-flex !important;
    align-items: center !important;

    /* Typography */
    font-size: 0.9rem !important;
    font-weight: 500;
    color: var(--text-color);
    text-overflow: ellipsis !important;
    white-space: nowrap !important;

    /* Borders & Radius */
    border: 1px solid var(--border-color, #ccc);
    border-radius: 6px;

    /* Background */
    background-color: transparent;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 12px !important;

    /* Custom arrow icon MODE CLAIR */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;

    /* Remove default arrow */
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;

    /* Cursor & Transitions */
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Hover state MODE CLAIR */
.category-select:hover {
    border-color: #444;
}

/* Focus state MODE CLAIR */
.category-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

/* ============================================
   MODE SOMBRE - SELECT DE CATÉGORIES
   ============================================ */

.dark-mode .category-select {
    background-color: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;

    /* Custom arrow icon MODE SOMBRE (flèche claire) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f0f0f0' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
}

.dark-mode .category-select:hover {
    border-color: #666;
}

.dark-mode .category-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.3);
}

/* Options du select en mode sombre */
.dark-mode .category-select option {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

/* ============================================
   RESPONSIVE - SELECT DE CATÉGORIES
   ============================================ */

@media (min-width: 769px) and (max-width: 1024px) {
    .category-select {
        width: 180px !important;
        min-width: 180px !important;
        max-width: 180px !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 768px) {
    .category-select {
        width: 160px !important;
        min-width: 160px !important;
        max-width: 160px !important;
        font-size: 0.85rem !important;
        padding: 0 28px 0 8px !important;
    }
}

@media (max-width: 480px) {
    .category-select {
        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;
        font-size: 0.85rem !important;
    }
}

@media (max-width: 380px) {
    .category-select {
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
        font-size: 0.8rem !important;
        padding: 0 24px 0 6px !important;
    }

    .category-select option {
        font-size: 0.75rem !important;
    }
}

/* ============================================
   LOADER DE CHARGEMENT DES RECETTES
   ============================================ */

.recipes-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    min-height: 300px;
}

.recipes-loader .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 107, 107, 0.2);
    border-top-color: #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.recipes-loader p {
    color: #666;
    font-size: 16px;
    margin: 0;
    font-weight: 500;
}

/* Masquer le loader une fois les données chargées */
.recipes-loader.hidden {
    display: none;
}

/* Masquer le tableau pendant le chargement */
#recettes-table {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#recettes-table.loaded {
    opacity: 1;
}

/* ============================================
   MESSAGES DATATABLES - CENTRÉS
   ============================================ */

/* Message "Aucune recette trouvée" centré */
.dataTables_empty {
    text-align: center !important;
    padding: 80px 20px !important;
    font-size: 18px !important;
    color: #666 !important;
    font-weight: 500;
}

/* Container du message pendant le traitement */
.dataTables_processing {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: auto !important;
    margin: 0 !important;
    padding: 20px 30px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    text-align: center !important;
    font-size: 14px !important;
    color: #333 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    z-index: 1000 !important;
}

/* ============================================
   MODE SOMBRE - LOADER ET MESSAGES
   ============================================ */

.dark-mode .recipes-loader p {
    color: #bbb;
}

.dark-mode .dataTables_empty {
    color: #bbb !important;
}

.dark-mode .dataTables_processing {
    background: rgba(44, 62, 80, 0.95) !important;
    color: #ecf0f1 !important;
    border-color: #34495e !important;
}
