/**
 * Article Video Player - Frontend Styles
 * Matches podcast player aesthetic for visual consistency
 *
 * @package SportPersonalities
 * @since 1.0.0
 */

/* ============================================
   VIDEO PLAYER INLINE
   ============================================ */

.sp-video-player-inline {
    /* Match podcast player container */
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border: 1px solid #dbeafe;
    border-radius: 16px;
    padding: 20px;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.sp-video-player-inline:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Header - Matches podcast header exactly */
.sp-video-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sp-video-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.sp-video-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.sp-video-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

.sp-video-duration-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6B7280;
    background: white;
    padding: 4px 12px;
    border-radius: 20px;
    flex-shrink: 0;
}

.sp-video-time-icon {
    font-size: 14px;
}

/* Video Container - 16:9 Aspect Ratio */
.sp-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.sp-video-iframe-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.sp-video-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* Custom Thumbnail Overlay (Lite YouTube Pattern) */
.sp-video-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.sp-video-thumbnail-overlay:hover {
    opacity: 0.95;
}

.sp-video-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    z-index: 20;
}

.sp-video-play-overlay:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.sp-video-play-overlay:active {
    transform: translate(-50%, -50%) scale(0.98);
}

.sp-video-play-overlay:focus {
    outline: 3px solid #b60f0a;
    outline-offset: 4px;
}

.sp-video-play-icon-large {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: filter 0.3s ease;
}

.sp-video-play-overlay:hover .sp-video-play-icon-large {
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
}

.sp-video-play-text {
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

/* Video Info/Controls */
.sp-video-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.sp-video-fullscreen-btn,
.sp-video-youtube-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
}

.sp-video-fullscreen-btn:hover,
.sp-video-youtube-link:hover {
    background: #f0f4ff;
    border-color: #b60f0a;
    color: #b60f0a;
}

.sp-video-fullscreen-btn:focus,
.sp-video-youtube-link:focus {
    outline: 2px solid #b60f0a;
    outline-offset: 2px;
}

.sp-video-fullscreen-btn svg,
.sp-video-youtube-link svg {
    flex-shrink: 0;
}

/* Footer - Matches podcast disclaimer */
.sp-video-footer {
    margin-top: 12px;
}

.sp-video-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: rgba(255, 243, 205, 0.5);
    border-left: 3px solid #f59e0b;
    padding: 10px 12px;
    border-radius: 6px;
}

.sp-info-icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: #f59e0b;
}

.sp-video-disclaimer small {
    font-size: 11px;
    color: #78716c;
    line-height: 1.5;
}

/* ============================================
   LOADING STATE
   ============================================ */

.sp-video-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border: 4px solid rgba(182, 15, 10, 0.2);
    border-top-color: #b60f0a;
    border-radius: 50%;
    animation: sp-video-spin 1s linear infinite;
    z-index: 5;
}

@keyframes sp-video-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================
   STACKING WITH PODCAST PLAYER
   ============================================ */

/* When both video and podcast exist */
.sp-video-player-inline + .sp-podcast-player-inline {
    margin-top: 20px;
}

.sp-podcast-player-inline + .sp-video-player-inline {
    margin-top: 20px;
}

/* Optional: Side-by-side on large desktop */
@media screen and (min-width: 1200px) {
    .sp-media-players-container.side-by-side {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin: 30px 0;
    }

    .sp-media-players-container.side-by-side .sp-video-player-inline,
    .sp-media-players-container.side-by-side .sp-podcast-player-inline {
        margin: 0;
    }
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Tablet (768px - 1023px) */
@media screen and (max-width: 1023px) {
    .sp-video-player-inline {
        padding: 15px;
    }

    .sp-video-title h3 {
        font-size: 15px;
    }

    .sp-video-info {
        gap: 8px;
    }

    .sp-video-fullscreen-btn,
    .sp-video-youtube-link {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Tablet and below */
@media screen and (max-width: 768px) {
    .sp-video-player-inline {
        padding: 15px;
    }

    .sp-video-info {
        flex-wrap: wrap;
        gap: 8px;
    }

    .sp-video-fullscreen-btn,
    .sp-video-youtube-link {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Mobile (480px and below) */
@media screen and (max-width: 480px) {
    .sp-video-player-inline {
        padding: 12px;
        border-radius: 12px;
        margin: 20px 0;
    }

    .sp-video-player-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sp-video-duration-badge {
        font-size: 11px;
    }

    .sp-video-title h3 {
        font-size: 14px;
    }

    .sp-video-icon {
        font-size: 18px;
    }

    .sp-video-container {
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .sp-video-iframe {
        border-radius: 8px;
    }

    .sp-video-info {
        flex-direction: column;
        gap: 6px;
    }

    .sp-video-fullscreen-btn,
    .sp-video-youtube-link {
        width: 100%;
        justify-content: center;
        font-size: 12px;
    }

    .sp-video-disclaimer {
        padding: 8px 10px;
    }

    .sp-video-disclaimer small {
        font-size: 10px;
    }

    .sp-video-play-text {
        font-size: 12px;
        padding: 6px 12px;
    }

    .sp-video-play-icon-large {
        width: 56px;
        height: 40px;
    }
}

/* Very small mobile (360px and below) */
@media screen and (max-width: 360px) {
    .sp-video-icon {
        font-size: 16px;
    }

    .sp-video-title h3 {
        font-size: 13px;
    }

    .sp-video-play-icon-large {
        width: 48px;
        height: 34px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus indicators for keyboard navigation */
.sp-video-play-overlay:focus {
    outline: 3px solid #b60f0a;
    outline-offset: 4px;
}

.sp-video-iframe:focus {
    outline: 2px solid #b60f0a;
    outline-offset: 2px;
}

.sp-video-fullscreen-btn:focus,
.sp-video-youtube-link:focus {
    outline: 2px solid #b60f0a;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sp-video-player-inline {
        border: 2px solid #000;
    }

    .sp-video-container {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .sp-video-player-inline,
    .sp-video-play-overlay,
    .sp-video-fullscreen-btn,
    .sp-video-youtube-link,
    .sp-video-thumbnail-overlay {
        transition: none;
    }

    .sp-video-container.loading::after {
        animation: none;
    }

    .sp-video-play-icon-large {
        transition: none;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .sp-video-player-inline {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
        border-color: #475569;
    }

    .sp-video-title h3 {
        color: #f1f5f9;
    }

    .sp-video-duration-badge {
        background: rgba(255, 255, 255, 0.1);
        color: #cbd5e1;
    }

    .sp-video-fullscreen-btn,
    .sp-video-youtube-link {
        background: rgba(255, 255, 255, 0.1);
        border-color: #475569;
        color: #e2e8f0;
    }

    .sp-video-fullscreen-btn:hover,
    .sp-video-youtube-link:hover {
        background: rgba(255, 255, 255, 0.15);
        color: #b60f0a;
    }

    .sp-video-disclaimer {
        background: rgba(251, 191, 36, 0.2);
        border-left-color: #fbbf24;
    }

    .sp-video-disclaimer small {
        color: #d1d5db;
    }
}

/* Print styles */
@media print {
    .sp-video-player-inline {
        page-break-inside: avoid;
    }

    .sp-video-container {
        display: none;
    }

    .sp-video-info {
        display: none;
    }

    .sp-video-disclaimer small::after {
        content: " (Video: https://www.youtube.com/watch?v=" attr(data-video-id) ")";
    }
}
