/* Base & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: #0f0f0f;
    overflow: hidden; /* Prevent body scroll, handle scroll in feed-container */
}

/* Desktop Background */
.desktop-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, #2a2a35 0%, #000000 100%);
    z-index: -1;
    display: none;
}

/* App Wrapper (Mobile First) */
#app-wrapper {
    width: 100%;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    position: relative;
    background: #000;
}

/* Desktop Centered Layout */
@media (min-width: 600px) {
    .desktop-bg { display: block; }
    #app-wrapper {
        max-width: 450px;
        margin: 0 auto;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
        overflow: hidden;
        height: 98vh;
        margin-top: 1vh;
    }
}

/* Scrollable Feed Container */
#feed-container {
    height: 100%;
    width: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
}
#feed-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Feed Item */
.feed-item {
    height: 100%;
    width: 100%;
    scroll-snap-align: start;
    position: relative;
    background: #000;
}

/* Media Elements */
.media-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #1a1a1a; /* Placeholder color */
}

.fallback-image {
    object-fit: contain;
    background-color: #333;
}

/* Overlays Setup */
.overlay-bottom {
    position: absolute;
    bottom: 20px;
    left: 15px;
    right: 80px; /* Leave space for buttons */
    color: white;
    z-index: 10;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
}

.overlay-bottom h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.overlay-bottom p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.overlay-bottom .date {
    font-size: 0.75rem;
    opacity: 0.7;
}

.overlay-right {
    position: absolute;
    bottom: 20px;
    right: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

/* Glass UI Buttons */
.glass-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.glass-btn:active {
    transform: scale(0.95);
}

.glass-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.glass-btn.active svg {
    fill: #ff4757; /* Accent color for active like/dislike */
}

.btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.count-text {
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Volume Control */
.volume-control-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.volume-slider {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 8px;
    height: 60px;
    accent-color: white;
    cursor: pointer;
}

/* Loading & Error States */
#loading-spinner, #error-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 50;
    background: #000;
    color: white;
}

#loading-spinner.active, #error-container.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

#retry-btn {
    margin-top: 15px;
    padding: 10px 20px;
    border-radius: 20px;
    border: none;
    background: white;
    color: black;
    font-weight: bold;
    cursor: pointer;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}
