/**
 * Mobile Responsive Enhancements
 * Ensures perfect display on all mobile devices
 */

/* Mobile Navigation Bar */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: var(--z-sticky);
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

.mobile-nav-item.active {
    color: var(--primary-purple);
}

.mobile-nav-item svg {
    width: 20px;
    height: 20px;
}

.mobile-nav-item span {
    font-size: 10px;
    font-weight: 500;
}

/* Mobile Layout Adjustments */
@media (max-width: 768px) {
    /* Show mobile nav */
    .mobile-nav {
        display: flex;
    }
    
    /* Adjust content for mobile nav */
    .content {
        padding-bottom: 60px;
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
        margin-left: 0;
    }
    
    /* Hide sidebar on mobile */
    .sidebar {
        display: none;
    }
    
    /* Hide desktop navigation links */
    .nav-links {
        display: none;
    }
    
    /* Mobile Header */
    .header {
        height: 50px;
    }
    
    .header-content {
        padding: 0 16px;
        gap: 12px;
    }
    
    .logo-text {
        font-size: 18px;
    }
    
    .logo-icon {
        width: 24px;
        height: 24px;
    }
    
    /* Mobile Search */
    .search-container {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 8px 16px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: all 0.3s ease;
    }
    
    .search-container.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }
    
    /* Mobile User Section */
    .user-section {
        gap: 8px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .user-dropdown {
        right: -8px;
        max-width: calc(100vw - 32px);
    }
    
    /* Mobile Pages */
    .page-container {
        padding: 16px;
    }
    
    .page-header {
        margin-bottom: 20px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .page-subtitle {
        font-size: 14px;
    }
    
    /* Mobile Stream Grid */
    .streams-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stream-card {
        border-radius: 8px;
    }
    
    .stream-thumbnail {
        border-radius: 8px 8px 0 0;
    }
    
    .stream-info {
        padding: 10px;
    }
    
    .stream-title {
        font-size: 13px;
        -webkit-line-clamp: 1;
    }
    
    .streamer-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    /* Mobile Featured Section */
    .featured-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .featured-carousel {
        height: 200px;
        border-radius: 8px;
    }
    
    .carousel-info {
        padding: 20px;
    }
    
    .carousel-title {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .carousel-meta {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .watch-now-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* Mobile Categories */
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .category-card {
        border-radius: 6px;
    }
    
    .category-thumbnail {
        font-size: 40px;
        border-radius: 6px;
    }
    
    .category-info {
        padding: 8px 4px;
    }
    
    .category-name {
        font-size: 12px;
    }
    
    .category-viewers {
        font-size: 11px;
    }
    
    /* Mobile Creator Studio */
    .studio-container {
        height: calc(100vh - 50px - 60px);
    }
    
    .studio-header {
        padding: 16px;
    }
    
    .studio-title {
        font-size: 20px;
    }
    
    .studio-content {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
    
    .video-section {
        padding: 16px;
    }
    
    .stream-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
    }
    
    .go-live-btn {
        width: 100%;
        margin-top: 8px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .stat-item {
        padding: 8px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    /* Mobile Chat */
    .chat-section {
        min-height: 300px;
    }
    
    /* Mobile Following Page */
    .following-content {
        padding: 16px;
    }
    
    .following-section {
        margin-bottom: 32px;
    }
    
    .offline-channels-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .offline-channel-card {
        padding: 12px;
    }
    
    /* Mobile Empty States */
    .empty-state {
        padding: 40px 20px;
    }
    
    .empty-icon {
        font-size: 60px;
        margin-bottom: 16px;
    }
    
    .empty-state h3 {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .empty-state p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    /* Touch-friendly spacing */
    button, a, .clickable {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improved touch targets */
    .stream-card,
    .category-card,
    .channel-item,
    .offline-channel-card {
        min-height: 60px;
    }
}

/* Small phones */
@media (max-width: 375px) {
    .header-content {
        padding: 0 12px;
    }
    
    .logo-text {
        display: none;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .auth-buttons {
        gap: 4px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .featured-carousel {
        height: 160px;
    }
    
    .carousel-title {
        font-size: 18px;
    }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-nav {
        padding-top: 4px;
        padding-bottom: 4px;
    }
    
    .mobile-nav-item {
        padding: 4px;
    }
    
    .mobile-nav-item svg {
        width: 18px;
        height: 18px;
    }
    
    .mobile-nav-item span {
        display: none;
    }
    
    .featured-carousel {
        height: calc(100vh - 100px);
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .mobile-nav {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    
    .content {
        padding-bottom: calc(68px + env(safe-area-inset-bottom));
    }
}

/* Smooth scrolling on mobile */
@media (max-width: 768px) {
    * {
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar-content,
    .content,
    .chat-messages {
        -webkit-overflow-scrolling: touch;
    }
}

/* Disable hover effects on touch devices */
@media (hover: none) {
    .stream-card:hover,
    .category-card:hover,
    .btn:hover,
    .nav-link:hover,
    .sidebar-nav-item:hover {
        transform: none;
    }
}