/* ===== Mobile-first ===== */

.canvas-wrap {
    flex: 1 1 auto;
}

.canvas-stage {
    padding: var(--space-3);
}

.ad-banner {
    /* Visible on mobile too: responsive height, in the normal flex flow above
       the bottom toolbar so it never overlaps or squeezes the canvas. */
    display: flex;
    height: clamp(50px, 8vh, 90px);
}

.props-panel {
    display: none;
}

.tools-panel {
    display: none;
}

.bottom-toolbar {
    display: flex;
}

/* Header sizing for small screens */
@media (max-width: 420px) {
    /* Brand stays visible: compact the header instead of hiding the name. */
    .app-header {
        padding: 0 var(--space-2);
        gap: var(--space-1);
    }
    .header-brand {
        gap: var(--space-1);
    }
    .brand-mark {
        width: 24px;
        height: 24px;
    }
    .brand-name {
        font-size: var(--font-size-md);
    }
    .header-actions {
        gap: var(--space-1);
    }
    .header-actions .btn-icon {
        width: 36px;
        height: 36px;
    }
    .header-actions .btn-accent {
        padding: 0 var(--space-2);
        font-size: var(--font-size-sm);
    }
    /* Arabic tab labels are longer than English: shrink so all six fit. */
    .bottom-tool {
        font-size: 11px;
        gap: 2px;
        padding: 0 2px;
    }
}

@media (min-width: 768px) {
    .tools-panel {
        display: flex;
    }
}

/* ===== Tablet / Desktop ===== */

@media (min-width: 1024px) {
    .tools-panel {
        display: flex;
        flex: 0 0 96px;
    }

    .props-panel {
        display: block;
    }

    .bottom-toolbar {
        display: none;
    }

    .bottom-sheet {
        display: none;
    }

    .sheet-backdrop {
        display: none;
    }

    .canvas-stage {
        padding: var(--space-6);
    }

    .ad-banner {
        display: flex;
        height: 72px;
    }

    .toast {
        bottom: calc(var(--ad-height) + var(--space-4));
    }
}

/* Large desktop: wider property panel */
@media (min-width: 1400px) {
    .props-panel {
        flex-basis: 320px;
    }

    .tools-panel {
        flex-basis: 104px;
    }
}

/* Landscape mobile - reflow a little */
@media (max-height: 520px) and (orientation: landscape) {
    .app-header {
        height: 48px;
    }

    .bottom-toolbar {
        height: 52px;
    }
}

/* Empty state button responsiveness */
@media (min-width: 600px) {
    #btnEmptyAddImage {
        width: auto;
        max-width: 280px;
    }
}

@media (min-width: 1024px) {
    #btnEmptyAddImage {
        max-width: 260px;
    }
}

/* Touch targets on touch devices */
@media (pointer: coarse) {
    .tool-btn,
    .bottom-tool {
        min-height: var(--touch-min);
    }
}

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