/* ================================================================ */
/* GLOBAL STYLES & RESET                                           */
/* ================================================================ */

:root {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-fast: all 0.15s ease-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    width: 100%;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    transition: var(--transition-fast);
}

button:hover {
    opacity: 0.7;
}

button:active {
    opacity: 0.5;
}

svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ================================================================ */
/* NAVBAR STYLES                                                    */
/* ================================================================ */

.navbar {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    background-color: rgba(0, 0, 0, 0.8);
}

.navbar-top {
    top: 0;
    height: 5.25rem;
    background: transparent;
    border-bottom-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.navbar-bottom {
    bottom: 0;
    height: 3.5rem;
    border-bottom: none;
}

.navbar-bottom .navbar-content {
    justify-content: center;
    gap: 0.8rem;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    height: 100%;
    padding: 0 clamp(0.75rem, 1.6vw, 1.4rem);
    max-width: 100%;
    margin: 0 auto;
}

/* Logo */
.logo {
    width: 10rem;
    height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: var(--text-primary);
    flex-shrink: 0;
}

.logo svg {
    stroke: currentColor;
}

.logo img {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
    object-fit: contain;
}

@media (max-width: 480px) {
    .logo {
        width: 7.5rem;
        height: 3.6rem;
    }

    .logo img {
        width: 100%;
    }
}

/* Navigation Center */
.nav-center {
    display: flex;
    gap: var(--spacing-md);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    justify-content: center;
}

.nav-tab {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
}

.nav-tab.active {
    color: var(--text-primary);
    background: transparent;
}

.nav-tab.active::after {
    display: none;
}

.nav-tab svg {
    width: 0.8rem;
    height: 0.8rem;
    flex-shrink: 0;
}

/* Navigation Right */
.nav-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.live-badge:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.live-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Navigation Icons (Bottom) */
.nav-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    position: relative;
    transition: var(--transition-fast);
    text-decoration: none;
    flex-shrink: 0;
}

.nav-telegram {
    width: 1.7rem;
    height: 1.7rem;
    color: #5865f2;
    margin-left: -0.35rem;
}

.nav-telegram svg {
    overflow: visible;
}

.nav-telegram .telegram-bg {
    fill: rgba(88, 101, 242, 0.12);
    stroke: rgba(88, 101, 242, 0.25);
}

.nav-telegram .telegram-plane {
    fill: #5865f2;
}

.nav-discord {
    width: 1.7rem;
    height: 1.7rem;
    color: #5865f2;
    margin-right: -0.35rem;
}

.nav-discord svg {
    overflow: visible;
}

.nav-discord .discord-bg {
    fill: rgba(88, 101, 242, 0.12);
    stroke: rgba(88, 101, 242, 0.25);
}

.nav-discord .discord-mark {
    fill: #5865f2;
}

.nav-icon.active {
    color: var(--text-primary);
}

.nav-icon:hover {
    color: var(--text-primary);
}

.nav-icon.active svg {
    stroke-width: 2.5;
}

/* ================================================================ */
/* FEED LAYOUT                                                      */
/* ================================================================ */

.feed-wrapper {
    display: flex;
    width: 100%;
    height: calc(100svh - 7rem);
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    position: relative;
}

.feed-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.feed-container::-webkit-scrollbar {
    display: none;
}

.feed-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 7rem);
    max-width: 100%;
    scroll-snap-type: inherit;
}

/* ================================================================ */
/* FEED CARD / VIDEO ITEM                                          */
/* ================================================================ */

.feed-card {
    width: 100%;
    height: 100%;
    min-height: calc(100svh - 7rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    position: relative;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    flex-shrink: 0;
    background: #000;
    padding: 0.85rem 0 0.5rem;
    content-visibility: auto;
    contain-intrinsic-size: 100svh 100vw;
}

.feed-card:first-child {
    border-top: none;
}

/* Video Container */
.video-stage {
    position: relative;
    width: min(515px, calc(100vw - 1.5rem));
    aspect-ratio: 515 / 1035;
    height: auto;
    max-width: 515px;
    background-color: #000;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    margin: 0 auto;
}

/* Responsive: Mobile devices (width is narrower, so max-width applies) */
@media (max-width: 480px) {
    .video-stage {
        width: min(100vw - 1rem, 515px);
        max-width: calc(100vw - 1rem);
        aspect-ratio: 515 / 1035;
    }
}

/* Responsive: Desktop (video container centered with margins) */
@media (min-width: 481px) {
    .video-stage {
        max-width: 515px;
    }
}

/* Video Element */
.video-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: var(--bg-secondary);
    display: block;
}

/* Placeholder / No Video State */
.video-stage.placeholder {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    text-align: center;
    padding: var(--spacing-lg);
    width: 100%;
    height: 100%;
}

.placeholder-icon {
    width: 3rem;
    height: 3rem;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
}

.placeholder-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    stroke: currentColor;
}

.placeholder-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.placeholder-cta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ================================================================ */
/* OVERLAY UI (Profile, Actions, etc)                             */
/* ================================================================ */

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem 1rem 1rem;
    pointer-events: none;
    background: linear-gradient(to top, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.08) 28%, transparent 52%);
    z-index: 10;
}

/* Footer Overlay */
.overlay-footer {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    max-width: 18rem;
    margin: 0 auto;
    text-align: center;
}

/* Title */
.card-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.15;
    text-shadow: none;
    letter-spacing: 0.01em;
}

/* Bottom Row */
.profile-row {
    display: none;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
    align-items: center;
}

.username {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
}

.profile-live-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 0.18rem 0.46rem;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
}

.user-status {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Video Description */
.video-description {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
}

/* ================================================================ */
/* LIVE INDICATOR / BADGE                                           */
/* ================================================================ */

.live-indicator {
    position: absolute;
    bottom: var(--spacing-lg);
    left: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 0.5rem 0.8rem;
    pointer-events: auto;
}

.live-indicator .live-badge {
    background-color: transparent;
    border: none;
    padding: 0;
    color: var(--text-primary);
}

.live-indicator .live-dot {
    background-color: #ff0000;
    animation: pulse-red 1.5s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
 
/* ================================================================ */
/* CARD ACTIONS                                                    */
/* ================================================================ */

.card-action-stack {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    z-index: 20;
    pointer-events: auto;
    display: none;
}

.card-nav-button {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    background: rgba(18, 18, 18, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.card-nav-button svg {
    width: 1.05rem;
    height: 1.05rem;
}

.card-mute-button {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: rgba(18, 18, 18, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: auto;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
    display: flex;
}

.card-live-button {
    position: absolute;
    right: 1rem;
    bottom: 4rem;
    height: 1.95rem;
    min-width: 4.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0.18rem 0.7rem 0.18rem 0.22rem;
    border-radius: 999px;
    background: rgba(18, 18, 18, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 20;
    pointer-events: auto;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.card-live-button .live-ring {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 0, 0, 0.95);
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.18);
}

.card-live-button .live-ring img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-live-button .live-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #ff4d4d;
    line-height: 1;
}

.card-mute-button svg {
    width: 1rem;
    height: 1rem;
}

.card-mute-button .icon-unmuted,
.card-mute-button.muted .icon-muted {
    display: block;
}

.card-mute-button .icon-muted,
.card-mute-button.muted .icon-unmuted {
    display: none;
}

/* ================================================================ */
/* RESPONSIVE DESIGN                                               */
/* ================================================================ */

/* Large Desktop */
@media (min-width: 1024px) {
    .feed-wrapper {
        height: calc(100svh - 3.5rem);
    }

    .feed-container {
        padding: 0 clamp(7vw, 12vw, 18vw);
    }

    .feed-card {
        min-height: calc(100svh - 3.5rem);
    }

    .video-stage {
        width: 515px;
        height: calc(100svh - 3.5rem);
        max-height: calc(100svh - 3.5rem);
    }
}

/* Tablet */
@media (max-width: 768px) and (min-width: 481px) {
    .navbar-content {
        padding: 0 var(--spacing-md);
    }

    .video-stage {
        width: 515px;
        max-width: 515px;
        border-radius: 24px;
        height: 1035px;
        max-height: 1035px;
    }

    .watch-page {
        width: min(100vw - 1.25rem, 960px);
    }

    .watch-hero {
        grid-template-columns: 1fr;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .navbar-top,
    .navbar-bottom {
        height: 4rem;
    }

    .feed-wrapper {
        height: 100svh;
        padding-bottom: 4rem;
        padding-top: 0;
    }

    .feed-container {
        align-items: stretch;
    }

    .video-watch-page .feed-container {
        padding: 0.75rem 0 1.25rem;
    }

    .watch-page {
        width: calc(100vw - 1rem);
        gap: 1rem;
    }

    .watch-hero {
        grid-template-columns: 1fr;
    }

    .watch-player-shell {
        border-radius: 18px;
    }

    .watch-title {
        font-size: 1.4rem;
    }

    .watch-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .feed-card {
        min-height: calc(100svh - 4rem);
        justify-content: flex-start;
        padding: 0;
    }

    .navbar-content {
        padding: 0 var(--spacing-md);
    }

    .nav-center {
        gap: var(--spacing-sm);
    }

    .nav-tab {
        font-size: 0.8rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .logo {
        width: 7.5rem;
        height: 3rem;
    }

    .logo img {
        width: 100%;
        height: auto;
    }

    .video-stage {
        width: 100vw;
        height: calc(100svh - 4rem);
        max-width: 100vw;
        max-height: calc(100svh - 4rem);
        border-radius: 0;
        box-shadow: none;
    }

    .video-overlay {
        padding: var(--spacing-md);
    }

    .profile-avatar {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }

    .username {
        font-size: 0.8rem;
    }

    .user-status {
        font-size: 0.65rem;
    }

    .video-description {
        font-size: 0.8rem;
    }

    .overlay-footer {
        gap: 0.5rem;
    }

    .card-action-stack {
        left: 0.75rem;
    }

    .card-mute-button {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .card-live-button {
        right: 0.75rem;
        bottom: 3.45rem;
        min-width: 4.6rem;
        height: 1.85rem;
    }
}

/* Landscape Mode */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar-top,
    .navbar-bottom {
        height: 2.5rem;
    }

    .feed-wrapper {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .feed-card {
        height: auto;
        min-height: calc(100vh - 5rem);
    }

    .video-stage {
        max-height: 1035px;
        height: 1035px;
    }
}

/* Dark Mode (already applied globally) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #1a1a1a;
        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
