/* UXDev Deploy Styles */

/* Override height constraints for proper browser scroll */
html {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

body {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

#app {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

/* TabView styles */

.tabview-header {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    overflow-x: auto;
}

.tab-item {
    padding: 8px 16px;
    background: white;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.tab-item:hover {
    background: #f8f9fa;
}

.tab-item.active {
    background: #e9ecef;
    font-weight: 600;
}

.tab-item .pi-times {
    margin-left: 8px;
    opacity: 0.6;
    font-size: 12px;
}

.tab-item .pi-times:hover {
    opacity: 1;
}

.tabview-content {
    flex: 1;
    position: relative;
    overflow: visible;
}

.tab-panel {
    width: 100%;
    min-height: 100%;
    position: relative;
}

/* Canvas Menu */
.canvas-menu {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.canvas-menu.position-top {
    border-bottom: 1px solid #e5e7eb;
}

.canvas-menu.position-bottom {
    border-top: 1px solid #e5e7eb;
    border-bottom: none;
}

.canvas-menu.position-left {
    flex-direction: column;
    align-items: flex-start;
    border-right: 1px solid #e5e7eb;
    border-bottom: none;
}

.canvas-menu.position-right {
    flex-direction: column;
    align-items: flex-start;
    border-left: 1px solid #e5e7eb;
    border-bottom: none;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.menu-item a:hover {
    background: #f3f4f6;
}

/* Global Menu Display Styles */
.global-menu-display {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.menu-horizontal {
    display: flex;
    align-items: center;
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.menu-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-right: 40px;
    white-space: nowrap;
}

.menu-items {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

/* User Area (Login/Logout) */
.menu-user-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    white-space: nowrap;
    padding: 0 8px;
}

.menu-user-area-vertical {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: auto;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.user-display-name {
    font-size: 13px;
    color: #374151;
}

.user-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #6b7280;
    transition: all 0.2s;
    white-space: nowrap;
}

.user-logout-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.menu-item {
    position: relative;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #374151;
    font-size: 14px;
    transition: all 0.2s;
    border-radius: 6px;
    user-select: none;
}

.menu-item:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.menu-item.active {
    background-color: #e5e7eb;
    color: #1f2937;
}

.menu-item.has-submenu {
    padding-right: 8px;
}

.submenu-indicator {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.2s;
}

.submenu-preview {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 200px;
    z-index: 1001;
    margin-top: 4px;
    padding: 4px 0;
}

.submenu-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #374151;
    font-size: 14px;
    transition: all 0.2s;
}

.submenu-item:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.submenu-item i {
    width: 16px;
    text-align: center;
}

/* Component Container */
.component-wrapper {
    position: absolute;
    box-sizing: border-box;
}

/* Toast 애니메이션 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
}

.toast-container.toast-exit {
    animation: slideOutRight 0.3s ease-out;
}

/* WbxInputForm Styles */
.wbx-input-form {
    width: 100%;
    height: 100%;
    display: flex !important;
    flex-direction: column;
    box-sizing: border-box;
    gap: clamp(0.5rem, 2vw, 1.5rem);
    padding: 0;
    container-type: inline-size;
    background: white;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: auto;
}

/* Canvas editor mode */
.in-canvas-editor.wbx-input-form {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    padding: 0;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: clamp(0.5rem, 2vw, 1rem);
    border-bottom: 1px solid var(--surface-border, #e5e7eb);
}

.form-header h3 {
    margin: 0;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    font-weight: 600;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    height: 100%;
    width: 100%;
    text-align: center;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
}

.form-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: auto;
    padding: 1rem;
    min-height: 0;
}

.form-fields {
    display: grid;
    gap: clamp(0.5rem, 2vw, 1.25rem);
    width: 100%;
}

.layout-1-column {
    grid-template-columns: 1fr;
}

.layout-2-column {
    grid-template-columns: repeat(2, 1fr);
}

.layout-3-column {
    grid-template-columns: repeat(3, 1fr);
}

.layout-inline {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.5rem, 2vw, 1.25rem);
}

.layout-inline .field-wrapper {
    flex: 1 1 clamp(150px, 30%, 300px);
    min-width: 0;
}

.layout-inline .field-wrapper.col-span-2 {
    flex: 1 1 400px;
}

.layout-inline .field-wrapper.col-span-3,
.layout-inline .field-wrapper.col-span-full {
    flex: 1 1 100%;
}

.layout-masonry {
    column-count: 3;
    column-gap: 1rem;
}

.layout-masonry .field-wrapper {
    break-inside: avoid;
    margin-bottom: 1rem;
}

.layout-masonry .field-wrapper.col-span-full {
    column-span: all;
}

.field-wrapper {
    display: flex;
    flex-direction: column;
    gap: clamp(0.125rem, 1vw, 0.375rem);
    min-width: 0;
}

/* Label position variations */
.field-wrapper.label-position-left {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.field-wrapper.label-position-left .field-label {
    min-width: 120px;
    margin-bottom: 0;
}

.field-wrapper.label-position-right {
    flex-direction: row-reverse;
    align-items: center;
    gap: 1rem;
}

.field-wrapper.label-position-right .field-label {
    margin-bottom: 0;
}

.field-wrapper.label-position-floating {
    position: relative;
    padding-top: 0.5rem;
}

.field-wrapper.label-position-floating .field-label {
    position: absolute;
    top: 0;
    left: 0.5rem;
    background: white;
    padding: 0 0.25rem;
    font-size: 0.75rem;
    transform: translateY(-50%);
}

.field-wrapper.col-span-2 {
    grid-column: span 2;
}

.field-wrapper.col-span-3 {
    grid-column: span 3;
}

.field-wrapper.col-span-full {
    grid-column: 1 / -1;
}

.field-label {
    font-weight: 500;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
    color: var(--text-color, #374151);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Canvas editor mode - lighter labels */
.in-canvas-editor .field-label {
    color: rgba(75, 85, 99, 0.8);
    font-weight: 400;
}

.field-label .required {
    color: var(--red-500, #ef4444);
    margin-left: 0.25rem;
}

/* Field input wrapper base styles */
.field-input-wrapper {
    padding: clamp(1px, 0.25vw, 3px);
    width: 100%;
    min-width: 0;
}

/* Normal mode - visible borders */
:not(.in-canvas-editor) .field-input-wrapper input,
:not(.in-canvas-editor) .field-input-wrapper textarea,
:not(.in-canvas-editor) .field-input-wrapper select {
    border: 1px solid #d1d5db;
    border-radius: clamp(2px, 0.5vw, 6px);
    padding: clamp(0.375rem, 1.5vw, 0.75rem);
    width: 100%;
    box-sizing: border-box;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
    min-height: clamp(1.875rem, 4vw, 2.5rem);
}

/* Canvas editor mode - medium gray borders for all fields */
.in-canvas-editor .field-input-wrapper {
    border: none;
    padding: 2px;
    border-radius: 4px;
    background-color: transparent;
}

.in-canvas-editor .field-input-wrapper input,
.in-canvas-editor .field-input-wrapper textarea,
.in-canvas-editor .field-input-wrapper select {
    border: 1px solid #9ca3af; /* Medium gray border */
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: clamp(2px, 0.5vw, 6px);
    padding: clamp(0.375rem, 1.5vw, 0.75rem);
    width: 100%;
    box-sizing: border-box;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
    min-height: clamp(1.875rem, 4vw, 2.5rem);
}

/* Canvas editor mode - slightly darker on hover */
.in-canvas-editor .field-input-wrapper:hover input,
.in-canvas-editor .field-input-wrapper:hover textarea,
.in-canvas-editor .field-input-wrapper:hover select {
    border-color: #6b7280; /* Darker gray on hover */
    background-color: rgba(255, 255, 255, 1);
}

/* Focus states - only in non-edit mode */
:not(.in-canvas-editor) .field-input-wrapper input:focus,
:not(.in-canvas-editor) .field-input-wrapper textarea:focus,
:not(.in-canvas-editor) .field-input-wrapper select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* Disabled interaction in canvas editor */
.in-canvas-editor .field-input-wrapper input,
.in-canvas-editor .field-input-wrapper textarea,
.in-canvas-editor .field-input-wrapper select {
    pointer-events: none;
    cursor: default;
}

.field-error {
    color: var(--red-500, #ef4444);
    font-size: clamp(0.625rem, 1.25vw, 0.875rem);
    margin-top: clamp(0.125rem, 0.5vw, 0.375rem);
}

.field-help {
    color: var(--text-color-secondary, #6b7280);
    font-size: clamp(0.625rem, 1.25vw, 0.875rem);
    margin-top: clamp(0.125rem, 0.5vw, 0.375rem);
}

.form-footer {
    display: flex;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1.25rem);
    padding-top: clamp(0.5rem, 2vw, 1rem);
    margin-top: clamp(0.75rem, 3vw, 1.5rem);
    border-top: 1px solid var(--surface-border, #e5e7eb);
    flex-wrap: wrap;
}

/* Default button styles - make sure they appear correctly */
.wbx-input-form .form-footer button.p-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(0.375rem, 1.5vw, 0.625rem) clamp(0.75rem, 2vw, 1.25rem) !important;
    border-radius: clamp(2px, 0.5vw, 6px);
    font-weight: 500 !important;
    font-size: clamp(0.75rem, 1.5vw, 1rem) !important;
    transition: all 0.2s !important;
    min-width: clamp(60px, 15vw, 100px);
}

/* User-defined button size (overrides responsive !important rules) */
.wbx-input-form .form-footer button.p-button.custom-size {
    width: var(--btn-width, auto) !important;
    height: var(--btn-height, auto) !important;
    min-width: 0 !important;
}

/* Container queries for better responsive behavior */
@container (max-width: 400px) {
    .form-fields {
        grid-template-columns: 1fr !important;
        gap: clamp(0.25rem, 1vw, 0.5rem);
    }

    .form-footer {
        flex-direction: column;
        align-items: var(--footer-align, stretch);
        gap: clamp(0.25rem, 1vw, 0.375rem);
        padding-top: clamp(0.375rem, 1.5vw, 0.625rem);
    }

    .wbx-input-form .form-footer button.p-button {
        min-width: 0 !important;
        font-size: clamp(0.7rem, 1.8vw, 0.8rem) !important;
        padding: clamp(0.3rem, 1.2vw, 0.45rem) clamp(0.5rem, 1.5vw, 0.75rem) !important;
        margin: 0 !important;
    }
}

@container (max-width: 600px) {
    .layout-2-column,
    .layout-3-column {
        grid-template-columns: 1fr !important;
    }

    .field-wrapper.col-span-2,
    .field-wrapper.col-span-3 {
        grid-column: span 1;
    }

    .field-wrapper.label-position-left,
    .field-wrapper.label-position-right {
        flex-direction: column;
        align-items: flex-start;
    }

    .field-wrapper.label-position-left .field-label,
    .field-wrapper.label-position-right .field-label {
        margin-bottom: clamp(0.125rem, 1vw, 0.25rem);
        min-width: unset;
    }

    .form-footer {
        flex-direction: column;
        align-items: var(--footer-align, stretch);
        gap: clamp(0.375rem, 1.5vw, 0.625rem);
    }

    .wbx-input-form .form-footer button.p-button {
        min-width: 0 !important;
        font-size: clamp(0.75rem, 2vw, 0.875rem) !important;
        padding: clamp(0.375rem, 1.5vw, 0.5rem) clamp(0.625rem, 2vw, 0.875rem) !important;
    }
}

/* WbxTree Styles */
.wbx-tree-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.wbx-tree-header {
    padding: 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wbx-tree-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.tree-node:hover {
    background: #f3f4f6;
}

.tree-node.selected {
    background: #e0e7ff;
    color: #3730a3;
}

.tree-node-children {
    margin-left: 20px;
}

/* WbxTreeNode icon styles - IMPORTANT: Required for proper tree node display */
.node-icon {
    color: #666;
    font-size: 16px;
    flex-shrink: 0;
}

.node-expand-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.node-expand-btn:hover {
    color: #333;
}

.node-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.node-content:hover {
    background: #f5f5f5;
}

.node-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    color: #333;
    flex: 1;
}

/* Container Wrapper Styles */
.container-wrapper {
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

/* Container Content Area Styles */
.container-content {
    min-height: 80px;
    position: relative;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
}

/* Flex layout for containers (default for Section/VStack/HStack) */
.container-content.flex-layout {
    display: flex;
    flex-direction: column;
}

/* Absolute layout for free positioning (TabView or when layoutMode='absolute') */
.container-content.absolute-layout {
    position: relative;
}

/* Container Child Component Styles */
/* These styles ensure proper rendering of child components inside Container/Section/VStack/HStack */
.container-child {
    /* Remove margin to let parent control spacing with gap */
    margin: 0;
    /* Position is controlled by inline styles */
    /* Ensure child respects its size */
    box-sizing: border-box;
    overflow: visible;
}

/* Flex layout child components */
.container-content.flex-layout .container-child {
    /* In flex layout, children don't use absolute positioning */
    position: relative;
    /* Width and height are set by inline styles based on child.size */
    /* Ensure child components maintain their size */
    flex-shrink: 0;
    /* Allow width to be controlled by inline styles, not forced to 100% */
    width: auto;
}

/* Absolute layout child components */
.container-content.absolute-layout .container-child {
    /* In absolute layout, children use absolute positioning */
    position: absolute;
    /* Position and size set by inline styles */
}

/* Ensure child components receive events */
/* BUT exclude resize handles and drag handles which need their own z-index */
.container-child > *:not(.child-resize-handles):not(.child-drag-handle):not(.child-mode-info) {
    pointer-events: auto;
    z-index: 1;
    box-sizing: border-box;
}

/* WbxDataGrid Styles */
.wbx-datagrid-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.wbx-datagrid-table {
    width: 100%;
    border-collapse: collapse;
}

.wbx-datagrid-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.wbx-datagrid-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.wbx-datagrid-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.wbx-datagrid-table tbody tr:hover {
    background: #f3f4f6;
}

.wbx-datagrid-table .datagrid-row {
    transition: background-color 0.15s;
}

.wbx-datagrid-paginator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.paginator-buttons {
    display: flex;
    gap: 4px;
}

/* DataTable Custom Styles */
.datatable-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.datatable-toolbar {
    flex-shrink: 0;
}

/* RichTextEditor - Global table styles (unscoped fallback for deploy bundle) */
.rich-html-viewer table,
.tiptap-editor-wrapper .tiptap table,
.tiptap-editor-wrapper .ProseMirror table {
    max-width: 100%;
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.rich-html-viewer td,
.rich-html-viewer th,
.tiptap-editor-wrapper .tiptap td,
.tiptap-editor-wrapper .tiptap th,
.tiptap-editor-wrapper .ProseMirror td,
.tiptap-editor-wrapper .ProseMirror th {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    vertical-align: top;
    line-height: 1.6;
}

.rich-html-viewer th,
.tiptap-editor-wrapper .tiptap th,
.tiptap-editor-wrapper .ProseMirror th {
    font-weight: 600;
    background: #f0fdf4;
}

/* Image Renderer */
.image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-wrapper:hover .image-controls {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .canvas-menu {
        flex-wrap: wrap;
        gap: 12px;
    }

    .tabview-header {
        font-size: 14px;
    }
}

/* PrimeVue 스타일 오버라이드 및 커스터마이징 */
.p-component {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 컴포넌트 배치 개선 */
.dynamic-component-wrapper {
    position: relative;
}

/* Special text component styling */
.special-text-content {
    display: block;
    line-height: 1.5;
}

/* ========================================
   RESPONSIVE / MOBILE / TABLET
   ======================================== */

/* --- Mobile (max-width: 768px) --- */
@media (max-width: 768px) {
    /* Prevent iOS auto-zoom on input focus */
    input, select, textarea {
        font-size: 16px !important;
    }

    /* Safe area for notched devices */
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* DataGrid horizontal scroll on mobile */
    .wbx-datagrid-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .wbx-datagrid-table {
        min-width: 600px;
    }
    .wbx-datagrid-table th,
    .wbx-datagrid-table td {
        padding: 8px 6px;
        font-size: 13px;
    }

    /* Toolbar compact */
    .wbx-toolbar {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 12px;
    }
    .wbx-toolbar .p-button .p-button-label {
        display: none;
    }
    .wbx-toolbar .p-button {
        padding: 8px;
    }

    /* Form single column */
    .form-fields {
        grid-template-columns: 1fr !important;
    }
    .field-wrapper.col-span-2,
    .field-wrapper.col-span-3 {
        grid-column: span 1;
    }
    .field-wrapper.label-position-left {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Card padding reduction */
    .container-wrapper {
        padding: 12px !important;
    }

    /* User area compact */
    .menu-user-area {
        flex-direction: column;
        gap: 4px;
        padding: 8px;
    }

    /* Dialog full width */
    .p-dialog {
        width: 95vw !important;
        max-width: 95vw !important;
    }

    /* Menu hamburger styles */
    .canvas-menu {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
    }

    /* Hamburger menu button */
    .hamburger-btn {
        display: flex !important;
    }

    /* Menu items dropdown on mobile */
    .menu-items {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: stretch;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        z-index: 1001;
        display: none;
        border-top: 1px solid #e5e7eb;
    }
    .menu-items.is-open {
        display: flex;
    }
    .menu-items .menu-item {
        padding: 12px 16px;
        border-bottom: 1px solid #f3f4f6;
    }

    /* Toast position */
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: 100%;
    }

    /* TabView tabs scrollable */
    .tabview-header {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 13px;
    }
    .tab-item {
        padding: 6px 10px;
        font-size: 13px;
    }

    /* ===== CRITICAL: Container responsive rules ===== */

    /* HStack → vertical stack on mobile */
    .container-wrapper[data-type="hstack"] > .container-content,
    .container-wrapper[data-type="hstack"] > .container-content.flex-row,
    [data-component-type="hstack"] .container-content {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }

    /* VStack → ensure children full width on mobile */
    .container-wrapper[data-type="vstack"] > .container-content,
    [data-component-type="vstack"] .container-content {
        flex-wrap: wrap !important;
        width: 100% !important;
    }

    /* All containers: prevent horizontal overflow */
    .container-wrapper,
    .container-content,
    .canvas-component,
    .preview-content,
    .dynamic-component-wrapper {
        max-width: 100vw !important;
        overflow-x: hidden;
    }

    /* All container children: full width on mobile */
    .container-wrapper[data-type="hstack"] > .container-content > *,
    .container-wrapper[data-type="vstack"] > .container-content > *,
    .container-wrapper[data-type="card"] > .container-content > * {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        max-width: 100% !important;
    }

    /* Card children in hstack/vstack: reset flex-basis */
    .container-wrapper[data-type="hstack"] > .container-content > .canvas-component,
    .container-wrapper[data-type="hstack"] > .container-content > .container-wrapper,
    .container-wrapper[data-type="vstack"] > .container-content > .canvas-component,
    .container-wrapper[data-type="vstack"] > .container-content > .container-wrapper {
        flex-basis: 100% !important;
        max-width: 100% !important;
    }

    /* PrimeVue DataTable responsive */
    .p-datatable {
        width: 100% !important;
        overflow: hidden;
    }
    .p-datatable-wrapper,
    .p-datatable-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .p-datatable-table {
        min-width: 500px;
    }
    .p-datatable .p-datatable-thead > tr > th,
    .p-datatable .p-datatable-tbody > tr > td {
        padding: 8px 6px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }

    /* Component inline width override on mobile */
    .canvas-component[style*="width"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Prevent fixed-width components from overflowing */
    .canvas-component {
        min-width: 0 !important;
    }

    /* Page-level overflow prevention */
    .deploy-content {
        overflow-x: hidden !important;
    }
    .deploy-content > * {
        max-width: 100% !important;
    }
}

/* --- Tablet (769px ~ 1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Toolbar compact */
    .wbx-toolbar {
        gap: 8px;
        padding: 8px 16px;
    }

    /* 3-column forms → 2-column */
    .layout-3-column {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Menu hamburger for tablet */
    .hamburger-btn {
        display: flex !important;
    }
    .menu-items {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: stretch;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        z-index: 1001;
        display: none;
        border-top: 1px solid #e5e7eb;
    }
    .menu-items.is-open {
        display: flex;
    }
}

/* --- Touch devices --- */
@media (hover: none) and (pointer: coarse) {
    /* Minimum tap target 44px */
    .menu-item a,
    .submenu-item,
    button,
    .p-button,
    .tab-item,
    .paginator-buttons button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Disable hover effects on touch */
    .menu-item:hover,
    .submenu-item:hover,
    .tree-node:hover,
    .wbx-datagrid-table tbody tr:hover {
        background: inherit;
    }

    /* Hide scrollbars but keep scrollable */
    .wbx-datagrid-container::-webkit-scrollbar,
    .tabview-header::-webkit-scrollbar {
        display: none;
    }
    .wbx-datagrid-container,
    .tabview-header {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* Desktop: hide hamburger by default */
.hamburger-btn {
    display: none;
}