/* ============================================
   COMPLETE MOBILE RESPONSIVE SOLUTION
   Perfect responsiveness for ALL screen sizes
   ============================================ */

/* ============================================
   BASE MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {

    /* Prevent horizontal overflow */
    html,
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    * {
        max-width: 100% !important;
    }

    /* Container fixes */
    .container,
    .main-container {
        max-width: 100% !important;
        padding: 0 1rem !important;
        overflow-x: hidden !important;
    }

    /* Video editor grid - single column */
    .video-editor,
    .local-upload-layout {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 1rem !important;
    }

    /* Video upload section - complete fix */
    #localUploadSection {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    #localUploadSection * {
        max-width: 100% !important;
    }

    /* Video player */
    #localUploadSection .video-placeholder {
        min-height: 180px !important;
        width: 100% !important;
    }

    #localUploadSection video {
        width: 100% !important;
        height: auto !important;
        max-height: 250px !important;
    }

    /* Text content - prevent overflow */
    #localUploadSection h3,
    #localUploadSection p,
    #localUploadSection .video-title {
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        max-width: 100% !important;
        font-size: 0.95rem !important;
        line-height: 1.4 !important;
    }

    /* Clip cards - modern compact design */
    #localUploadSection .clip-item {
        padding: 0.875rem !important;
        margin-bottom: 0.875rem !important;
        position: relative !important;
        border-radius: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #localUploadSection .clip-item h4 {
        font-size: 0.95rem !important;
        margin-bottom: 0.75rem !important;
        padding-right: 35px !important;
        /* Space for remove button */
    }

    /* Remove button - circular modern design */
    #localUploadSection .remove-clip {
        position: absolute !important;
        top: 0.75rem !important;
        right: 0.75rem !important;
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        max-width: 28px !important;
        max-height: 28px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.1rem !important;
        line-height: 1 !important;
        background: rgba(220, 38, 38, 0.1) !important;
        color: #dc2626 !important;
        border: 1px solid rgba(220, 38, 38, 0.3) !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
    }

    #localUploadSection .remove-clip:hover,
    #localUploadSection .remove-clip:active {
        background: #dc2626 !important;
        color: white !important;
        transform: scale(1.05) !important;
    }

    /* Form elements */
    #localUploadSection .time-input-small {
        font-size: 0.9rem !important;
        padding: 0.6rem !important;
        margin-bottom: 0.5rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #localUploadSection label {
        font-size: 0.85rem !important;
        margin-bottom: 0.35rem !important;
        display: block !important;
    }

    /* Buttons - full width */
    #localUploadSection button {
        width: 100% !important;
        margin-bottom: 0.5rem !important;
        padding: 0.75rem !important;
        box-sizing: border-box !important;
    }

    /* Range slider */
    #localUploadSection input[type="range"] {
        width: 100% !important;
        margin: 0.5rem 0 !important;
    }

    #localUploadSection .range-slider-label {
        font-size: 0.75rem !important;
        padding: 0.15rem 0.4rem !important;
    }

    /* Grids - all single column */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Images responsive */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Range slider handles - Better mobile touch */
    .range-slider-handle {
        cursor: pointer !important;
        touch-action: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .range-slider-container {
        touch-action: none !important;
        position: relative !important;
    }

    /* Increase touch target size on mobile — 20px handle + 13px on every side
       = 46px, above the 44px minimum touch target. */
    .range-slider-handle::before {
        content: '' !important;
        position: absolute !important;
        top: -13px !important;
        left: -13px !important;
        right: -13px !important;
        bottom: -13px !important;
        z-index: 1 !important;
    }

    /* D/H/M/S time fields: comfortable 44px touch height on phones */
    .dhms-input {
        min-height: 44px !important;
    }

/* Format and Quality selectors - full width on mobile */
.format-quality-row {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
}

.format-quality-row>div[style*="flex: 1"],
.format-quality-row>div[style*="flex:1"] {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}

.format-selector {
    width: 100% !important;
}

.format-display {
    width: 100% !important;
    box-sizing: border-box !important;
}

#qualityGroup {
    width: 100% !important;
}

#qualitySelect {
    width: 100% !important;
    box-sizing: border-box !important;
}
}

/* ============================================
   MOBILE L (max-width: 525px)
   ============================================ */
@media (max-width: 525px) {

    .container,
    .main-container {
        padding: 0 0.875rem !important;
    }

    #localUploadSection .clip-item {
        padding: 0.75rem !important;
    }

    #localUploadSection .clip-item h4 {
        font-size: 0.9rem !important;
        padding-right: 32px !important;
    }

    #localUploadSection .time-input-small {
        font-size: 0.875rem !important;
        padding: 0.55rem !important;
    }

    #localUploadSection label {
        font-size: 0.8rem !important;
    }

    #localUploadSection button {
        padding: 0.7rem !important;
        font-size: 0.9rem !important;
    }
}

/* ============================================
   MOBILE M (max-width: 375px)
   ============================================ */
@media (max-width: 375px) {

    .container,
    .main-container {
        padding: 0 0.75rem !important;
    }

    #localUploadSection h3,
    #localUploadSection .video-title {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
    }

    #localUploadSection p {
        font-size: 0.85rem !important;
    }

    #localUploadSection .video-placeholder {
        min-height: 160px !important;
    }

    #localUploadSection video {
        max-height: 200px !important;
    }

    #localUploadSection .clip-item {
        padding: 0.65rem !important;
        margin-bottom: 0.75rem !important;
    }

    #localUploadSection .clip-item h4 {
        font-size: 0.85rem !important;
        margin-bottom: 0.65rem !important;
        padding-right: 30px !important;
    }

    #localUploadSection .remove-clip {
        top: 0.65rem !important;
        right: 0.65rem !important;
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
        min-height: 26px !important;
        max-width: 26px !important;
        max-height: 26px !important;
        font-size: 1rem !important;
    }

    #localUploadSection .time-input-small {
        font-size: 0.85rem !important;
        padding: 0.5rem !important;
    }

    #localUploadSection label {
        font-size: 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }

    #localUploadSection button {
        padding: 0.65rem !important;
        font-size: 0.875rem !important;
    }
}

/* ============================================
   MOBILE S (max-width: 320px)
   ============================================ */
@media (max-width: 320px) {

    .container,
    .main-container {
        padding: 0 0.65rem !important;
    }

    #localUploadSection h3,
    #localUploadSection .video-title {
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
        padding: 0.5rem !important;
    }

    #localUploadSection p {
        font-size: 0.8rem !important;
    }

    #localUploadSection .video-placeholder {
        min-height: 140px !important;
    }

    #localUploadSection video {
        max-height: 180px !important;
    }

    #localUploadSection .clip-item {
        padding: 0.55rem !important;
        margin-bottom: 0.65rem !important;
    }

    #local UploadSection .clip-item h4 {
        font-size: 0.8rem !important;
        margin-bottom: 0.55rem !important;
        padding-right: 28px !important;
    }

    #localUploadSection .remove-clip {
        top: 0.55rem !important;
        right: 0.55rem !important;
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        min-height: 24px !important;
        max-width: 24px !important;
        max-height: 24px !important;
        font-size: 0.95rem !important;
    }

    #localUploadSection .time-input-small {
        font-size: 0.8rem !important;
        padding: 0.45rem !important;
    }

    #localUploadSection label {
        font-size: 0.7rem !important;
        margin-bottom: 0.2rem !important;
    }

    #localUploadSection button {
        padding: 0.6rem !important;
        font-size: 0.85rem !important;
    }
}
/* ==================================================================
   MOBILE — "Native app" cutter editor  (2026-07-23)
   Makes the homepage trim/multi-clip editor feel like an app panel,
   not a web form. Scoped to <=768px; desktop 2-col layout untouched.
   !important to win over the inline base styles in index.html.
   ================================================================== */
@media (max-width: 768px) {
    /* Card = full app panel: generous rounding, soft depth */
    #cutterEditorCard,
    #resultSection {
        border-radius: 22px !important;
        padding: 1.15rem 1rem 1.3rem !important;
        border: 1px solid rgba(15, 23, 42, 0.07) !important;
        box-shadow: 0 12px 34px -12px rgba(2, 22, 24, 0.4) !important;
    }

    /* iOS-style segmented control for the Trim / Multi-Clip tabs */
    #videoEditor .controls-section .tabs {
        background: #eef2f4 !important;
        padding: 4px !important;
        border-radius: 14px !important;
        gap: 4px !important;
        margin-bottom: 1rem !important;
    }
    #videoEditor .controls-section .tab {
        min-height: 46px !important;
        padding: 0 !important;
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        border-radius: 11px !important;
        color: #475569 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    #videoEditor .controls-section .tab.active {
        background: #ffffff !important;
        color: #0d9488 !important;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14) !important;
    }

    /* Format + quality: large tappable app rows */
    #cutterEditorCard .format-quality-row {
        gap: 0.6rem !important;
        margin-bottom: 0.9rem !important;
    }
    #cutterEditorCard .format-display,
    #cutterEditorCard #qualitySelect {
        min-height: 54px !important;
        border-radius: 14px !important;
        border: 1.5px solid #e2e8f0 !important;
        background: #f8fafc !important;
        font-size: 1.02rem !important;
        font-weight: 600 !important;
        color: #0f172a !important;
        padding: 0 1rem !important;
    }
    #cutterEditorCard .format-display {
        display: flex !important;
        align-items: center !important;
    }

    /* Time range: a grouped, card-in-card app section */
    #cutterEditorCard .time-section > h4 {
        font-size: 0.74rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.07em !important;
        color: #64748b !important;
        font-weight: 700 !important;
        margin-bottom: 0.55rem !important;
    }
    /* Stack Start over End so each gets the full card width — the side-by-side
       6-field row is far too cramped on a phone. */
    #cutterEditorCard .time-row {
        display: block !important;
        background: #f8fafc !important;
        border: 1px solid #eef2f4 !important;
        border-radius: 16px !important;
        padding: 0.9rem 0.85rem !important;
        margin-bottom: 0 !important;
    }
    #cutterEditorCard .time-sep {
        display: none !important;
    }
    #cutterEditorCard .time-col {
        width: 100% !important;
        margin-bottom: 0.85rem !important;
    }
    #cutterEditorCard .time-col:last-of-type {
        margin-bottom: 0 !important;
    }
    #cutterEditorCard .time-col > label {
        display: block !important;
        font-size: 0.68rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.06em !important;
        font-weight: 700 !important;
        color: #94a3b8 !important;
        margin-bottom: 2px !important;
    }
    #cutterEditorCard .dhms-group {
        gap: 8px !important;
        margin-top: 4px !important;
    }
    #cutterEditorCard .dhms-group span {
        gap: 5px !important;
    }
    #cutterEditorCard .dhms-input {
        min-height: 52px !important;
        border-radius: 12px !important;
        border: 1.5px solid #e2e8f0 !important;
        background: #ffffff !important;
        font-size: 1.15rem !important;
        font-weight: 700 !important;
        color: #0f172a !important;
    }
    #cutterEditorCard .dhms-group i {
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        color: #94a3b8 !important;
    }

    /* Clip duration as a teal pill */
    #cutterEditorCard #clipDuration {
        display: inline-block !important;
        background: rgba(13, 148, 136, 0.1) !important;
        color: #0d9488 !important;
        padding: 6px 14px !important;
        border-radius: 100px !important;
        font-size: 0.8rem !important;
        margin: 0.85rem auto 0.1rem !important;
    }

    /* Range slider: thicker track + larger, glowing handles */
    #cutterEditorCard .range-slider-container {
        height: 50px !important;
        margin-top: 1.4rem !important;
    }
    #cutterEditorCard .range-slider-track,
    #cutterEditorCard .range-slider-fill {
        height: 8px !important;
    }
    #cutterEditorCard .range-slider-handle {
        width: 30px !important;
        height: 30px !important;
        border-width: 4px !important;
        box-shadow: 0 3px 12px rgba(13, 148, 136, 0.45) !important;
    }

    /* Primary action: full-width, tall, thumb-reachable */
    #cutterEditorCard .action-row {
        flex-direction: column !important;
        gap: 0.6rem !important;
        margin-top: 1.25rem !important;
    }
    #cutterEditorCard #processBtn {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 56px !important;
        border-radius: 16px !important;
        font-size: 1.15rem !important;
        font-weight: 800 !important;
        box-shadow: 0 10px 24px -8px rgba(13, 148, 136, 0.6) !important;
    }
    #cutterEditorCard #fullDownloadBtn {
        width: 100% !important;
        flex: none !important;
        min-height: 50px !important;
        border-radius: 14px !important;
        font-size: 1.05rem !important;
    }
    #cutterEditorCard #editorPremiumCTA {
        margin-top: 0.9rem !important;
    }
}
