/* ==========================================================================
   FILMFREEBIES MASTER SAAS LAYOUT CSS
   ========================================================================== */

/* --- 1. FALLBACK THEME --- */
:root {
    --theme-primary: #ff0066;
    --theme-secondary: #8b5cf6;
    --theme-accent: #0ea5e9;
    --theme-bg-gradient: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    --theme-icon-bg: linear-gradient(135deg, rgba(255,0,102,0.1), rgba(139,92,246,0.1));
}

/* --- 2. FULL WIDTH SECTION BACKGROUNDS --- */
.bg-section-white { background-color: #ffffff; }
.bg-section-light { background-color: #f8fafc; border-top: 1px solid #e2e8f0; }
.bg-section-gradient { background: var(--theme-bg-gradient); position: relative; overflow: hidden; }

/* --- 3. CREATIVE TYPOGRAPHY & GRADIENTS --- */
.text-gradient-creative {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary) 50%, var(--theme-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* --- 4. THE APP ZONE --- */
.app-zone-card {
    background: #ffffff; border: none; border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    border-top: 6px solid var(--theme-primary) !important;
    transition: box-shadow 0.3s ease, border-color 0.5s ease;
}

/* --- 5. 1-2-3 STEP CARDS --- */
.step-card {
    background: #ffffff; border: 1px solid #f1f5f9; border-radius: 20px;
    padding: 30px 20px; height: 100%; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative; overflow: hidden;
}
.step-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15); }
.step-icon {
    width: 60px; height: 60px; background: var(--theme-icon-bg);
    color: var(--theme-primary); border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; margin-bottom: 20px;
    transition: transform 0.3s ease, background 0.5s ease, color 0.5s ease;
}
.step-card:hover .step-icon { transform: scale(1.1) rotate(5deg); }

/* --- 6. ZIG-ZAG FEATURE IMAGES --- */
.feature-img-wrapper {
    border-radius: 24px; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    background: #f8fafc; aspect-ratio: 16/9; display: flex; align-items: center; 
    justify-content: center; position: relative; border: 1px solid rgba(0,0,0,0.05);
}
.feature-img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.feature-img-wrapper:hover img { transform: scale(1.03); }

/* --- 7. NATIVE ADSENSE BLOCKS --- */
.native-ad-container {
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 20px;
    padding: 15px; text-align: center; margin: 40px auto; position: relative;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}
.native-ad-container::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, #e2e8f0, #cbd5e1, #e2e8f0);
    border-top-left-radius: 20px; border-top-right-radius: 20px;
}
.ad-label {
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: #94a3b8; display: block; margin-bottom: 10px; font-weight: 700;
}

/* --- 8. FAQ ACCORDION OVERRIDES --- */
.custom-faq .accordion-item { border: none; border-bottom: 1px solid #e2e8f0; background: transparent; }
.custom-faq .accordion-button {
    background: transparent !important; font-weight: 700; color: #0f172a; font-size: 1.1rem;
    padding: 20px 0; box-shadow: none !important;
}
.custom-faq .accordion-button:not(.collapsed) {
    color: var(--theme-primary); background: transparent !important; box-shadow: none !important;
}
.custom-faq .accordion-body { padding: 0 0 25px 0; color: #475569; line-height: 1.8; background: transparent !important; }

/* --- 9. DYNAMIC THEME BUTTONS --- */
.btn-theme { background: var(--theme-bg-gradient); color: #ffffff !important; border: none; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.btn-theme:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.15); }
.btn-outline-theme { border: 2px solid var(--theme-primary); color: var(--theme-primary); background: transparent; font-weight: bold; transition: 0.3s ease; }
.btn-outline-theme.active, .btn-outline-theme:hover { background: var(--theme-bg-gradient); border-color: transparent; color: #ffffff !important; }

/* ==========================================================================
   10. FULL-SCREEN APP SHELL (CANVA-STYLE 3-COLUMN EDITOR)
   ========================================================================== */

/* --- APP MODE TOGGLES --- */
body.app-mode-active { overflow: hidden !important; }
body.app-mode-active footer, body.app-mode-active #landingWrapper { display: none !important; }

/* 🔥 ADD THESE TWO LINES TO FIX THE BLANK SCREEN 🔥 */
#appShellWrapper { display: none; }
body.app-mode-active #appShellWrapper { display: block !important; }

header, .navbar { z-index: 1050; position: relative; }

/* --- THE 3-COLUMN APP SHELL --- */
.app-editor-wrapper {
    display: flex; height: calc(100vh - 70px); width: 100vw;
    background: #f1f5f9; overflow: hidden;
}

/* Column 1: The Icon Sidebar (80px) */
.app-sidebar {
    width: 80px; min-width: 80px; background: #ffffff; border-right: 1px solid #e2e8f0;
    display: flex; flex-direction: column; align-items: center; padding-top: 15px; z-index: 10;
}
.sidebar-btn {
    width: 60px; height: 60px; border-radius: 12px; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; color: #64748b; cursor: pointer; 
    margin-bottom: 10px; transition: 0.2s; font-size: 0.7rem; font-weight: 700;
}
.sidebar-btn i { font-size: 1.2rem; margin-bottom: 4px; }
.sidebar-btn:hover { background: #f8fafc; color: var(--theme-primary); }
.sidebar-btn.active { background: #f3f0ff; color: var(--theme-primary); border: 1px solid var(--theme-primary); }

/* Column 2: The Control Panel (350px) */
.app-controls {
    width: 350px; min-width: 350px; background: #ffffff; border-right: 1px solid #e2e8f0;
    overflow-y: auto; padding: 20px; box-shadow: 5px 0 15px rgba(0,0,0,0.02); z-index: 5;
}
.control-tab { display: none; }
.control-tab.active { display: block; }
.control-section-title { font-size: 0.75rem; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 15px; border-bottom: 1px solid #f1f5f9; padding-bottom: 5px; }

/* SHARED UI CONTROLS */
.form-range { height: 1rem; }
.slider-label { font-size: 0.7rem; font-weight: 700; color: #64748b; text-transform: uppercase; }
.slider-value { font-size: 0.75rem; font-weight: 800; color: var(--theme-primary); background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
.adjustment-row { margin-bottom: 12px; }

.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filter-btn { border: 2px solid #e2e8f0; background: #f8fafc; border-radius: 8px; padding: 8px 5px; font-size: 0.75rem; font-weight: bold; color: #475569; transition: all 0.2s; text-align: center; cursor: pointer; }
.filter-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.filter-btn.active { border-color: var(--theme-primary); background: #f3f0ff; color: var(--theme-primary); }

/* EXTENDED PRO CROP UI */
.crop-group-label { font-size: 0.7rem; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-top: 15px; margin-bottom: 8px; border-bottom: 1px solid #f1f5f9; padding-bottom: 4px; }
.crop-ratio-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ratio-btn-pro { border: 2px solid #e2e8f0; background: #fff; border-radius: 8px; padding: 10px 5px; color: #1e293b; transition: all 0.2s; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ratio-btn-pro:hover { background: #f8fafc; border-color: #cbd5e1; }
.ratio-btn-pro.active { border-color: var(--theme-primary); background: #f3f0ff; color: var(--theme-primary); }
.ratio-btn-pro .ratio-num { font-size: 0.85rem; font-weight: 800; }
.ratio-btn-pro .ratio-label { font-size: 0.6rem; font-weight: 700; color: #64748b; margin-top: 2px; }
.ratio-btn-pro.active .ratio-label { color: var(--theme-primary); }

/* --- COLUMN 3: STRICTLY SEPARATED PREVIEW ZONE & BLACK ACTION BAR --- */
.app-canvas-zone {
    flex-grow: 1; display: flex; flex-direction: column; /* Stacks children vertically */
    background: #e2e8f0; position: relative; overflow: hidden; padding: 0;
    height: 100%; /* Locks the column to exact screen height */
}

/* TOP SECTION: Dark Preview Workspace */
.preview-stage {
    width: 100%; 
    flex: 1 1 auto; /* Grow and shrink automatically to fill space ABOVE the black bar */
    display: flex; align-items: center; justify-content: center;
    position: relative; padding: 30px; background: #f3f3f3;
    overflow: hidden; /* Prevents canvas from breaking layout */
}
.preview-stage canvas, .preview-stage video {
    max-width: 100%; max-height: 100%; object-fit: contain; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.3); border-radius: 8px; background: #000;
}

/* BOTTOM SECTION: The Separated Black Action Bar */
.app-bottom-action-bar {
    width: 100%; 
    height: 80px; 
    flex: 0 0 80px; /* Strictly forces bar to be exactly 80px, it cannot shrink or grow */
    background: #f2f2f2; /* Deep slate/black */
    display: flex; align-items: center; justify-content: center; gap: 15px;
    border-top: 1px solid rgba(255,255,255,0.05); z-index: 20;
}
.saas-action-btn {
    border-radius: 50px; font-weight: 800; padding: 12px 25px; font-size: 0.85rem; 
    border: none; text-transform: uppercase; letter-spacing: 1px; transition: all 0.2s ease; display: flex; align-items: center;
}
.saas-action-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.saas-action-btn-light { background: #f8fafc; color: #1e293b; }
.saas-action-btn-light:hover { background: #e2e8f0; color: #0f172a; }
.saas-action-btn-theme { background: var(--theme-bg-gradient); color: #ffffff; }
.saas-action-btn-theme:hover { box-shadow: 0 10px 20px rgba(139,92,246,0.4); color: #ffffff; }

/* Fullscreen Overlay */
#fullscreenOverlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.98); z-index: 99999; cursor: zoom-out; align-items: center; justify-content: center; flex-direction: column; }
#fullscreenImg { max-width: 95vw; max-height: 90vh; object-fit: contain; box-shadow: 0 20px 50px rgba(0,0,0,0.5); border-radius: 8px; }
.close-fs-btn { position: absolute; top: 20px; right: 30px; color: white; font-size: 2rem; cursor: pointer; transition: 0.2s; }
.close-fs-btn:hover { color: var(--theme-secondary); transform: scale(1.1); }

/* ==========================================================================
   11. MOBILE RESPONSIVENESS (NATIVE APP EXPERIENCE)
   ========================================================================== */
@media (max-width: 991px) {
    .app-editor-wrapper { 
        flex-direction: column; 
        height: calc(100dvh - 70px); 
        position: relative;
        overflow: hidden;
    }
    
    /* 1. Workspace gets 100% of available screen ABOVE the Sidebar Nav */
    .app-canvas-zone { 
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 70px; 
        height: auto;
        flex: unset;
        z-index: 10;
    }

    /* 2. Leave room for the Action Bar inside the Canvas Zone */
    .preview-stage { 
        padding: 10px; 
        height: calc(100% - 70px); 
    }

    /* 3. Action Bar sits cleanly above the Sidebar Icons */
    .app-bottom-action-bar {
        position: absolute;
        bottom: 0; left: 0; width: 100%;
        height: 70px; min-height: 70px;
        padding: 10px 15px; gap: 10px;
        z-index: 20;
    }
    
    /* Makes mobile Action Buttons nice, wide tap-targets */
    .saas-action-btn { 
        padding: 10px 15px; 
        font-size: 0.8rem; 
        flex-grow: 1; 
        border-radius: 12px; 
    }

    /* 4. Sidebar Nav stays fixed at the absolute bottom */
    .app-sidebar { 
        position: absolute;
        bottom: 0; left: 0; width: 100%;
        height: 70px; min-height: 70px;
        flex-direction: row; 
        justify-content: space-around; 
        padding-top: 0; 
        border-right: none; 
        border-top: 1px solid #e2e8f0; 
        background: #ffffff; 
        z-index: 100; 
    }
    .sidebar-btn { width: 100%; height: 100%; margin-bottom: 0; border-radius: 0; border: none !important; border-top: 3px solid transparent !important; }
    .sidebar-btn.active { background: transparent; color: var(--theme-primary); border-top: 3px solid var(--theme-primary) !important; }

    /* 5. The Control Panel becomes a Sliding Bottom Sheet overlay */
    .app-controls { 
        position: absolute;
        bottom: 70px; /* Slides up exactly from the top of the Sidebar */
        left: 0; width: 100%; min-width: 100%;
        height: 50vh; /* Takes half the screen when open so they can still see the video */
        border-right: none; border-top: none; 
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
        padding: 30px 20px 20px 20px;
        z-index: 90; 
        transform: translateY(120%); /* Hidden by default */
        transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    .app-controls.panel-open {
        transform: translateY(0); /* Slides up into view! */
    }

    /* Mobile Swipe-Down/Close Handle */
    .mobile-panel-close {
        position: absolute;
        top: 0; left: 0; right: 0;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 10;
    }
    .mobile-panel-close::before {
        content: '';
        width: 40px; height: 5px;
        background: #cbd5e1;
        border-radius: 10px;
        margin-top: 5px;
    }
}


/* ==========================================================================
   12. TOOL-SPECIFIC OVERRIDES (DUOTONE & VIDEO ENGINES)
   ========================================================================== */

/* Color Picker Inputs */
.form-control-color { 
    height: 40px; padding: 4px; cursor: pointer; border-radius: 8px; 
}

/* Video Preview Container (Fixes Flexbox Collapse) */
#videoPreviewContainer {
    position: relative;
    display: inline-block; /* Shrink-wraps the video so overlay matches perfectly */
    max-width: 100%;
    box-shadow: 0px 8px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    overflow: hidden; 
    line-height: 0; /* Removes weird baseline spacing below video */
}

.preview-stage video#sourceVideo {
    max-height: 65vh !important; /* Overrides the layout.css 100% rule */
    height: auto !important;
    width: auto !important;
    max-width: 100% !important;
    display: block;
    border-radius: 0; 
}

/* Duotone CSS Blend Overlay */
#cssEffectOverlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; /* Lets you click the video controls underneath */
    mix-blend-mode: color;
}


/* ==========================================================================
   13. DEVICE MOCKUP & GLOBAL UI OVERRIDES
   ========================================================================== */

/* Custom Slider Thumbs */
.form-range::-webkit-slider-thumb { background: var(--theme-primary); }
.form-range::-moz-range-thumb { background: var(--theme-primary); }

/* Global Custom Color Picker Styling */
.color-picker-wrapper {
    display: inline-block; 
    padding: 4px; 
    background: #fff;
    border-radius: 50px; 
    border: 2px solid #e2e8f0; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
input[type="color"] {
    -webkit-appearance: none; 
    border: none; 
    width: 50px; 
    height: 50px;
    border-radius: 50%; 
    cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }

/* Device Mockup Specific Video Preview */
#previewVideo {
    max-width: 100%;
    max-height: 65vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    background: #000;
    display: block;
}


/* ==========================================================================
   14. SIDE-BY-SIDE COMPARISON UI (IMAGE TOOLS)
   ========================================================================== */
.split-preview-wrapper {
    display: flex;
    flex-direction: row; 
    width: 100%;
    height: 100%;
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
    background: #f8fafc;
}
.preview-half {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.preview-half canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: grab;
}
.preview-half canvas:active {
    cursor: grabbing;
}
.preview-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 5;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

/* MOBILE RULES: Hide Original, Full Screen Edited */
@media (max-width: 768px) {
    .split-preview-wrapper {
        padding: 0;
        gap: 0;
        display: block; 
    }
    .split-preview-wrapper .preview-half:first-child {
        display: none !important; /* Kills the Original image */
    }
    .split-preview-wrapper .preview-half:last-child {
        width: 100%;
        height: 100%;
        border-radius: 0; /* Forces Edited to take 100% space */
    }
}