/**
 * AP News Style Short Stories Video Section
 * Horizontal video carousel with hover auto-play
 * Mimics AP News design exactly
 * 
 * @package Israel_News_Theme
 */

/* ========================================
   SECTION CONTAINER
   ======================================== */
.ap-short-stories {
    background: #000;
    padding: 48px 0;
    margin: 40px 0;
}

.ap-stories-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   HEADER WITH RED ACCENT LINE & NAV BUTTONS
   ======================================== */
.ap-stories-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
}

.ap-stories-title-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.ap-stories-accent-line {
    width: 75px;
    height: 4px;
    background: #ED1C24;
    border-radius: 2px;
}

.ap-stories-title,
.israel-video-section-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
    font-size: 32px !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin: 0 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    line-height: 1.2 !important;
    padding: 0 !important;
    background: transparent !important;
    display: block !important;
    position: relative !important;
    z-index: 10 !important;
}

/* Navigation wrapper inline with title */
.ap-stories-nav-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
    margin-left: 20px;
}

/* ========================================
   CAROUSEL WRAPPER
   ======================================== */
.ap-stories-carousel-wrapper {
    position: relative;
    width: 100%;
}

.ap-stories-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    width: 100%;
}

.ap-stories-scroll-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.ap-stories-grid {
    display: flex;
    gap: 16px;
    padding: 4px 0;
}

/* ========================================
   NAVIGATION BUTTONS (EXACT AP NEWS STYLE)
   ======================================== */
.ap-story-nav {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ED1C24;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ap-story-nav:hover:not(:disabled) {
    background: #D01820;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.ap-story-nav:active:not(:disabled) {
    transform: scale(0.98);
    background: #B81018;
}

.ap-story-nav:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
    pointer-events: none;
}

.ap-story-nav svg {
    width: 20px;
    height: 20px;
}

.ap-story-prev svg {
    margin-right: 1px;
}

.ap-story-next svg {
    margin-left: 1px;
}

/* ========================================
   STORY CARD
   ======================================== */
.ap-story-card {
    width: 300px;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ap-story-card:hover {
    transform: translateY(-4px);
}

.ap-story-card:hover .ap-story-video-wrapper {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.ap-story-card:first-child .ap-story-video-wrapper {
    border: 3px solid #ED1C24;
}

.ap-story-video-wrapper {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* ========================================
   VIDEO ELEMENT
   ======================================== */
.ap-story-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hide controls on carousel videos */
.ap-story-video::-webkit-media-controls {
    display: none !important;
}

.ap-story-video::-webkit-media-controls-enclosure {
    display: none !important;
}

/* ========================================
   PLAY BUTTON OVERLAY
   ======================================== */
.ap-story-play-overlay {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.ap-story-card.playing .ap-story-play-overlay {
    opacity: 0;
}

.ap-story-play-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ED1C24;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.ap-story-card:hover .ap-story-play-button {
    transform: scale(1.1);
}

.ap-story-play-button svg {
    width: 16px;
    height: 20px;
    margin-left: 3px;
}

.ap-story-duration {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

/* ========================================
   TITLE OVERLAY
   ======================================== */
.ap-story-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 72px 16px 16px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        transparent 100%
    );
    z-index: 1;
}

.ap-story-title-overlay h3 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   LOCATION/DATE BADGE
   ======================================== */
.ap-story-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* ========================================
   RESPONSIVE - TABLET
   ======================================== */
@media (max-width: 1024px) {
    .ap-stories-title,
    .israel-video-section-title {
        font-size: 28px !important;
    }
    
    .ap-story-card {
        width: 280px;
    }
    
    .ap-story-video-wrapper {
        height: 375px;
    }
    
    .ap-story-nav {
        width: 44px;
        height: 44px;
    }
    
    .ap-story-nav svg {
        width: 18px;
        height: 18px;
    }
    
    .ap-modal-nav svg {
        width: 22px;
        height: 22px;
    }
    
    .ap-stories-nav-wrapper {
        gap: 10px;
        margin-left: 16px;
    }
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */
@media (max-width: 768px) {
    .ap-short-stories {
        padding: 32px 0;
        margin: 24px 0;
    }
    
    .ap-stories-container {
        padding: 0 16px;
    }
    
    .ap-stories-header {
        margin-bottom: 24px;
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .ap-stories-accent-line {
        width: 60px;
        height: 3px;
    }
    
    .ap-stories-title,
    .israel-video-section-title {
        font-size: 24px !important;
    }
    
    .ap-stories-nav-wrapper {
        gap: 8px;
        margin-left: auto;
        margin-right: 0;
    }
    
    .ap-story-card {
        width: 260px;
    }
    
    .ap-story-video-wrapper {
        height: 350px;
    }
    
    .ap-story-nav {
        width: 40px;
        height: 40px;
    }
    
    .ap-story-nav svg {
        width: 16px;
        height: 16px;
    }
    
    .ap-story-title-overlay h3 {
        font-size: 15px;
    }
    
    .ap-story-play-button {
        width: 40px;
        height: 40px;
    }
    
    .ap-story-play-button svg {
        width: 14px;
        height: 18px;
    }
}

/* ========================================
   RESPONSIVE - SMALL MOBILE
   ======================================== */
@media (max-width: 480px) {
    .ap-short-stories {
        padding: 24px 0;
    }
    
    .ap-stories-container {
        padding: 0 12px;
    }
    
    .ap-stories-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .ap-stories-title,
    .israel-video-section-title {
        font-size: 20px !important;
    }
    
    .ap-stories-nav-wrapper {
        margin-left: 0;
        align-self: flex-end;
    }
    
    .ap-story-card {
        width: 240px;
    }
    
    .ap-story-video-wrapper {
        height: 320px;
    }
    
    .ap-story-nav {
        width: 36px;
        height: 36px;
    }
    
    .ap-story-nav svg {
        width: 14px;
        height: 14px;
    }
    
    .ap-stories-grid {
        gap: 12px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.ap-story-card:focus-within {
    outline: 2px solid #ED1C24;
    outline-offset: 4px;
    border-radius: 8px;
}

.ap-story-nav:focus {
    outline: 2px solid #ED1C24;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .ap-story-card,
    .ap-story-nav,
    .ap-story-play-button,
    .ap-story-play-overlay,
    .ap-stories-scroll-container {
        transition: none;
    }
}

/* ========================================
   LOADING STATE
   ======================================== */
.ap-story-card.loading {
    opacity: 0.6;
}

.ap-story-card.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(237, 28, 36, 0.3);
    border-top-color: #ED1C24;
    border-radius: 50%;
    animation: ap-spin 0.8s linear infinite;
    z-index: 100;
}

@keyframes ap-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ========================================
   VIDEO MODAL (DESKTOP PLAYER)
   ======================================== */
.ap-video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.ap-video-modal.active {
    display: flex;
}

.ap-video-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
}

.ap-video-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ap-video-modal-player {
    width: 100%;
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.ap-modal-video-element {
    width: 100%;
    height: auto;
    max-height: 85vh;
    display: block;
}

/* Close Button */
.ap-video-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.ap-video-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* Modal Navigation Buttons */
.ap-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #ED1C24;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.ap-modal-nav:hover:not(:disabled) {
    background: #D01820;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.ap-modal-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.ap-modal-prev {
    left: -80px;
}

.ap-modal-next {
    right: -80px;
}

.ap-modal-nav svg {
    width: 24px;
    height: 24px;
}

/* Modal Responsive */
@media (max-width: 1400px) {
    .ap-modal-prev {
        left: 20px;
    }
    
    .ap-modal-next {
        right: 20px;
    }
}

@media (max-width: 768px) {
    .ap-video-modal-content {
        width: 95%;
        max-height: 80vh;
    }
    
    .ap-video-modal-close {
        top: -45px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .ap-modal-nav {
        width: 44px;
        height: 44px;
    }
    
    .ap-modal-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .ap-modal-prev {
        left: 10px;
    }
    
    .ap-modal-next {
        right: 10px;
    }
}

/* Hide modal on mobile (use fullscreen instead) */
@media (max-width: 767px) {
    .ap-video-modal {
        display: none !important;
    }
}

/* ========================================
   MOBILE FULLSCREEN CONTROLS OVERLAY
   ======================================== */
.ap-mobile-fullscreen-controls {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    pointer-events: none;
}

.ap-mobile-fullscreen-controls.active {
    display: block;
}

/* Mobile Close Button (Top Right) */
.ap-mobile-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: all 0.2s ease;
    z-index: 100;
}

.ap-mobile-close:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.85);
}

.ap-mobile-close svg {
    width: 32px;
    height: 32px;
}

/* Mobile Navigation Buttons (Left & Right) */
.ap-mobile-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #ED1C24;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: all 0.15s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.ap-mobile-nav:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
    background: #D01820;
}

.ap-mobile-nav:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.ap-mobile-prev {
    left: 20px;
}

.ap-mobile-next {
    right: 20px;
}

.ap-mobile-nav svg {
    width: 32px;
    height: 32px;
}

/* Smaller buttons on very small screens */
@media (max-width: 400px) {
    .ap-mobile-close {
        width: 48px;
        height: 48px;
        top: 15px;
        right: 15px;
    }
    
    .ap-mobile-close svg {
        width: 28px;
        height: 28px;
    }
    
    .ap-mobile-nav {
        width: 56px;
        height: 56px;
    }
    
    .ap-mobile-nav svg {
        width: 28px;
        height: 28px;
    }
    
    .ap-mobile-prev {
        left: 15px;
    }
    
    .ap-mobile-next {
        right: 15px;
    }
}

/* Hide mobile controls on desktop */
@media (min-width: 768px) {
    .ap-mobile-fullscreen-controls {
        display: none !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .ap-short-stories {
        display: none;
    }
    
    .ap-video-modal {
        display: none;
    }
    
    .ap-mobile-fullscreen-controls {
        display: none;
    }
}

