:root {
    --primary: #FF0000;
    --bg: #F9F9F9;
    --header-bg: #FFFFFF;
    --text: #0F0F0F;
    --card-bg: #FFFFFF;
    --border: #E5E5E5;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', 'Roboto', 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Accessibility: Larger Text & Targets */
a,
button,
input {
    touch-action: manipulation;
}

header {
    background-color: var(--header-bg);
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px var(--shadow);
    height: 60px;
    box-sizing: border-box;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-item {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 1rem;
    padding: 10px 20px;
    border-radius: 50px;
    background: #f0f0f0;
    transition: background 0.2s;
    white-space: nowrap;
}

.nav-item:hover {
    background: #e0e0e0;
}

.nav-item.primary {
    background: var(--primary);
    color: white;
}

.nav-item.primary:hover {
    background: #d40000;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px;
    padding-bottom: 80px;
    /* Space for bottom nav on mobile */
}

/* Main Layout Padding for Tab Bar */
.main-content-padding {
    padding-top: 20px;
}

/* --- Watch Page Layout --- */
.watch-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 20px 40px 20px;
}

.video-player-section {
    width: 100%;
    min-width: 0;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-details {
    margin-top: 16px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.related-videos {
    width: 100%;
    min-width: 0;
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-video-card {
    display: flex;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    padding: 8px;
    border-radius: 8px;
}

.sidebar-video-card:hover {
    background: #f1f1f1;
}

.sidebar-thumbnail {
    width: 168px;
    min-width: 168px;
    height: 94px;
    border-radius: 8px;
    overflow: hidden;
    background: #eee;
}

.sidebar-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-info {
    flex: 1;
    min-width: 0;
}

.sidebar-info .video-title {
    font-size: 0.95rem;
    line-height: 1.3;
    margin-bottom: 4px;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Modern Tabs --- */
.tabs-container {
    display: flex;
    justify-content: center;
    margin: 0 auto 30px auto;
    background: #f0f0f0;
    width: fit-content;
    padding: 5px;
    border-radius: 50px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 30px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: white;
    color: black;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* --- Video Grid --- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.video-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.thumbnail-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #e0e0e0;
}

.thumbnail-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-info {
    padding: 16px;
}

.video-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.channel-name {
    font-size: 0.9rem;
    color: #666;
}

/* Shorts Styling */
.video-card.short {
    max-width: 100%;
}

.video-card.short .thumbnail-container {
    padding-top: 177.7%;
    /* 9:16 */
}

/* --- Auth Pages --- */
.center-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90vh;
    background: #f4f7f6;
    padding: 20px;
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    margin-top: 0;
    text-align: center;
    color: var(--primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
}

.btn {
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    width: 100%;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
}

.alert {
    padding: 15px;
    background: #ffebee;
    color: #c62828;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* --- Collapsible Drawer Menu --- */
.nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    /* Keep at 0, use transform to hide */
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transform: translateX(-100%);
    /* Hidden by default */
    transition: transform 0.3s ease;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.nav-drawer.open {
    transform: translateX(0);
    /* Slide in */
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.drawer-header h3 {
    margin: 0;
}

.drawer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-item {
    text-decoration: none;
    color: #333;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
    font-size: 1.1rem;
}

.drawer-item:hover,
.drawer-item.active {
    background: #f0f0f0;
    color: var(--primary);
}

.icon-btn {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.share-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-mobile button {
    font-size: 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
}

/* Header Auto-Hide */
header {
    transition: transform 0.3s ease;
}

header.hide-head {
    transform: translateY(-100%);
}

/* Shorts Feed ModeContainer */
.video-grid.shorts-feed {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    /* Fill screen minus nav */
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    gap: 0;
    padding-bottom: 80px;
}

.video-grid.shorts-feed::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar for immersion */
}

/* Shorts Feed Card */
.short-snap-card {
    height: 100%;
    /* Full container height */
    min-height: 80vh;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    scroll-snap-align: start;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.short-snap-card iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.short-overlay h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Right Side Actions (Instagram/TikTok style) */
.short-actions {
    position: absolute;
    right: 15px;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 20;
}

.action-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}

.action-btn:active {
    transform: scale(0.9);
}

/* Share Buttons */
.share-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    /* Push to left near logo? Or keep near nav? */
    margin-left: 20px;
}

.share-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.share-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 0;
}

.share-icon:hover {
    transform: scale(1.2);
}

.share-icon.wa {
    color: #25D366;
}

.share-icon.fb {
    color: #1877F2;
    font-weight: bold;
    font-family: serif;
}

/* iOS Install Prompt */
.ios-prompt {
    position: fixed;
    bottom: 80px;
    /* Above nav */
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 3000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease;
}

.ios-prompt p {
    margin: 0;
    font-size: 0.95rem;
}

.ios-prompt button {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    padding: 0 0 0 15px;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Landing Page */
.landing-hero {
    text-align: center;
    padding: 100px 20px;
    background: white;
    margin-bottom: 20px;
}

.landing-hero h1 {
    font-size: 3.5rem;
    color: #111;
    margin-bottom: 20px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
}

.landing-hero p {
    font-size: 1.25rem;
    color: #666;
    max-width: 580px;
    margin: 0 auto 40px auto;
    line-height: 1.6;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto 80px auto;
    padding: 0 30px;
}

.feature-card {
    background: #fcfcfc;
    padding: 40px;
    border-radius: 24px;
    text-align: left;
    border: 1px solid #f0f0f0;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: #e0e0e0;
}

.feature-icon-box {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    color: white;
}

.feature-icon-box svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin: 0 0 12px 0;
    color: #111;
    font-weight: 700;
}

.feature-card p {
    color: #555;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.6;
}

.cta-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.cta-buttons .btn {
    min-width: 160px;
    padding: 16px 30px;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .landing-hero h1 {
        font-size: 2.5rem;
    }

    .cta-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }

    .feature-card {
        text-align: center;
    }

    .feature-icon-box {
        margin: 0 auto 20px auto;
    }
}

/* --- Media Queries --- */
@media (max-width: 1024px) {
    .watch-container {
        grid-template-columns: 1fr;
    }

    .related-videos {
        display: block;
    }
}

@media (max-width: 900px) {

    /* Increased Breakpoint */
    .desktop-only {
        display: none !important;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    header {
        justify-content: space-between;
        /* Keep share icons visible? */
        padding: 0.5rem 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    /* Hide Share Label on mobile to save space */
    .share-label {
        display: none;
    }

    .container {
        padding: 15px;
        padding-bottom: 90px;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}