/* Mobile Responsive Enhancements for MyPaste */

/* Extra small breakpoint for very small mobile devices */
@media (max-width: 480px) {
    /* Typography adjustments */
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.25rem !important; }
    h3 { font-size: 1.125rem !important; }
    
    /* Container padding */
    .max-w-6xl, .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Navigation logo text */
    .logo-container .text-xl {
        font-size: 1rem;
    }
    
    /* Button sizing */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Form inputs */
    input, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Paste content area */
    .paste-content pre {
        font-size: 12px !important;
        line-height: 1.3 !important;
    }
    
    /* Hide line numbers on very small screens */
    .line-numbers {
        display: none;
    }
    
    /* Table responsiveness */
    table {
        font-size: 0.75rem;
    }
    
    table th, table td {
        padding: 0.5rem 0.25rem;
    }
    
    /* Card padding */
    .bg-dark-card {
        padding: 0.75rem;
    }
    
    /* Settings page adjustments */
    .settings-tab-button {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Rank badges on mobile */
    .rank-badge {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    /* Admin dashboard mobile optimizations */
    .admin-special-feature h1 {
        font-size: 1.5rem !important;
        line-height: 1.3;
    }
    
    .super-admin-badge {
        display: inline-block;
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    /* Admin card adjustments */
    .admin-card {
        padding: 0.75rem !important;
    }
    
    .admin-card h2 {
        font-size: 1rem !important;
    }
    
    .admin-action-button {
        padding: 0.75rem !important;
        font-size: 0.875rem !important;
        text-align: center;
        justify-content: center !important;
    }
}

/* Small mobile devices */
@media (max-width: 640px) {
    /* Make all buttons full width on mobile forms */
    .mobile-full-width {
        width: 100%;
        justify-content: center;
    }
    
    /* Stack flex items vertically on mobile */
    .mobile-stack {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mobile-stack > * {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Mobile-friendly spacing */
    .mobile-spacing {
        gap: 0.5rem !important;
    }
    
    /* Hide complex animations on mobile for performance */
    .fade-in, .slide-in, .bounce-in {
        animation: none !important;
    }
    
    /* Optimize paste viewing on mobile */
    .paste-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .paste-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .paste-actions button,
    .paste-actions a {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile navigation improvements */
    .mobile-nav-item {
        display: block;
        width: 100%;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #333;
        text-align: left;
    }
    
    /* Form improvements */
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    /* Tab navigation on mobile */
    .tab-nav {
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .tab-nav::-webkit-scrollbar {
        display: none;
    }
    
    .tab-button {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

/* Medium screens and up */
@media (min-width: 641px) {
    /* Remove mobile-specific styles */
    .mobile-full-width {
        width: auto;
    }
    
    .mobile-stack {
        flex-direction: row;
        align-items: center;
    }
    
    .mobile-spacing {
        gap: 1rem !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn, button, a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Remove hover effects on touch devices */
    .hover\:scale-105:hover {
        transform: none;
    }
    
    /* Add active states for better touch feedback */
    .btn:active, button:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
    
    /* Optimize scrolling */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
}

/* Landscape phone orientation */
@media (max-width: 896px) and (orientation: landscape) {
    /* Reduce header height in landscape */
    .paste-header h1 {
        font-size: 1.25rem;
    }
    
    /* Compact navigation */
    nav .h-16 {
        height: 3rem;
    }
    
    /* Reduce padding for better content visibility */
    .p-6 {
        padding: 1rem;
    }
    
    .p-4 {
        padding: 0.75rem;
    }
}

/* High DPI screens (Retina, etc.) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Slightly smaller fonts on high-DPI mobile for better readability */
    @media (max-width: 640px) {
        body {
            font-size: 14px;
        }
        
        .text-sm {
            font-size: 0.75rem;
        }
        
        .text-xs {
            font-size: 0.6875rem;
        }
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 640px) {
    /* Ensure focus indicators are visible */
    button:focus, input:focus, textarea:focus, select:focus, a:focus {
        outline: 2px solid #3b82f6;
        outline-offset: 2px;
    }
    
    /* Improve readability with better contrast on small screens */
    .text-dark-muted {
        color: #b3b3b3 !important;
    }
    
    /* Larger click areas for important actions */
    .primary-action {
        min-height: 48px;
        font-size: 1rem;
    }
}

/* Safari mobile specific fixes */
@supports (-webkit-appearance: none) {
    @media (max-width: 640px) {
        /* Fix viewport height on iOS Safari */
        .min-h-screen {
            min-height: -webkit-fill-available;
        }
        
        /* Prevent zooming on input focus */
        input[type="text"],
        input[type="password"],
        input[type="email"],
        textarea,
        select {
            font-size: 16px;
        }
        
        /* Fix sticky positioning on iOS */
        nav.sticky {
            position: -webkit-sticky;
            position: sticky;
        }
    }
}

/* Print styles for mobile */
@media print {
    .mobile-nav, .btn, .banner-ad {
        display: none !important;
    }
    
    .bg-dark-card {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc !important;
    }
    
    .text-dark-text, .text-white {
        color: black !important;
    }
}