/* Mobile & Tablet Optimizations for NeoVid Adaptive */

/* Touch-friendly tap targets - prevent accidental zoom on iOS */
.touch-manipulation {
    touch-action: manipulation;
}

/* Prevent text selection on buttons for better mobile UX */
button, .btn {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* Larger touch targets on mobile */
@media (max-width: 640px) {
    button, a, input[type="submit"], input[type="button"] {
        min-height: 44px; /* Apple HIG recommendation */
        min-width: 44px;
    }
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Video player mobile optimizations */
@media (max-width: 768px) {
    video {
        max-height: 50vh; /* Don't let video take too much space on mobile */
    }

    /* Make video controls more touch-friendly */
    video::-webkit-media-controls-panel {
        padding: 8px;
    }
}

/* Modal full-screen on mobile */
@media (max-width: 640px) {
    #upload-modal > div {
        max-width: 100%;
        min-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
}

/* Mobile menu transitions */
#mobile-menu {
    transition: all 0.3s ease-in-out;
}

/* Sticky header shadow on scroll (mobile) */
@media (max-width: 1024px) {
    nav.sticky {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* Better card layouts on mobile */
@media (max-width: 768px) {
    .bg-gray-800.rounded-lg {
        border-radius: 0.5rem; /* Slightly smaller radius on mobile */
    }
}

/* Prevent zoom on input focus (iOS) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
    font-size: 16px !important; /* Prevents iOS auto-zoom */
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    nav {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

/* Loading spinner size responsive */
@media (max-width: 640px) {
    .animate-spin {
        height: 2.5rem;
        width: 2.5rem;
    }
}

/* Better table overflow on mobile */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* Responsive markdown content */
.markdown-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

@media (max-width: 640px) {
    .markdown-content {
        font-size: 0.875rem;
        line-height: 1.5;
    }

    .markdown-content h1 { font-size: 1.5rem; }
    .markdown-content h2 { font-size: 1.25rem; }
    .markdown-content h3 { font-size: 1.125rem; }
}

/* Active/pressed states for better touch feedback */
button:active,
a:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

/* Landscape mobile adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    /* Reduce padding in landscape mode */
    .py-8 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .mb-8 { margin-bottom: 1rem !important; }

    /* Compact video player controls in landscape */
    #player-section .bg-gray-700 {
        padding: 0.5rem !important;
    }
}
