/* ==========================================================
   TikNia - TikTok-Style Social Video Platform Design System
   ========================================================== */

:root {
    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* TikNia Brand Accents */
    --brand-pink: #FE2C55;
    --brand-pink-hover: #E02449;
    --brand-cyan: #25F4EE;
    --brand-gradient: linear-gradient(135deg, #FE2C55 0%, #FF0050 50%, #25F4EE 100%);

    /* Light Theme (Default) */
    --bg-page: #f8f9fc;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-rail: rgba(0, 0, 0, 0.45);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: #FE2C55;
    --text-primary: #121216;
    --text-secondary: #65676b;
    --text-muted: #8c8d94;
    --text-inverse: #ffffff;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
    
    --bottom-nav-height: 58px;
    --desktop-sidebar-width: 250px;
    --feed-max-width: 480px;
}

/* OLED Dark Theme */
[data-theme="dark"] {
    --bg-page: #0a0a0d;
    --bg-surface: #121217;
    --bg-elevated: #1a1a22;
    --bg-rail: rgba(0, 0, 0, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #FE2C55;
    --text-primary: #f2f3f7;
    --text-secondary: #9a9ba4;
    --text-muted: #6e707a;
    --text-inverse: #121216;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Custom Sleek Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(140, 140, 160, 0.25);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(140, 140, 160, 0.45);
}
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(140, 140, 160, 0.25) transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.45;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Header & Top Bar */
.tiknia-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1020;
    transition: background-color 0.25s ease;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.brand-icon {
    font-size: 1.8rem;
    color: var(--brand-pink);
    filter: drop-shadow(0 2px 8px rgba(254, 44, 85, 0.35));
}

/* Search Bar in Header */
.topbar-search {
    position: relative;
    max-width: 440px;
    width: 100%;
    margin: 0 1.5rem;
}

.topbar-search input {
    width: 100%;
    background: var(--bg-page);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.65rem 1.25rem 0.65rem 2.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.topbar-search input:focus {
    background: var(--bg-surface);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.15);
}

.topbar-search .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Desktop App Container */
.app-container {
    display: flex;
    justify-content: center;
    margin-top: 60px;
    padding-left: var(--desktop-sidebar-width);
    padding-right: 320px;
    min-height: calc(100vh - 60px);
    width: 100%;
    box-sizing: border-box;
}

/* Desktop Sidebar */
.desktop-sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: var(--desktop-sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 1.25rem 0.75rem;
    overflow-y: auto;
    z-index: 1010;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}

.sidebar-nav-item i {
    font-size: 1.35rem;
}

.sidebar-nav-item:hover, .sidebar-nav-item.active {
    background: rgba(254, 44, 85, 0.08);
    color: var(--brand-pink);
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

.sidebar-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
}

/* Recommended Creators in Sidebar */
.sidebar-creator-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: background-color 0.2s ease;
}

.sidebar-creator-item:hover {
    background: var(--bg-page);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

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

.sidebar-creator-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-creator-handle {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Central Video Feed Column */
.feed-column {
    margin: 0 auto;
    width: 100%;
    max-width: 500px;
    padding: 0.5rem 0 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Feed Navigation Tabs (For You / Following) */
.feed-tabs-header {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    background: transparent;
    padding: 0.25rem 0 0.75rem 0;
    z-index: 990;
}

.feed-tab-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s ease;
}

.feed-tab-btn.active {
    color: var(--text-primary);
}

.feed-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--brand-pink);
    border-radius: 2px;
}

/* Snap Video Feed Container */
.feed-container {
    width: 100%;
    height: calc(100vh - 125px);
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

/* Individual Video Item */
.video-card-item {
    position: relative;
    height: calc(100vh - 130px);
    max-height: 720px;
    aspect-ratio: 9 / 16;
    width: auto;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000000;
    border-radius: 18px;
    overflow: hidden;
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000000;
    cursor: pointer;
}

/* Video Overlay Controls & Badges */
.video-overlay-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
}

/* Right Action Rail */
.video-action-rail {
    position: absolute;
    right: 10px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 20;
}

.action-rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.action-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-rail);
    backdrop-filter: blur(8px);
    border: none;
    color: #ffffff;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background-color 0.2s ease;
}

.action-btn:hover {
    transform: scale(1.1);
}

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

.action-btn.liked {
    color: var(--brand-pink);
    animation: heartPulse 0.35s ease;
}

.action-btn.saved {
    color: #ffb703;
}

.action-label {
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 2px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Creator Profile Button with Plus */
.creator-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
}

.creator-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    object-fit: cover;
}

.follow-plus-badge {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand-pink);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: bold;
    border: 1px solid #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.follow-plus-badge:hover {
    transform: translateX(-50%) scale(1.15);
}

/* Spinning Vinyl Audio Record */
.sound-disc {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #111111;
    border: 5px solid #222222;
    overflow: hidden;
    position: relative;
    animation: rotateDisc 5s linear infinite;
    cursor: pointer;
}

.sound-disc img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sound-disc.paused {
    animation-play-state: paused;
}

@keyframes rotateDisc {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* Bottom Metadata Details */
.video-metadata-overlay {
    position: absolute;
    left: 16px;
    bottom: 24px;
    right: 76px;
    z-index: 20;
    color: #ffffff;
    pointer-events: auto;
}

.creator-handle {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    margin-bottom: 0.35rem;
}

.creator-handle .verified-badge {
    color: var(--brand-cyan);
    font-size: 1rem;
}

.video-caption {
    font-size: 0.9rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    margin-bottom: 0.65rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hashtag-link {
    color: #ffffff;
    font-weight: 700;
}

.hashtag-link:hover {
    color: var(--brand-cyan);
    text-decoration: underline;
}

.mention-link {
    color: #ffffff;
    font-weight: 700;
}

/* Sound Marquee Audio Row */
.sound-audio-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

.sound-audio-row i {
    font-size: 0.95rem;
}

.marquee-wrap {
    max-width: 220px;
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marqueeText 10s linear infinite;
}

@keyframes marqueeText {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* Scrubbing Progress Bar */
.video-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
    z-index: 25;
    cursor: pointer;
}

.video-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--brand-pink);
    transition: width 0.1s linear;
}

/* Play/Pause Icon Center Flash */
.play-pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    color: #ffffff;
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 30;
}

.play-pause-indicator.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Floating Double Tap Heart Particle */
.floating-heart {
    position: absolute;
    font-size: 4.5rem;
    color: var(--brand-pink);
    filter: drop-shadow(0 4px 12px rgba(254, 44, 85, 0.6));
    pointer-events: none;
    z-index: 40;
    animation: floatHeart 0.8s forwards ease-out;
}

@keyframes floatHeart {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5) rotate(-15deg);
    }
    50% {
        opacity: 0.9;
        transform: translate(-50%, -80%) scale(1.25) rotate(10deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -120%) scale(1.4) rotate(0deg);
    }
}

/* Desktop Right Recommendations Rail */
.desktop-right-rail {
    position: fixed;
    top: 60px;
    right: 0;
    bottom: 0;
    width: 320px;
    padding: 1.5rem;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.trending-chip {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0.25rem 0.25rem 0.25rem 0;
    transition: all 0.2s;
}

.trending-chip:hover {
    background: rgba(254, 44, 85, 0.1);
    border-color: var(--brand-pink);
    color: var(--brand-pink);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    z-index: 1030;
    padding: 0 0.5rem;
}

.bottom-nav-items {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    position: relative;
    padding: 4px;
}

.bottom-nav-link i {
    font-size: 1.35rem;
    margin-bottom: 2px;
}

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

/* Floating Center Create Button */
.create-btn-special {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 30px;
    background: #ffffff;
    border-radius: 9px;
    position: relative;
    cursor: pointer;
    box-shadow: -3px 0 0 var(--brand-cyan), 3px 0 0 var(--brand-pink);
}

.create-btn-special i {
    font-size: 1.25rem;
    color: #121216;
    margin: 0;
}

/* Comments Bottom Sheet Drawer */
.comments-drawer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: var(--feed-max-width);
    height: 65vh;
    background: var(--bg-surface);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.comments-drawer.open {
    transform: translate(-50%, 0);
}

.drawer-drag-handle {
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 10px auto 4px auto;
}

.comments-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
}

.comments-list-box {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.comment-input-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.comment-input-bar input {
    flex: 1;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.6rem 1.15rem;
    color: var(--text-primary);
    outline: none;
}

.comment-input-bar button {
    background: none;
    border: none;
    color: var(--brand-pink);
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
}

/* Modal / Bottom Sheet Backdrop */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 1040;
    display: none;
}

.drawer-backdrop.show {
    display: block;
}

/* Toast Notifications */
.tiknia-toast-container {
    position: fixed;
    top: 75px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.tiknia-toast {
    background: rgba(18, 18, 22, 0.92);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    animation: toastSlideDown 0.3s ease;
}

@keyframes toastSlideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Breakpoints */
@media (max-width: 1240px) {
    .desktop-right-rail {
        display: none !important;
    }
    .app-container {
        padding-right: 0 !important;
    }
}

@media (max-width: 768px) {
    .desktop-sidebar {
        display: none !important;
    }
    .desktop-right-rail {
        display: none !important;
    }
    .tiknia-topbar {
        height: 52px;
        padding: 0 1rem;
    }
    .topbar-search {
        display: none;
    }
    .mobile-bottom-nav {
        display: block;
    }
    .app-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-top: 0 !important;
        margin-bottom: var(--bottom-nav-height) !important;
    }
    .feed-column {
        margin: 0;
        max-width: 100%;
        padding: 0;
    }
    .feed-tabs-header {
        position: absolute;
        top: 10px;
        left: 0;
        right: 0;
        background: transparent;
        border-bottom: none;
        z-index: 100;
    }
    .feed-tab-btn {
        color: rgba(255, 255, 255, 0.65);
    }
    .feed-tab-btn.active {
        color: #ffffff;
    }
    .feed-container {
        height: 100vh;
        max-width: 100%;
    }
    .video-card-item {
        height: 100vh;
        max-height: 100vh;
        width: 100%;
        aspect-ratio: unset;
        border-radius: 0;
        margin-bottom: 0;
    }
    .video-action-rail {
        bottom: calc(var(--bottom-nav-height) + 20px);
    }
    .video-metadata-overlay {
        bottom: calc(var(--bottom-nav-height) + 20px);
    }
}

