/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a1a1a;
    --secondary-color: #2d2d2d;
    --accent-color: #0066cc;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding: 0;
    margin: 0;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

/* Tab Navigation */
.tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background-color: #f8f8f8;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    /* Hide scrollbar for WebKit browsers (Chrome, Safari, Edge) */
    font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.tabs::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for Firefox - supported in Firefox 64+ */
@supports (scrollbar-width: none) {
    .tabs {
        scrollbar-width: none;
    }
}

.tab-button {
    padding: 0.75rem 1.5rem;
    min-height: 44px;
    min-width: 100px;
    background-color: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    transition: var(--transition);
    white-space: nowrap;
    touch-action: manipulation;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
    flex-shrink: 0;
}

.tab-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.tab-button.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.tab-button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-in;
}

.tab-content.active {
    display: block;
}

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

/* Videos Grid */
.videos-container {
    width: 100%;
}

.videos-container-inner {
    width: 100%;
    display: block;
}

.season-heading {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    text-align: center;
    box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.15);
}

.season-heading:first-child {
    margin-top: 0;
}

.videos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

/* Responsive Grid Layout */
@media (min-width: 768px) {
    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .videos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Video Card */
.video-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.video-card:active {
    transform: translateY(-2px);
}

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

/* Video Thumbnail */
.video-thumbnail-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background-color: #000;
}

.video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    transition: var(--transition);
    pointer-events: none;
}

.video-card:hover .video-play-icon {
    background-color: rgba(0, 102, 204, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Video Embed Container */
.video-embed-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Default 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
}

.video-embed-container.aspect-4-3 {
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

.video-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-title {
    padding: 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.5;
    transition: var(--transition);
    position: relative;
}

/* Removed play icon from title since we have it on thumbnail */

.video-card:hover .video-title {
    color: var(--accent-color);
}

.video-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-light);
}

.video-error {
    padding: 2rem;
    text-align: center;
    color: #d32f2f;
    background-color: #ffebee;
    border-radius: 8px;
}

/* Content Sections (Wikipedia-style) */
.content-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 0;
}

.content-item {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.content-item h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.content-item h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.content-item p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--text-color);
}

.content-item ul,
.content-item ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.8;
}

.content-item li {
    margin-bottom: 0.5rem;
}

.content-item .meta {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 0.5rem;
}

.content-item .source {
    display: inline-block;
    background-color: #f0f0f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Video Overlay (Expanded View) */
.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.video-overlay.active {
    opacity: 1;
}

.video-overlay.closing {
    opacity: 0;
}

.video-expanded-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background-color: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-overlay.active .video-expanded-container {
    transform: scale(1);
}

.video-overlay.closing .video-expanded-container {
    transform: scale(0.8);
}

.video-close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: opacity 0.3s ease, visibility 0.3s ease, var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.video-close-button.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.video-close-button:hover {
    background-color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.video-close-button:active {
    transform: scale(0.95);
}

.video-expanded-title {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 4rem;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    z-index: 10001;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    padding-right: 3rem;
}

.video-expanded-container .expanded-embed {
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.video-expanded-container .expanded-embed.aspect-4-3 {
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

/* Video Navigation Arrows */
.video-nav-container {
    display: flex; /* Show on all devices */
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10001;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-nav-container.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.video-nav-button {
    width: 44px;
    height: 44px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 0;
    touch-action: manipulation; /* Better touch handling on mobile */
}

.video-nav-button:hover:not(:disabled) {
    background-color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.video-nav-button:active:not(:disabled) {
    transform: scale(0.95);
}

.video-nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Mobile sizing */
@media (max-width: 767px) {
    .video-nav-container {
        right: 0.75rem;
        gap: 0.5rem;
    }
    
    .video-nav-button {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

/* Tablet sizing */
@media (min-width: 768px) and (max-width: 1023px) {
    .video-nav-container {
        right: 1rem;
    }
    
    .video-nav-button {
        width: 44px;
        height: 44px;
        font-size: 1.75rem;
    }
}

/* Desktop sizing */
@media (min-width: 1024px) {
    .video-nav-container {
        right: 1rem;
    }
    
    .video-nav-button {
        width: 48px;
        height: 48px;
        font-size: 2rem;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .video-overlay {
        transition: opacity 0.1s;
    }
    
    .video-expanded-container {
        transition: transform 0.1s;
    }
}

/* Mobile Optimisations */
@media (max-width: 767px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .tabs {
        justify-content: flex-start;
        padding: 0.75rem;
        gap: 0.375rem;
    }

    .tab-button {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
        min-width: auto;
        flex-shrink: 0;
    }

    main {
        padding: 1rem 0.75rem;
    }

    .videos-grid {
        gap: 1rem;
    }

    .content-item {
        padding: 1rem;
    }

    .content-item h2 {
        font-size: 1.3rem;
    }

    .video-title {
        font-size: 1rem;
        padding: 1.25rem;
    }
    
    .video-play-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .video-expanded-container {
        width: 95%;
        max-height: 85vh;
    }
    
    .video-expanded-title {
        font-size: 1rem;
        top: 0.75rem;
        left: 0.75rem;
        right: 3.5rem;
    }
    
    .video-close-button {
        top: 0.75rem;
        right: 0.75rem;
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    font-family: SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1rem;
    transition: var(--transition);
}

footer a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Tablet Optimisations */
@media (min-width: 768px) and (max-width: 1023px) {
    header {
        padding: 1.5rem 1rem;
    }

    main {
        padding: 1.5rem;
    }
}
