/* ==========================================================================
   Mobile Toolit Enhancement Injection System
   Standardized mobile responsiveness for ALL tools
   Inject this into any tool page for instant mobile optimization
   ========================================================================== */

/* Mobile Navigation System for Individual Tool Pages */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    background: rgba(15, 23, 42, 0.9);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.2s ease;
}

.mobile-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    margin: 3px 0;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.mobile-nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    z-index: 1000;
    transform: translateY(-100%);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-overlay.active {
    transform: translateY(0);
    opacity: 1;
}

.mobile-nav-menu {
    text-align: center;
    padding: 2rem;
}

.mobile-nav-menu a {
    display: block;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.mobile-nav-menu a:hover {
    color: #4F46E5;
    transform: translateX(10px);
}

/* ==========================================================================
   Standardized Mobile Breakpoints (768px standard)
   ========================================================================== */

/* Main Mobile (768px and below) */
@media (max-width: 768px) {
    /* Header Mobile Optimization */
    header .container {
        position: relative;
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .mobile-nav-toggle {
        display: block;
    }

    nav {
        display: none;
    }

    .logo {
        font-size: 1.5rem;
    }

    /* Tool Container */
    .container {
        padding: 0 1rem;
        max-width: 100%;
    }

    /* Tool Headers */
    .tool-header h1 {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 0.5rem;
    }

    .tool-description {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }

    .privacy-badge {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
        margin-bottom: 1.5rem;
    }

    /* Tool Areas */
    .tool-area {
        padding: 1.5rem;
        border-radius: 12px;
    }

    /* Grid Layouts */
    .qr-layout, .json-workspace, .editor-container {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Upload Areas */
    .upload-area {
        padding: 2rem 1rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
        min-height: 120px;
    }

    .upload-area h3 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .upload-area p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    /* Enhanced Touch Buttons */
    .btn-primary, .btn-secondary, button, .tool-btn, .case-btn {
        min-height: 48px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 10px;
        touch-action: manipulation;
        transition: all 0.2s ease;
    }

    .btn-primary:active, .btn-secondary:active, button:active, .tool-btn:active, .case-btn:active {
        transform: scale(0.98);
    }

    /* Text Inputs */
    textarea, input[type="text"], input[type="url"], .tool-textarea {
        min-height: 48px;
        padding: 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
        line-height: 1.5;
        border-radius: 10px;
        border: 2px solid var(--border, #E2E8F0);
        resize: vertical;
        width: 100%;
    }

    textarea {
        min-height: 120px;
    }

    /* Tool Options Grid */
    .tool-options, .case-buttons, .btn-group {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
        margin: 1.5rem 0;
    }

    /* File Management */
    .file-item {
        padding: 1rem;
        margin-bottom: 0.75rem;
        border-radius: 10px;
        border: 2px solid var(--border, #E2E8F0);
        background: var(--surface, #F8FAFC);
    }

    .file-item .remove {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
        font-size: 1.5rem;
        border-radius: 8px;
        background: #FEF2F2;
        color: var(--error, #EF4444);
        border: none;
        cursor: pointer;
        touch-action: manipulation;
    }

    /* Actions Panel */
    .actions, .download-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .actions button, .download-buttons button {
        width: 100%;
        justify-content: center;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .tool-header h1 {
        font-size: 1.5rem;
    }

    .tool-area {
        padding: 1rem;
    }

    .upload-area {
        padding: 1.5rem 0.75rem;
    }

    .tool-options, .case-buttons, .btn-group {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .tool-btn, .case-btn {
        font-size: 0.8rem;
        padding: 0.6rem 0.75rem;
        min-height: 44px;
    }

    textarea {
        min-height: 100px;
        padding: 0.75rem;
        font-size: 16px;
    }

    .privacy-badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Ultra-Small Mobile (360px and below) */
@media (max-width: 360px) {
    .container {
        padding: 0 0.5rem;
    }

    .tool-header h1 {
        font-size: 1.375rem;
        line-height: 1.1;
    }

    .tool-options, .case-buttons, .btn-group {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
}

/* ==========================================================================
   Touch and Accessibility Optimizations
   ========================================================================== */

@media (max-width: 768px) {
    /* Better touch targets */
    button, input, select, textarea {
        min-height: 44px;
    }

    /* Prevent zoom on input focus for iOS */
    input, select, textarea {
        font-size: 16px;
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* Better focus states */
    button:focus, input:focus, select:focus, textarea:focus {
        outline: 3px solid rgba(79, 70, 229, 0.3);
        outline-offset: 2px;
    }

    /* Upload area touch optimization */
    .upload-area {
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .upload-area:active {
        transform: scale(0.99);
        background: var(--primary-light, #EEF2FF);
    }
}

/* ==========================================================================
   Landscape Mobile Optimization
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .tool-section {
        padding: 1rem 0;
    }

    .tool-header {
        margin-bottom: 1rem;
    }

    .tool-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    textarea {
        min-height: 80px;
    }
}

/* ==========================================================================
   Dark Mode & Accessibility Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .mobile-nav-toggle {
        background: rgba(255, 255, 255, 0.1);
    }

    .mobile-nav-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    .tool-btn, .case-btn, .upload-area {
        border-width: 3px;
    }
}