/* Instagram Reels-like UI for Urtipuul Game - Premium Redesign */

:root {
    --reel-text: #ffffff;
    --reel-bg: #000000;
    --reel-accent: #ff3b5c;
    --reel-glass: rgba(0, 0, 0, 0.4);
    --reel-glass-border: rgba(255, 255, 255, 0.1);
}

.reels-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--reel-bg);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: visible;
}

/* Specific styling for the Videolar page when it's in Reels mode */
#videolar.reels-mode {
    padding: 0;
    margin: 0;
    height: calc(100vh - 48px);
    overflow: hidden;
    background: #000;
    position: relative;
}

/* Reels Tabs */
.reels-tabs {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.reels-tab {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.reels-tab:hover {
    color: rgba(255, 255, 255, 0.85);
}

.reels-tab.active {
    background: rgba(255, 255, 255, 0.95);
    color: #000;
}

/* Videolar sayfası aktifken tüm üst seviye scrollbar'ları gizle */
#videolar.reels-mode::-webkit-scrollbar,
#videolar.reels-mode ~ .content::-webkit-scrollbar,
.content:has(#videolar.active)::-webkit-scrollbar,
.content:has(#videolar.reels-mode)::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

#videolar.reels-mode.active ~ .content,
.content:has(#videolar.active.reels-mode) {
    overflow: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    scrollbar-gutter: auto !important;
}

/* Scrollbar sadece videolar sayfası aktifken gizle */
#videolar.active::-webkit-scrollbar {
    width: 0 !important;
}

#videolar.reels-mode .video-grid::-webkit-scrollbar,
#videolar.reels-mode .video-grid::-webkit-scrollbar-thumb,
#videolar.reels-mode .video-grid::-webkit-scrollbar-track {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    background: transparent !important;
}

#videolar.reels-mode .video-grid {
    overflow-y: scroll !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.page#videolar.reels-mode::-webkit-scrollbar,
.page.reels-mode::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

/* .content içindeki reels-mode sayfası aktifken scrollbar'ı tamamen gizle */
.content:has(.page.active.reels-mode) {
    overflow: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    scrollbar-gutter: auto !important;
}

.content:has(.page.active.reels-mode)::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

#videolar.reels-mode .video-grid {
    display: block;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
}

.reels-scroll-container {
    flex: 1;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    height: 100%;
}

.reels-scroll-container::-webkit-scrollbar,
#videolar.reels-mode .video-grid::-webkit-scrollbar,
#videolar.reels-mode .video-grid::-webkit-scrollbar-thumb,
#videolar.reels-mode .video-grid::-webkit-scrollbar-track,
#video-gallery::-webkit-scrollbar,
#video-gallery::-webkit-scrollbar-thumb,
#video-gallery::-webkit-scrollbar-track {
    display: none;
    height: 0;
    width: 0;
}

.reels-scroll-container,
#videolar.reels-mode .video-grid,
#video-gallery {
    -ms-overflow-style: none;
    scrollbar-width: none;
    overflow-y: auto;
}

.reel-slide {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    cursor: pointer;
}

/* Adjust height for sidebar content area */
.content .page#videolar.reels-mode .reel-slide {
    height: calc(100vh - 48px);
}

.reel-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Show full video */
    background: #000;
    pointer-events: none;
}

/* Background blur for horizontal videos */
.reel-bg-blur {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(30px) brightness(0.4);
    z-index: 0;
}

/* Side Action Menu */
.reel-actions {
    position: absolute;
    right: 12px;
    bottom: 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
    z-index: 10;
}

.reel-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: white;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reel-action-btn:hover {
    transform: scale(1.1);
}

.reel-action-btn:active {
    transform: scale(0.9);
}

.reel-action-btn i {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.reel-action-count {
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Specific button styles */
.reel-action-btn.liked i {
    color: #ff2d55;
    animation: heartBeat 0.3s ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 45, 85, 0.7));
}

.reel-action-btn.liked .reel-action-count {
    color: #ff2d55;
}

/* Saved - turuncu */
.reel-action-btn.saved i {
    color: #ff6a00;
    filter: drop-shadow(0 0 6px rgba(255, 106, 0, 0.6));
}

.reel-action-btn.saved .reel-action-count {
    color: #ff6a00;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* Video Info Area (Bottom Left) */
.reel-info {
    position: absolute;
    left: 16px;
    bottom: 25px;
    right: 80px;
    color: white;
    z-index: 10;
    pointer-events: none;
}

.reel-info>* {
    pointer-events: auto;
}

.reel-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.reel-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
}

.reel-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid white;
    object-fit: cover;
    background: #333;
}

.reel-username {
    font-weight: 700;
    font-size: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.reel-follow-btn {
    padding: 6px 14px;
    border: 1px solid white;
    border-radius: 8px;
    background: transparent;
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.reel-follow-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.reel-description {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
    max-height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Rotating Music Icon */
.reel-music {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.music-scroller {
    width: 150px;
    overflow: hidden;
    white-space: nowrap;
}

.music-scroller span {
    display: inline-block;
    padding-left: 100%;
    animation: musicScroll 10s linear infinite;
}

@keyframes musicScroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

.music-disk {
    position: absolute;
    right: 12px;
    bottom: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(45deg, #333, #666);
    border: 4px solid rgba(255, 255, 255, 0.2);
    animation: rotateDisk 4s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.music-disk::after {
    content: '♫';
    color: white;
    font-size: 14px;
}

@keyframes rotateDisk {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Close Button */
.reels-close-btn {
    position: absolute;
    top: 25px;
    left: 20px;
    z-index: 100;
    color: white;
    font-size: 28px;
    cursor: pointer;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    transition: transform 0.2s;
}

.reels-close-btn:hover {
    transform: scale(1.1);
}

/* Heart Pop Animation */
.heart-animation {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 80px;
    color: white;
    pointer-events: none;
    animation: heartPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    z-index: 20;
    opacity: 0;
}

@keyframes heartPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    30% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.9;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Comments Panel Slider - Ana sayfa stiliyle aynı */
.reels-comments-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65%;
    background: var(--card-bg, #fff);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    color: var(--text-primary, #212529);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.reels-comments-panel.active {
    transform: translateY(0);
}

.comments-handle {
    width: 40px;
    height: 5px;
    background: var(--border-color, #dee2e6);
    border-radius: 5px;
    margin: 12px auto;
}

.comments-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e6e9ef);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comments-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    transition: background 0.15s;
}

.comment-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-text-container {
    flex: 1;
}

.comment-user-info {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.comment-text {
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 4px;
    line-height: 1.4;
}

.comment-input-area {
    border-top: 1px solid var(--border-color, #e6e9ef);
    padding: 12px 16px;
}

.comment-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.comment-input-wrapper textarea {
    flex: 1;
    border: 1px solid var(--border-color, #d0d0d0);
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 100px;
    background: var(--card-bg, #fff);
}

.comment-input-wrapper textarea:focus {
    border-color: #6C6CE8;
}

.comment-send-btn {
    background: #6C6CE8;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-send-btn:hover {
    background: #5a5ad4;
}

.comment-send-btn:disabled {
    background: #b0b0b0;
    cursor: not-allowed;
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
    color: #888;
}

/* Empty state */
.no-comments {
    text-align: center;
    padding: 40px;
    color: #888;
}

.comment-submit-btn {
    background: #4361ee;
    color: white;
}

.comment-submit-btn:hover {
    background: #3a53d1;
    transform: scale(1.03);
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
    color: #888;
}

/* Empty state */
.no-comments {
    text-align: center;
    padding: 40px;
    color: #888;
}

/* ── Desktop Full-Screen Video Mode ── */
@media (min-width: 769px) {
    .reels-tabs {
        display: none !important;
    }
    .container:has(#videolar.reels-mode.active) .content {
        padding: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    #videolar.reels-mode {
        height: 100vh !important;
        width: 100% !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
    #video-gallery {
        max-width: 100% !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        display: block !important;
        overflow-y: scroll !important;
        scroll-snap-type: y mandatory !important;
    }
    #video-gallery .reel-slide {
        width: 100% !important;
        height: 100% !important;
        min-height: unset !important;
        overflow: visible !important;
    }
    #video-gallery .reel-actions {
        pointer-events: auto !important;
        z-index: 20 !important;
    }
    #video-gallery .reel-actions .reel-action-btn {
        pointer-events: auto !important;
        cursor: pointer !important;
    }
    #video-gallery .reel-info {
        pointer-events: none !important;
    }
    #video-gallery .reel-info > * {
        pointer-events: auto !important;
    }
    #video-gallery .reel-video {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        object-fit: contain !important;
        pointer-events: none !important;
    }
    #video-gallery .reel-bg-blur {
        pointer-events: none !important;
    }
}

/* Floating Upload Button */
.reel-upload-fab {
    position: absolute;
    top: 25px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.reel-upload-fab:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.1);
}

.reel-upload-fab:active {
    transform: scale(0.9);
}

/* Ortadaki Play/Pause ve Ses Kontrol Overlay */
.reel-center-controls {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}
.reel-center-controls.visible {
    display: flex;
}
.reel-pause-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: transform 0.2s;
}
.reel-pause-btn:active {
    transform: scale(0.9);
}
.reel-mute-btn-center {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: transform 0.2s;
}
.reel-mute-btn-center:active {
    transform: scale(0.9);
}