/**
 * Gebb Portal - Public Styles
 * Version: 1.3.1
 * Style GEBB : noir/blanc + accent rouge, angles droits, zéro bleu
 */

/* Variables CSS - héritent du thème Astra si disponible */
:root {
    --gebb-portal-primary: var(--ast-global-color-2, #1a1a1a);
    --gebb-portal-primary-dark: var(--ast-global-color-3, #333333);
    --gebb-portal-secondary: var(--ast-global-color-0, #c41e3a);
    --gebb-portal-text: var(--ast-global-color-3, #333333);
    --gebb-portal-muted: rgba(0, 0, 0, 0.6);
    --gebb-portal-border: var(--ast-border-color, #dddddd);
    --gebb-portal-bg: var(--ast-global-color-5, #ffffff);
    --gebb-portal-bg-alt: var(--ast-global-color-5, #ffffff);
    --gebb-portal-radius: 0;
    --gebb-portal-shadow: none;
    --gebb-portal-icon-size: 40px;
}

/* =====================================================
   CARD - Conteneur de base
   ===================================================== */

.gebb-portal-card {
    background: var(--gebb-portal-bg);
    border: 1px solid var(--gebb-portal-border);
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin-bottom: 28px;
}

.gebb-portal-title {
    font-family: 'Yeseva One', display;
    color: var(--gebb-portal-primary);
    text-transform: uppercase;
    letter-spacing: 0;
    font-weight: 400;
    font-size: clamp(28px, 3.2vw, 48px);
    line-height: .95em;
    margin: 0;
    padding: 18px 18px 14px 18px;
    border-bottom: 1px solid var(--gebb-portal-border);
}

.gebb-portal-muted {
    color: var(--gebb-portal-muted);
    font-size: 0.9em;
    line-height: 1.4;
}

/* =====================================================
   LISTES
   ===================================================== */

.gebb-portal-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gebb-portal-list li {
    padding: 16px 18px;
    border-bottom: 1px solid var(--gebb-portal-border);
}

.gebb-portal-list li:last-child {
    border-bottom: none;
}

.gebb-portal-list a {
    color: var(--gebb-portal-primary);
    text-decoration: none;
    font-weight: 600;
    line-height: 1.35;
    transition: color 0.2s ease;
}

.gebb-portal-list a:hover,
.gebb-portal-list a:focus {
    color: var(--gebb-portal-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* =====================================================
   NEWS - Actualités avec images RSS
   ===================================================== */

.gebb-portal-news-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* Lien image cliquable */
.gebb-portal-news-image-link {
    flex-shrink: 0;
    text-decoration: none;
}

.gebb-portal-news-image {
    flex-shrink: 0;
    width: 140px;
    height: 86px;
    overflow: hidden;
    border-radius: 0;
    border: 1px solid var(--gebb-portal-border);
    background: #f5f5f5;
}

.gebb-portal-news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(100%);
    transition: filter 0.25s ease, transform 0.25s ease;
}

/* Hover : image redevient couleur */
.gebb-portal-news-item:hover .gebb-portal-news-image img,
.gebb-portal-news-item:focus-within .gebb-portal-news-image img {
    filter: grayscale(0%);
    transform: scale(1.02);
}

/* Neutralise les variantes de taille - géré par Elementor */
.gebb-portal-news-img-small .gebb-portal-news-image,
.gebb-portal-news-img-medium .gebb-portal-news-image,
.gebb-portal-news-img-large .gebb-portal-news-image {
    width: 140px;
    height: 86px;
}

.gebb-portal-news-content {
    flex: 1;
    min-width: 0;
}

.gebb-portal-news-title {
    display: block;
    color: var(--gebb-portal-primary);
    text-decoration: none;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 4px;
}

.gebb-portal-news-title:hover,
.gebb-portal-news-title:focus {
    color: var(--gebb-portal-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gebb-portal-news-meta {
    font-size: 0.85rem;
    margin-top: 6px;
    line-height: 1.35;
}

.gebb-portal-news-excerpt {
    font-size: 0.9rem;
    margin-top: 8px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Désactive les layouts "grid/cards" pour rester en liste éditoriale */
.gebb-portal-news-grid .gebb-portal-news-list,
.gebb-portal-news-cards .gebb-portal-news-list {
    display: block;
}

.gebb-portal-news-grid .gebb-portal-news-item,
.gebb-portal-news-cards .gebb-portal-news-item {
    background: transparent;
    border-radius: 0;
    padding: 0;
    transform: none;
    box-shadow: none;
}

/* =====================================================
   LINKS - Liens utiles avec pictos SVG
   ===================================================== */

.gebb-portal-link-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.gebb-portal-link-item.has-icon {
    align-items: center;
}

.gebb-portal-link-icon {
    flex-shrink: 0;
    width: var(--gebb-portal-icon-size);
    height: var(--gebb-portal-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gebb-portal-link-icon svg {
    width: 100%;
    height: 100%;
    max-width: var(--gebb-portal-icon-size);
    max-height: var(--gebb-portal-icon-size);
}

.gebb-portal-link-icon img,
.gebb-portal-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gebb-portal-link-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gebb-portal-link-content a {
    display: block;
    color: var(--gebb-portal-primary);
    text-decoration: none;
}

.gebb-portal-link-content a:hover,
.gebb-portal-link-content a:focus {
    color: var(--gebb-portal-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Grid avec icônes */
.gebb-portal-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.gebb-portal-link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px;
    background: var(--gebb-portal-bg);
    border: 1px solid var(--gebb-portal-border);
    border-radius: 0;
    box-shadow: none;
    text-decoration: none;
    transition: none;
}

.gebb-portal-link-card:hover,
.gebb-portal-link-card:focus {
    transform: none;
    box-shadow: none;
    color: var(--gebb-portal-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gebb-portal-link-card.has-icon {
    padding-top: 24px;
}

.gebb-portal-link-card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gebb-portal-link-card-icon svg {
    width: 100%;
    height: 100%;
    max-width: 48px;
    max-height: 48px;
}

.gebb-portal-link-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gebb-portal-link-card-title {
    color: var(--gebb-portal-primary);
    font-family: 'Yeseva One', display;
    text-transform: uppercase;
    font-weight: 400;
    margin-bottom: 4px;
    line-height: 1.3;
}

.gebb-portal-link-card-desc {
    color: var(--gebb-portal-muted);
    font-size: 0.85em;
    line-height: 1.4;
}

/* =====================================================
   DASHBOARD
   ===================================================== */

.gebb-portal-dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gebb-portal-dashboard-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.gebb-portal-dashboard-columns .gebb-portal-card {
    margin-bottom: 0;
}

/* =====================================================
   YOUTUBE - Vidéos avec lecteur embed
   ===================================================== */

.gebb-portal-youtube-title {
    font-family: 'Yeseva One', display;
    color: var(--gebb-portal-primary);
    text-transform: uppercase;
    font-weight: 400;
    letter-spacing: 0;
    margin: 0;
    padding: 18px 18px 14px 18px;
    border-bottom: 1px solid var(--gebb-portal-border);
}

.gebb-portal-youtube-empty {
    color: var(--gebb-portal-muted);
    font-style: italic;
}

/* Grid layout */
.gebb-portal-youtube--grid {
    display: grid;
    gap: 20px;
}

.gebb-portal-youtube--cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gebb-portal-youtube--cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gebb-portal-youtube--cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* List layout */
.gebb-portal-youtube--list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gebb-portal-youtube--list .gebb-portal-youtube-item {
    display: flex;
    flex-direction: row;
    gap: 16px;
}

.gebb-portal-youtube--list .gebb-portal-youtube-thumbnail {
    flex-shrink: 0;
    width: 200px;
}

/* Cards layout */
.gebb-portal-youtube--cards {
    display: grid;
    gap: 20px;
}

.gebb-portal-youtube--cards.gebb-portal-youtube--cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gebb-portal-youtube--cards.gebb-portal-youtube--cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gebb-portal-youtube--cards.gebb-portal-youtube--cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gebb-portal-youtube--cards .gebb-portal-youtube-item {
    background: var(--gebb-portal-bg);
    border: 1px solid var(--gebb-portal-border);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    transition: none;
}

.gebb-portal-youtube--cards .gebb-portal-youtube-item:hover {
    transform: none;
    box-shadow: none;
}

/* Video item */
.gebb-portal-youtube-item {
    cursor: pointer;
}

.gebb-portal-youtube-thumbnail {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 0;
    background: transparent !important;
}

.gebb-portal-youtube--cards .gebb-portal-youtube-thumbnail {
    border-radius: 0;
}

.gebb-portal-youtube-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transform: scale(1.001);
    transition: filter 0.25s ease, transform 0.25s ease;
}

.gebb-portal-youtube-item:hover .gebb-portal-youtube-thumbnail img,
.gebb-portal-youtube-item:focus-within .gebb-portal-youtube-thumbnail img {
    filter: grayscale(0%);
    transform: scale(1.02);
}

/* Play button */
.gebb-portal-youtube-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent !important;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0.95;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.gebb-portal-youtube-play svg {
    display: block;
    filter: none;
}

.gebb-portal-youtube-item:hover .gebb-portal-youtube-play,
.gebb-portal-youtube-item:focus-within .gebb-portal-youtube-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
}

/* Content */
.gebb-portal-youtube-content {
    padding: 14px 18px;
}

.gebb-portal-youtube-item-title {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.4;
    color: var(--gebb-portal-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gebb-portal-youtube-date {
    display: block;
    font-size: 0.85em;
    color: var(--gebb-portal-muted);
    margin-bottom: 6px;
}

.gebb-portal-youtube-description {
    font-size: 0.9em;
    color: var(--gebb-portal-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Lightbox */
.gebb-portal-youtube-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gebb-portal-youtube-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.gebb-portal-youtube-lightbox-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    z-index: 1;
}

.gebb-portal-youtube-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.gebb-portal-youtube-lightbox-close:hover {
    opacity: 1;
}

.gebb-portal-youtube-lightbox-content {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 0;
    background: #000;
}

.gebb-portal-youtube-lightbox-content iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

@media (max-width: 992px) {
    .gebb-portal-youtube--cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .gebb-portal-title,
    .gebb-portal-youtube-title {
        padding: 16px 14px 12px 14px;
    }

    .gebb-portal-list li {
        padding: 14px;
    }

    .gebb-portal-news-item {
        flex-direction: column;
        gap: 12px;
    }

    .gebb-portal-news-image,
    .gebb-portal-news-img-small .gebb-portal-news-image,
    .gebb-portal-news-img-medium .gebb-portal-news-image,
    .gebb-portal-news-img-large .gebb-portal-news-image {
        width: 100%;
        height: 180px;
    }

    .gebb-portal-links-grid {
        grid-template-columns: 1fr 1fr;
    }

    .gebb-portal-dashboard-columns {
        grid-template-columns: 1fr;
    }

    .gebb-portal-youtube--cols-3,
    .gebb-portal-youtube--cols-4,
    .gebb-portal-youtube--cards.gebb-portal-youtube--cols-3,
    .gebb-portal-youtube--cards.gebb-portal-youtube--cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .gebb-portal-youtube--list .gebb-portal-youtube-item {
        flex-direction: column;
    }

    .gebb-portal-youtube--list .gebb-portal-youtube-thumbnail {
        width: 100%;
    }

    .gebb-portal-youtube-content {
        padding: 14px;
    }

    .gebb-portal-youtube-lightbox-container {
        width: 95%;
    }

    .gebb-portal-youtube-lightbox-close {
        top: -36px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .gebb-portal-links-grid {
        grid-template-columns: 1fr;
    }

    .gebb-portal-youtube--cols-2,
    .gebb-portal-youtube--cols-3,
    .gebb-portal-youtube--cols-4,
    .gebb-portal-youtube--cards.gebb-portal-youtube--cols-2,
    .gebb-portal-youtube--cards.gebb-portal-youtube--cols-3,
    .gebb-portal-youtube--cards.gebb-portal-youtube--cols-4 {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   PRINT
   ===================================================== */

@media print {
    .gebb-portal-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .gebb-portal-link-card:hover,
    .gebb-portal-youtube--cards .gebb-portal-youtube-item:hover {
        transform: none;
        box-shadow: none;
    }

    .gebb-portal-news-image img,
    .gebb-portal-youtube-thumbnail img {
        filter: grayscale(100%);
        transform: none;
    }
}
