/**
 * Styles pour les composants OnisepTV
 * Cartes vidéo, grilles, badges
 */

/* ===========================================
   GRILLE DE VIDÉOS
   =========================================== */

.oniseptv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

@media (max-width: 640px) {
    .oniseptv-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ===========================================
   CARTE VIDÉO
   =========================================== */

.oniseptv-card {
    background: var(--card-bg, #ffffff);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color, #e5e7eb);
}

.oniseptv-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* Thumbnail */
.oniseptv-card-thumbnail {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    background: #1f2937;
    cursor: pointer;
    overflow: hidden;
}

.oniseptv-card-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* Bouton play */
.oniseptv-card-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.oniseptv-card-play svg {
    margin-left: 4px; /* Centre optique du triangle */
}

.oniseptv-card:hover .oniseptv-card-play {
    background: var(--primary-color, #3b82f6);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Durée */
.oniseptv-card-duration {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, monospace;
}

/* Contenu */
.oniseptv-card-content {
    padding: 1.25rem;
}

/* Badges */
.oniseptv-card-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge-metier {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.badge-formation {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.badge-parcours {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.badge-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* Titre */
.oniseptv-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Description */
.oniseptv-card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* État vide */
.oniseptv-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary, #6b7280);
    font-size: 0.95rem;
}

/* ===========================================
   SECTION ONISEPTV
   =========================================== */

.oniseptv-section {
    margin: 2rem 0;
}

.oniseptv-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.oniseptv-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.oniseptv-section-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
    margin: 0.25rem 0 0 0;
}

/* Bouton "Voir plus" */
.oniseptv-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text-primary, #1f2937);
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.oniseptv-more-btn:hover {
    background: var(--primary-color, #3b82f6);
    color: white;
}

/* ===========================================
   FILTRES
   =========================================== */

.oniseptv-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.oniseptv-filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color, #e5e7eb);
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
}

.oniseptv-filter-btn:hover {
    border-color: var(--primary-color, #3b82f6);
    color: var(--primary-color, #3b82f6);
}

.oniseptv-filter-btn.active {
    background: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
    color: white;
}

/* ===========================================
   LOADER
   =========================================== */

.oniseptv-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.oniseptv-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color, #e5e7eb);
    border-top-color: var(--primary-color, #3b82f6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.oniseptv-loader-text {
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
}

/* ===========================================
   DARK MODE
   =========================================== */

@media (prefers-color-scheme: dark) {
    .oniseptv-card {
        background: #1f2937;
        border-color: #374151;
    }

    .oniseptv-card-title {
        color: #f9fafb;
    }

    .oniseptv-card-desc {
        color: #9ca3af;
    }

    .oniseptv-section-title {
        color: #f9fafb;
    }

    .oniseptv-filter-btn {
        background: #1f2937;
        border-color: #374151;
        color: #9ca3af;
    }

    .oniseptv-filter-btn:hover {
        border-color: #60a5fa;
        color: #60a5fa;
    }

    .oniseptv-filter-btn.active {
        background: #3b82f6;
        border-color: #3b82f6;
        color: white;
    }
}

/* Support du mode sombre via classe */
.dark .oniseptv-card,
[data-theme="dark"] .oniseptv-card {
    background: #1f2937;
    border-color: #374151;
}

.dark .oniseptv-card-title,
[data-theme="dark"] .oniseptv-card-title {
    color: #f9fafb;
}

.dark .oniseptv-card-desc,
[data-theme="dark"] .oniseptv-card-desc {
    color: #9ca3af;
}

/* ===========================================
   MODAL PLAYER VIDÉO
   =========================================== */

.oniseptv-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.oniseptv-modal.active {
    opacity: 1;
    visibility: visible;
}

.oniseptv-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.oniseptv-modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: #1f2937;
    border-radius: 16px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.oniseptv-modal.active .oniseptv-modal-content {
    transform: scale(1);
}

.oniseptv-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.oniseptv-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.oniseptv-modal-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    background: #000;
}

.oniseptv-modal-video iframe,
.oniseptv-modal-video video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.oniseptv-modal-info {
    padding: 1.5rem;
    background: #1f2937;
    color: white;
}

.oniseptv-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    color: #f9fafb;
}

.oniseptv-modal-desc {
    font-size: 0.9rem;
    color: #9ca3af;
    margin: 0 0 1rem 0;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.oniseptv-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.oniseptv-modal-link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.oniseptv-modal-link::after {
    content: '↗';
    font-size: 0.75rem;
}

/* Fallback player (quand pas d'embed disponible) */
.oniseptv-fallback-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.oniseptv-fallback-player img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.6);
}

.oniseptv-fallback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.oniseptv-play-external {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.oniseptv-play-external:hover {
    transform: scale(1.1);
}

.oniseptv-play-external svg {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.oniseptv-play-external span {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* ===========================================
   RESPONSIVENESS
   =========================================== */

@media (max-width: 480px) {
    .oniseptv-card-content {
        padding: 1rem;
    }

    .oniseptv-card-title {
        font-size: 0.95rem;
    }

    .oniseptv-card-play {
        width: 48px;
        height: 48px;
    }

    .oniseptv-card-play svg {
        width: 36px;
        height: 36px;
    }

    .oniseptv-section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
