/* ==============================
   Catalogue de Requetes IA
   Cegep de Saint-Hyacinthe
   4 couleurs : Bleu #00509F, Vert #C8D400, Orange #E84E0F, Turquoise #06B2CB
   ============================== */

.opc-catalog {
    /* Couleurs du Cegep */
    --csh-bleu: #00509F;
    --csh-bleu-light: #DCE8F5;
    --csh-bleu-dark: #003D7A;
    --csh-vert: #C8D400;
    --csh-vert-light: #EFF5B3;
    --csh-vert-dark: #7A8200;
    --csh-orange: #E84E0F;
    --csh-orange-light: #FDDED2;
    --csh-orange-dark: #B83A08;
    --csh-turquoise: #06B2CB;
    --csh-turquoise-light: #D0F0F6;
    --csh-turquoise-dark: #048A9E;

    /* Neutres */
    --text: #1B2A4A;
    --text-light: #3D5A80;
    --bg: #F5F7FA;
    --white: #ffffff;
    --gray-100: #f4f6f8;
    --gray-200: #e2e6ea;
    --gray-300: #cdd3da;
    --gray-500: #7a8694;
    --gray-700: #4a5568;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,80,159,0.06);
    --shadow-hover: 0 8px 28px rgba(0,80,159,0.13);
    --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
    --star-filled: #E6C547;
    --star-empty: #d0d5dc;

    font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif;
    color: var(--text);
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
}
.opc-catalog *, .opc-catalog *::before, .opc-catalog *::after { box-sizing: border-box; }

/* ==============================
   En-tete avec bande de couleurs
   ============================== */
.opc-catalog .opc-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 1.5rem;
}

.opc-catalog .opc-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--csh-bleu) 25%, var(--csh-vert) 25%, var(--csh-vert) 50%, var(--csh-orange) 50%, var(--csh-orange) 75%, var(--csh-turquoise) 75%);
}

.opc-catalog .opc-header h1, .opc-catalog .opc-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--csh-bleu);
    margin: 0 0 0.4rem;
    letter-spacing: -0.02em;
}

.opc-catalog .opc-header p {
    font-size: 1.05rem;
    color: var(--gray-700);
    margin: 0;
}

/* ==============================
   A propos
   ============================== */
.opc-about {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--csh-bleu);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.opc-about-toggle { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 1rem 1.25rem; background: none; border: none; font-family: inherit; font-size: 0.95rem; font-weight: 600; color: var(--text); cursor: pointer; transition: background var(--transition); }
.opc-about-toggle:hover { background: var(--gray-100); }
.opc-about-toggle svg { transition: transform var(--transition); }
.opc-about-toggle.open svg { transform: rotate(180deg); }
.opc-about-content { display: none; padding: 0 1.25rem 1.25rem; font-size: 0.9rem; color: var(--gray-700); line-height: 1.7; }
.opc-about-content.open { display: block; }
.opc-about-content a { color: var(--csh-bleu); font-weight: 600; }

/* ==============================
   Controles
   ============================== */
.opc-controls {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.opc-search-wrap { position: relative; margin-bottom: 1rem; }
.opc-search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--gray-500); pointer-events: none; }
.opc-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--text);
    background: var(--white);
    transition: border-color var(--transition);
    outline: none;
    font-family: inherit;
}
.opc-search-input:focus { border-color: var(--csh-bleu); }
.opc-search-input::placeholder { color: var(--gray-500); }

.opc-filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.opc-filter-group { flex: 1; min-width: 0; }
.opc-sort-group { flex: 0 0 auto; }
.opc-filter-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.opc-filter-hint { font-weight: 400; text-transform: none; font-size: 0.72rem; opacity: 0.8; margin-left: 0.3rem; letter-spacing: 0; }
.opc-filter-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Boutons filtres : couleur neutre par defaut */
.opc-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.85rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 100px;
    background: var(--white);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.opc-filter-btn:hover { border-color: var(--csh-bleu); color: var(--csh-bleu); }

/* Bouton "Tous" actif = bleu */
.opc-filter-btn[data-type="all"].active { background: var(--csh-bleu); border-color: var(--csh-bleu); color: var(--white); }

/* Boutons filtres colores quand actifs (assigne via JS avec data-color) */
.opc-filter-btn[data-color="bleu"].active { background: var(--csh-bleu); border-color: var(--csh-bleu); color: #fff; }
.opc-filter-btn[data-color="vert"].active { background: var(--csh-vert); border-color: var(--csh-vert); color: #1B2A4A; }
.opc-filter-btn[data-color="orange"].active { background: var(--csh-orange); border-color: var(--csh-orange); color: #fff; }
.opc-filter-btn[data-color="turquoise"].active { background: var(--csh-turquoise); border-color: var(--csh-turquoise); color: #fff; }

/* Hover colore */
.opc-filter-btn[data-color="bleu"]:hover { border-color: var(--csh-bleu); color: var(--csh-bleu); }
.opc-filter-btn[data-color="vert"]:hover { border-color: var(--csh-vert-dark); color: var(--csh-vert-dark); }
.opc-filter-btn[data-color="orange"]:hover { border-color: var(--csh-orange); color: var(--csh-orange); }
.opc-filter-btn[data-color="turquoise"]:hover { border-color: var(--csh-turquoise); color: var(--csh-turquoise); }

/* Boutons classe d'emploi actifs */
.opc-classe-btn[data-classe="all"].active { background: var(--csh-bleu); border-color: var(--csh-bleu); color: #fff; }
.opc-classe-btn.active { background: var(--text); border-color: var(--text); color: #fff; }
.opc-classe-btn:hover { border-color: var(--text); color: var(--text); }

.opc-filter-count { font-size: 0.75rem; opacity: 0.7; }
.opc-sort-select { padding: 0.45rem 2rem 0.45rem 0.75rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm); background: var(--white); color: var(--text); font-size: 0.85rem; font-family: inherit; cursor: pointer; outline: none; }
.opc-sort-select:focus { border-color: var(--csh-bleu); }
.opc-results-info { font-size: 0.85rem; color: var(--gray-500); margin-bottom: 1rem; padding: 0 0.25rem; }

/* ==============================
   Grille de cartes
   ============================== */
.opc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

/* Carte — barre de couleur a gauche */
.opc-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    animation: opcFadeUp 0.35s ease both;
}

/* Barre laterale coloree (assigne par JS via data-color) */
.opc-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 5px;
    background: var(--csh-bleu);
    transition: width var(--transition);
}
.opc-card[data-color="bleu"]::before { background: var(--csh-bleu); }
.opc-card[data-color="vert"]::before { background: var(--csh-vert); }
.opc-card[data-color="orange"]::before { background: var(--csh-orange); }
.opc-card[data-color="turquoise"]::before { background: var(--csh-turquoise); }

.opc-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}
.opc-card:hover::before { width: 8px; }

.opc-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.opc-card-types { display: flex; flex-wrap: wrap; gap: 0.25rem; }

/* Badges de type colores */
.opc-card-type {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.opc-card-type[data-color="bleu"] { background: var(--csh-bleu-light); color: var(--csh-bleu); }
.opc-card-type[data-color="vert"] { background: var(--csh-vert-light); color: var(--csh-vert-dark); }
.opc-card-type[data-color="orange"] { background: var(--csh-orange-light); color: var(--csh-orange-dark); }
.opc-card-type[data-color="turquoise"] { background: var(--csh-turquoise-light); color: var(--csh-turquoise-dark); }

.opc-card-outil { font-size: 0.7rem; color: var(--gray-500); white-space: nowrap; flex-shrink: 0; }
.opc-card-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: 0 0 0.35rem; line-height: 1.3; }
.opc-card-desc { font-size: 0.85rem; color: var(--gray-700); line-height: 1.5; margin-bottom: 0.5rem; flex: 1; }
.opc-card-footer { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: auto; }
.opc-card-tag { font-size: 0.7rem; color: var(--text-light); background: var(--gray-100); border: 1px solid var(--gray-200); padding: 0.15rem 0.5rem; border-radius: 100px; }

/* Rating */
.opc-card-rating { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; }
.opc-stars-static { display: inline-flex; align-items: center; gap: 1px; }
.opc-star.filled { fill: var(--star-filled); }
.opc-star.half { fill: var(--star-filled); }
.opc-star.empty { fill: var(--star-empty); }
.opc-rating-text { font-size: 0.75rem; color: var(--gray-500); }

@keyframes opcFadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Etat vide */
.opc-no-results { text-align: center; padding: 3rem 1rem; color: var(--gray-500); grid-column: 1 / -1; display: none; }
.opc-no-results svg { color: var(--gray-300); margin-bottom: 1rem; }
.opc-reset-btn { margin-top: 0.75rem; padding: 0.5rem 1.25rem; border: 1.5px solid var(--csh-bleu); border-radius: var(--radius-sm); background: transparent; color: var(--csh-bleu); font-size: 0.9rem; font-family: inherit; cursor: pointer; transition: all var(--transition); }
.opc-reset-btn:hover { background: var(--csh-bleu); color: var(--white); }

/* ==============================
   Modale
   ============================== */
.opc-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,42,92,0.5); backdrop-filter: blur(4px); z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.opc-modal-overlay.active { opacity: 1; visibility: visible; }
.opc-modal { background: var(--white); border-radius: var(--radius); max-width: 680px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 0; position: relative; box-shadow: 0 20px 60px rgba(0,42,92,0.3); transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); }
.opc-modal-overlay.active .opc-modal { transform: translateY(0); }

/* Barre coloree en haut de la modale */
.opc-modal::before {
    content: '';
    display: block;
    height: 6px;
    background: linear-gradient(90deg, var(--csh-bleu) 25%, var(--csh-vert) 25%, var(--csh-vert) 50%, var(--csh-orange) 50%, var(--csh-orange) 75%, var(--csh-turquoise) 75%);
    border-radius: var(--radius) var(--radius) 0 0;
}

.opc-modal-inner { padding: 1.75rem 2rem 1.5rem; }

.opc-modal-close { position: absolute; top: 1.25rem; right: 1.25rem; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: var(--gray-100); color: var(--text); cursor: pointer; transition: all var(--transition); padding: 0; z-index: 2; }
.opc-modal-close:hover { background: var(--csh-bleu-light); color: var(--csh-bleu); }
.opc-modal-title { font-size: 1.35rem; font-weight: 700; color: var(--text); margin: 0 2.5rem 0.4rem 0; line-height: 1.3; }
.opc-modal-description { font-size: 0.95rem; color: var(--gray-700); margin: 0 0 1rem; line-height: 1.5; }

/* Rating modale */
.opc-modal-rating { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; padding: 0.75rem 1rem; background: var(--gray-100); border-radius: var(--radius-sm); }
.opc-stars-interactive { display: inline-flex; align-items: center; gap: 2px; }
.opc-star-btn { background: none; border: none; padding: 2px; cursor: pointer; transition: transform 0.15s; line-height: 1; }
.opc-star-btn:hover { transform: scale(1.2); }
.opc-rating-info { font-size: 0.85rem; color: var(--gray-500); }
.opc-rating-message { font-size: 0.82rem; font-weight: 600; }
.opc-rating-message.success { color: #27ae60; }
.opc-rating-message.error { color: #e74c3c; }

/* Sections modale */
.opc-modal-section { margin-bottom: 1.25rem; }
.opc-modal-section-label { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; display: flex; align-items: center; justify-content: space-between; }

/* Prompt avec bordure coloree */
.opc-modal-prompt { background: var(--gray-100); border: 1px solid var(--gray-200); border-left: 4px solid var(--csh-bleu); border-radius: var(--radius-sm); padding: 1rem 1.25rem; font-family: inherit; font-size: 0.9rem; line-height: 1.65; color: var(--text); white-space: pre-wrap; word-wrap: break-word; margin: 0; }
.opc-copy-btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.75rem; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--csh-bleu); font-size: 0.85rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: all var(--transition); }
.opc-copy-btn:hover { background: var(--csh-bleu-light); }
.opc-copy-btn.copied { color: var(--csh-turquoise-dark); background: var(--csh-turquoise-light); }
.opc-modal-relance-list { list-style: none; padding: 0; margin: 0; background: var(--gray-100); border-radius: var(--radius-sm); overflow: hidden; }
.opc-modal-relance-item { padding: 0.65rem 1rem; font-size: 0.9rem; color: var(--text); border-bottom: 1px solid var(--gray-200); line-height: 1.5; }
.opc-modal-relance-item:last-child { border-bottom: none; }

/* Remarque avec orange */
.opc-modal-remarque { background: var(--csh-orange-light); border-left: 4px solid var(--csh-orange); border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-size: 0.9rem; line-height: 1.6; color: var(--text); }
.opc-modal-etiquettes-label { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.opc-modal-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.opc-modal-tag { font-size: 0.8rem; color: var(--text); background: var(--gray-100); border: 1px solid var(--gray-200); padding: 0.25rem 0.7rem; border-radius: var(--radius-sm); }

/* ==============================
   Responsive
   ============================== */
@media (max-width: 768px) {
    .opc-catalog { padding: 1rem 0.75rem; }
    .opc-catalog .opc-header h1, .opc-catalog .opc-header h2 { font-size: 1.5rem; }
    .opc-grid { grid-template-columns: 1fr; }
    .opc-filters { flex-direction: column; }
    .opc-filter-buttons { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.25rem; }
    .opc-modal-inner { padding: 1.25rem; }
    .opc-modal-title { font-size: 1.15rem; }
    .opc-modal-rating { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
}
