body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    box-sizing: border-box;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
}

/* Loading animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Video player custom styles */
video {
    outline: none;
}

video::-webkit-media-controls-panel {
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .text-3xl {
        font-size: 1.875rem;
        line-height: 2.25rem;
    }
}

/* Smooth transitions */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Focus styles */
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #FE2C55;
    outline-offset: 2px;
}

/* Hover effects */
.hover-lift {
    transition: transform 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Glass morphism effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button styles */
.btn-primary {
    background: linear-gradient(135deg, #FE2C55 0%, #FF6B6B 100%);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(254, 44, 85, 0.3);
}

/* Card styles */
.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive video container */
.video-responsive {
    position: relative;
    padding-bottom: 177.78%; /* 9:16 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-responsive video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Custom checkbox */
.custom-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #4a4a4a;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.custom-checkbox:checked {
    background: #FE2C55;
    border-color: #FE2C55;
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

/* File upload area */
.upload-area {
    border: 2px dashed #4a4a4a;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #FE2C55;
    background: rgba(254, 44, 85, 0.05);
}

/* Level badges */
.level-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.level-free {
    background: #6B7280;
    color: white;
}

.level-basic {
    background: #3B82F6;
    color: white;
}

.level-premium {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

/* TikTok-style video container */
.video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: 9/16;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    outline: none;
    z-index: 10;
    position: relative;
}

/* Video controls enhancement */
.video-player::-webkit-media-controls-panel {
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-player:hover::-webkit-media-controls-panel,
.video-player:playing::-webkit-media-controls-panel {
    opacity: 1;
}

/* Mobile video player */
@media (max-width: 768px) {
    .video-container {
        max-width: 100%;
        border-radius: 0;
        height: calc(100vh - 120px); /* Account for tabs and navigation */
        aspect-ratio: 9/16; /* Standard mobile aspect ratio */
    }
    
    .video-player::-webkit-media-controls-panel {
        opacity: 1;
    }
    
    .video-swipe {
        height: calc(100vh - 120px) !important;
    }
    
    .bg-gray-800[style*="height: 600px"] {
        height: calc(100vh - 120px) !important;
    }
    
    .min-h-screen {
        min-height: 100vh;
        padding: 0.5rem;
    }
    
    .max-w-md {
        max-width: 100%;
    }
}

/* Desktop adjustments */
@media (min-width: 769px) {
    .video-container {
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
        height: 600px; /* Fixed height for desktop */
    }
    
    .video-item {
        min-height: 600px;
    }
}

/* Ensure proper video container sizing */
.video-item {
    width: 100%;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .video-item {
        min-height: 100vh;
        padding: 0;
    }
}

/* Smooth video transitions */
.video-item.active {
    transform: scale(1);
}

.video-item:not(.active) {
    transform: scale(0.98);
    opacity: 0.8;
}

/* Navigation buttons */
.nav-button {
    position: fixed;
    right: 20px;
    z-index: 100;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-button:hover {
    background: rgba(254, 44, 85, 0.8);
    transform: scale(1.1);
}

.nav-button.prev {
    top: 50%;
    transform: translateY(-50%);
}

.nav-button.next {
    bottom: 100px;
}

/* Loading state for videos */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
}

.video-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #FE2C55;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Video overlay improvements */
.video-overlay-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 20px;
    z-index: 15;
}

/* Action buttons styling */
.action-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.action-button:hover {
    background: rgba(254, 44, 85, 0.8);
    transform: scale(1.1);
}

.action-button i {
    font-size: 20px;
    margin-bottom: 4px;
}

.action-button span {
    font-size: 12px;
    font-weight: 600;
}

/* User info styling */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
    object-fit: cover;
}

.user-details h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.user-details p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Follow button */
.follow-button {
    padding: 6px 16px;
    background: #FE2C55;
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.follow-button:hover {
    background: #E02147;
    transform: scale(1.05);
}

/* Trending videos sidebar */
.trending-sidebar {
    background: rgba(31, 41, 55, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1.5rem;
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.trending-item:hover {
    background: rgba(254, 44, 85, 0.1);
    transform: translateX(4px);
}

.trending-item:last-child {
    margin-bottom: 0;
}

.trending-thumbnail {
    width: 64px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

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

.trending-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trending-author {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
}

.trending-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.trending-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Navigation bar improvements */
.navigation-bar {
    background: rgba(31, 41, 55, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
}

.video-counter {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2px;
}

.video-title-display {
    font-size: 14px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-button-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

/* Single video layout improvements */
.single-video-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    width: 100%;
}

@media (max-width: 768px) {
    .single-video-container {
        min-height: calc(100vh - 200px);
    }
}

/* Responsive adjustments for trending */
@media (max-width: 768px) {
    .trending-sidebar {
        margin-top: 1rem;
    }
    
    .trending-item {
        padding: 8px;
    }
    
    .trending-thumbnail {
        width: 48px;
        height: 60px;
    }
    
    .trending-title {
        font-size: 12px;
    }
    
    .trending-author {
        font-size: 11px;
    }
    
    .trending-stats {
        font-size: 10px;
        gap: 8px;
    }
    
    .navigation-bar {
        padding: 8px 12px;
    }
    
    .nav-button-text {
        font-size: 12px;
    }
    
    .video-title-display {
        font-size: 12px;
    }
}