/* =========================================================
   LPS — Unified Design System
   ========================================================= */

/* ---------------- Design Tokens (CSS Custom Properties) --- */
:root {
    /* Colors */
    --primary: #000000;
    --bg-body: #ffffff;
    --bg-sidebar: #fafafa;
    --bg-surface: #f8f9fa;
    --bg-surface-hover: #f1f3f5;
    --bg-muted: #f4f4f4;
    --border: #e2e5e9;
    --border-light: #eef0f2;
    --border-focus: #000000;
    --text-main: #111111;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --text-placeholder: #c0c6cc;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --success: #22c55e;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --fs-2xs: 8px;
    /* tiny labels, counters */
    --fs-xs: 9px;
    /* secondary labels, small buttons */
    --fs-sm: 10px;
    /* main labels, field labels */
    --fs-base: 11px;
    /* body text, section names */
    --fs-md: 12px;
    /* standard inputs, icons */
    --fs-lg: 13px;
    /* modal titles, headings */

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* ---------------- Scrollbar ----------------------------- */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(127, 127, 127, 0.35);
    border-radius: var(--radius-full);
    transition: background var(--duration-normal) ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(127, 127, 127, 0.55);
}



/* ---------------- Base Styles --------------------------- */
body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body, #editor-container {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
}

/* Allow text selection in inputs, textareas, editable content, and explicitly marked selectable elements */
input,
textarea,
[contenteditable="true"],
.selectable,
.ace_editor,
.ace_text-layer {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ---------------- Layout -------------------------------- */
#editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#sidebar {
    width: 320px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
    transition: all var(--duration-slow) var(--ease-smooth);
}

.sidebar-scroll {
    overflow-y: auto;
    flex: 1;
}

#preview-area {
    flex: 1;
    background: var(--bg-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--sp-3) var(--sp-5) 0;
    overflow: hidden;
}

#preview-frame-container {
    position: relative;
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
}

#preview-frame {
    background-color: white !important;
    box-shadow: var(--shadow-lg);
    transition: width 0.4s var(--ease-smooth), transform 0.4s var(--ease-smooth);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    width: 100%;
    min-height: 0;
    flex-shrink: 0;
    transform-origin: top center;
}

/* ---------------- Sitemap ------------------------------- */
.sitemap-area {
    max-height: 400px;
    overflow-y: auto;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    padding: var(--sp-3) var(--sp-4) var(--sp-6);
}

.sitemap-item {
    cursor: pointer;
    transition: all var(--duration-normal) ease;
    font-size: var(--fs-base);
    border: 1px solid var(--border);
    background: white;
    margin-bottom: var(--sp-1);
    border-radius: var(--radius-md);
}

.sitemap-item.active {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1.5px solid var(--primary);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
}

.sitemap-item.disabled {
    opacity: 0.4;
    filter: grayscale(1);
}

.sitemap-branch {
    margin-bottom: 0;
    padding: 0;
}

.sitemap-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sitemap-branch>.sitemap-item {
    margin-bottom: 2px;
}

.sitemap-connector {
    display: none;
}

.sitemap-list .sitemap-list {
    padding-left: 0;
    margin-left: var(--sp-3);
    position: relative;
    margin-top: 0;
    margin-bottom: 0;
}

.sitemap-node {
    position: relative;
    margin: 0;
}

.sitemap-list .sitemap-list>.sitemap-node>.sitemap-item {
    position: relative;
    border-left: 3px solid var(--text-muted);
    border-top-left-radius: var(--sp-1);
    border-bottom-left-radius: var(--sp-1);
}

.sitemap-list .sitemap-list>.sitemap-node>.sitemap-item.active {
    border-left-color: rgba(255, 255, 255, 0.4);
}

.sitemap-node::before,
.sitemap-node::after {
    display: none !important;
}

.sitemap-list .sitemap-list::before {
    display: none !important;
}

.sitemap-actions {
    display: flex;
    opacity: 0;
    transition: opacity var(--duration-normal);
}

.sitemap-item:hover .sitemap-actions {
    opacity: 1;
}

/* ---------------- Drag & Drop Feedback ------------------- */
.sortable-ghost {
    background: var(--bg-surface) !important;
    border: 2px dashed var(--text-dim) !important;
    border-radius: var(--radius-xl);
    opacity: 0.3 !important;
    transform: scale(0.98);
}

.sortable-chosen {
    background: #fff !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    z-index: 100;
    border-color: var(--primary) !important;
}

.sortable-drag {
    opacity: 0.9;
    transform: scale(1.02);
    cursor: grabbing !important;
}

/* ---------------- Buttons (Unified) ---------------------- */
.btn-monotone {
    transition: all var(--duration-normal) ease;
    cursor: pointer;
}

.btn-monotone:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* ---------------- Section Items (Unified) ----------------- */
/* ---------------- Section Items (Managed via Tailwind in SectionItem.js) --- */
.section-item-container {
    transition: all var(--duration-normal);
}

.section-content {
    display: none;
}

.section-item.expanded .section-content {
    display: block;
}

/* ---------------- Modal (Unified) ------------------------- */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#modal-content {
    background: white !important; /* 確実に不透明に */
    padding: 32px;
    border-radius: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1), 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    opacity: 0;
    transition: all var(--duration-slow) var(--ease-smooth);
    border: 1px solid rgba(0,0,0,0.05);
}

#modal-content.modal-wide {
    max-width: 1200px;
    height: 85vh;
    max-height: 85vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#modal-content.modal-wide #modal-title {
    padding: 24px 24px 0 24px;
    margin: 0;
}

#modal-content.modal-wide #modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
}

#modal-content.modal-wide #modal-footer {
    padding: 16px 24px 24px 24px;
}

.gallery-host-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    border-radius: 12px;
}

#modal-overlay.active {
    display: flex;
}

#modal-overlay.active #modal-content {
    transform: translateY(0);
    opacity: 1;
}

/* ---------------- Color Popover (Unified) ----------------- */
.color-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 240px;
    background: white !important;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-4);
    z-index: 500;
    display: none;
}

.color-popover.active {
    display: block;
}

.color-popover.open-up {
    top: auto;
    bottom: calc(100% + 10px);
}

/* Fix stacking context for elements containing active color popover */
.animate-lush-in:has(.color-popover.active),
.list-item-drag:has(.color-popover.active) {
    z-index: 50 !important;
    position: relative !important;
}

.swatch-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.swatch-checkers {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(45deg, #eee 25%, transparent 25%),
        linear-gradient(-45deg, #eee 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eee 75%),
        linear-gradient(-45deg, transparent 75%, #eee 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px 4px, 4px 0;
    z-index: 1;
}

.swatch-color {
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* ---------------- Unified Content Area Header ------------ */
.content-area-header {
    padding: 6px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}

/* デフォルトではモバイル用閉じるボタンは非表示 */
.sidebar-mobile-close-btn {
    display: none;
}

/* ---------------- Responsive ------------------------------ */
@media (min-width: 1025px) {
    #sidebar.closed {
        margin-left: -320px;
    }
}

@media (max-width: 1024px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: calc(280px + 56px);
        max-width: calc(100vw - 40px);
        padding-left: 56px;
        height: 100vh;
        z-index: 400;
        background: rgba(251, 251, 251, 0.6) !important;
        backdrop-filter: blur(40px) saturate(200%);
        -webkit-backdrop-filter: blur(40px) saturate(200%);
        box-shadow: var(--lush-shadow-lg);
        transition: transform var(--duration-slow) var(--ease-smooth), visibility var(--duration-slow);
        display: flex !important;
        flex-direction: column;
    }

    @media (min-width: 640px) {
        #sidebar {
            width: calc(280px + 76px);
            padding-left: 76px;
        }
    }

    #sidebar.hidden {
        transform: translateX(-100%) !important;
        pointer-events: none;
        visibility: hidden;
    }

    #sidebar:not(.hidden) {
        transform: translateX(0);
        visibility: visible;
    }

    #right-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 300px;
        max-width: calc(100vw - 56px - 40px);
        height: 100vh;
        z-index: 400;
        background: var(--bg-body) !important;
        box-shadow: var(--lush-shadow-lg);
        transition: transform var(--duration-slow) var(--ease-smooth), visibility var(--duration-slow);
        display: flex !important;
        flex-direction: column;
    }

    @media (min-width: 640px) {
        #right-sidebar {
            max-width: calc(100vw - 76px - 40px);
        }
    }

    #right-sidebar.hidden {
        transform: translateX(100%) !important;
        pointer-events: none;
        visibility: hidden;
    }

    #right-sidebar:not(.hidden) {
        transform: translateX(0);
        visibility: visible;
    }

    #preview-area {
        padding: 10px;
    }

    #studio-btn-sidebar {
        display: none !important;
    }

    .sidebar-mobile-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
}

/* ---------------- Template Studio Improvements ------------ */
.property-card-content {
    transition: all var(--duration-normal) var(--ease-smooth);
    overflow: hidden;
}

.property-card.collapsed .property-card-content {
    display: none;
}

.property-card.collapsed {
    padding-bottom: 0px !important;
    border-color: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.property-card {
    transition: all var(--transition-normal);
}

.insert-btn {
    opacity: 0.6;
    transition: all var(--duration-normal);
}

.insert-btn:hover {
    opacity: 1;
    color: var(--primary);
    transform: scale(1.1);
}

.variable-item:hover .insert-btn {
    opacity: 1;
}

/* ---------------- Template Studio Layout Controls --------- */
#studio-content {
    transition: all var(--duration-normal) var(--ease-smooth);
}

.studio-sidebar-hidden #sidebar {
    width: 0 !important;
    min-width: 0 !important;
    border: none !important;
    overflow: hidden !important;
}

#template-html-editor {
    height: 100%;
    width: 100%;
    min-height: 100px;
}

.studio-props-hidden #template-variables-panel {
    width: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
}

.studio-preview-hidden #studio-preview-area {
    display: none !important;
}

.studio-preview-full #studio-editor-area {
    display: none !important;
}

.studio-preview-full #studio-preview-area {
    height: 100% !important;
    flex: 1 !important;
}

.layout-btn-active {
    background-color: white !important;
    color: black !important;
    box-shadow: var(--shadow-sm);
}

/* ---------------- Gallery Preview System ----------------- */
.preview-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border-light);
}

.preview-content {
    width: 1440px;
    /* Base rendering width */
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scale(0.25);
    /* Scale down to fit card */
    transform-origin: top center;
    pointer-events: none;
}

#template-variables-list::-webkit-scrollbar {
    width: 4px;
}

#template-variables-list::-webkit-scrollbar-track {
    background: transparent;
}

#template-variables-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

#template-variables-list::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}
/* ---------------- Newt-Inspired CMS Styles ---------------- */
.cms-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.cms-item-row {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-bottom: 12px;
    transition: all var(--duration-normal) var(--ease-smooth);
    cursor: pointer;
}

.cms-item-row:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.cms-status-badge {
    padding: 4px 10px;
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
}

.cms-status-published {
    background: #ecfdf5;
    color: #059669;
}

.cms-status-draft {
    background: #fef3c7;
    color: #d97706;
}

.cms-editor-overlay {
    position: absolute;
    inset: 0;
    background: white;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--duration-slow) var(--ease-smooth);
}

.cms-editor-overlay.active {
    transform: translateY(0);
}

.cms-search-container {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 320px;
    transition: all var(--duration-normal);
}

.cms-search-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.cms-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 11px;
    width: 100%;
    margin-left: 8px;
    font-weight: 600;
}

.cms-field-group {
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.cms-field-label {
    display: block;
    font-size: 10px;
    font-weight: 900;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.cms-field-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1.5px solid transparent;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--duration-normal);
}

.cms-field-input:focus {
    background: white;
    border-color: var(--primary);
    outline: none;
}

/* --- Lush Design System (Premium Uplift) --- */
:root {
    --lush-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --lush-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --lush-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.app-glass {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.app-glass-sidebar {
    background: rgba(251, 251, 251, 0.6) !important;
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
}

.lush-label {
    display: block;
    font-size: 9px;
    font-weight: 900;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 8px;
    line-height: 1;
}

.lush-input {
    width: 100%;
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lush-input:focus {
    background: #ffffff;
    border-color: #000000;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    outline: none;
}

.lush-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--lush-shadow-sm);
}

.lush-card:hover {
    box-shadow: var(--lush-shadow-md);
    transform: translateY(-2px);
    border-color: #e2e8f0;
}

/* Sitemap Item Improved */
.sitemap-item.active {
    background: #ffffff !important;
    box-shadow: var(--lush-shadow-md);
    transform: scale(1.02);
    z-index: 10;
    border: 1px solid #f1f5f9;
}

.sitemap-item {
    border: 1px solid transparent;
}

/* Section Item Improved */
.section-item {
    border: 1px solid #f1f5f9;
    box-shadow: var(--lush-shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.section-item.expanded {
    box-shadow: var(--lush-shadow-lg);
    border-color: #e2e8f0;
}

.section-header {
    padding: 14px 18px;
}

.section-content {
    background: #fcfcfc;
    padding: 24px 20px;
    border-top: 1px solid #f8fafc;
}

/* Animation Utilities */
@keyframes fadeInSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


.animate-lush-in {
    animation: fadeInSlideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Sidebar Tab System */
.sidebar-tabs-container {
    padding: 16px 16px 0 16px;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 30;
}

.sidebar-tabs {
    display: flex;
    background: rgba(241, 245, 249, 0.5);
    padding: 3px;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.sidebar-tab-btn {
    flex: 1;
    padding: 8px 4px;
    text-align: center;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
    border-radius: 11px;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
    user-select: none;
}

.sidebar-tab-btn:hover {
    color: #64748b;
}

.sidebar-tab-btn.active {
    background: white;
    color: black;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.sitemap-item.page-disabled {
    opacity: 0.35 !important;
    filter: grayscale(0.5);
}

.sitemap-item.page-disabled:hover {
    opacity: 0.7 !important;
}

.sitemap-item.active {
    background: white !important;
    box-shadow: var(--lush-shadow-md) !important;
    border: 1px solid #f1f5f9 !important;
}

/* Global Section Zones */
.global-zone {
    background: rgba(248, 250, 252, 0.4);
    border-radius: 20px;
    padding: 12px;
    border: 1px dashed #e2e8f0;
    transition: all var(--duration-normal) var(--ease-smooth);
}

.global-zone:hover {
    background: rgba(248, 250, 252, 0.7);
    border-color: #cbd5e1;
}

.global-badge {
    background: #eff6ff; 
    color: #3b82f6;
    font-size: 8px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 6px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.lush-add-section-btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    background: white;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    color: #94a3b8;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--duration-normal) var(--ease-smooth);
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.lush-add-section-btn:hover {
    background: #f8fafc;
    color: black;
    border-color: #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.lush-add-section-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.zone-label {
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #94a3b8;
}

/* --- Global Nav & Right Sidebar Layouts --- */
.app-global-nav {
    background-color: #09090b !important;
    border-right: 1px solid rgba(63, 63, 70, 0.4) !important;
}

.nav-item-btn {
    color: #a1a1aa;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item-btn.active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

#right-sidebar {
    background: rgba(251, 251, 251, 0.6) !important;
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-left: 1px solid var(--border);
    transition: all var(--duration-slow) var(--ease-smooth);
}

#right-sidebar.hidden {
    display: none !important;
}

#sidebar.hidden {
    display: none !important;
}

/* Animations and tweaks */
@keyframes lushFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-lush-in {
    animation: lushFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Mobile responsive fixes for Database Manager */
@media (max-width: 640px) {
    .cms-item-row .opacity-0 {
        opacity: 1 !important;
    }
}

/* =========================================================
   Template Studio Mobile Responsive Styles (768px未満)
   ========================================================= */
@media (max-width: 767px) {
    /* ヘッダー周りのパディングと非表示化 */
    #studio-editor-overlay header {
        padding-left: 12px !important;
        padding-right: 12px !important;
        gap: 8px;
    }
    #studio-editor-overlay header .h-8.w-px {
        display: none !important;
    }
    #studio-editor-overlay header .flex.items-center.space-x-6 {
        margin-left: 0 !important;
        gap: 4px;
    }
    #studio-editor-overlay header .text-\[10px\] {
        display: none !important; /* モバイル時はタイトル文字列を非表示 */
    }

    /* メインレイアウトを縦方向に強制 */
    #studio-editor-layout {
        flex-direction: column !important;
    }

    /* エディタ上半分のラッパーを画面全体に設定、デフォルト非表示 */
    #studio-editor-top-half {
        flex-direction: column !important;
        display: none !important;
        flex: 1 1 0% !important;
        height: 100% !important;
    }

    /* Ace Editorの表示エリア */
    #studio-editor-top-half > div:first-child {
        display: none !important;
        flex: 1 1 0% !important;
        height: 100% !important;
    }

    /* プロパティパネル */
    #studio-properties-panel {
        display: none !important;
        width: 100% !important;
        border-left: none !important;
        flex: 1 1 0% !important;
        height: 100% !important;
        background-color: #fafafa !important;
    }

    /* プレビューエリア下半分のラッパー */
    #studio-preview-bottom-half {
        display: none !important;
        height: 100% !important;
        width: 100% !important;
        border-top: none !important;
        flex: 1 1 0% !important;
    }

    /* タブ状態（tab-code, tab-props, tab-preview）に応じた表示切り替え */
    #studio-editor-overlay.tab-code #studio-editor-top-half {
        display: flex !important;
    }
    #studio-editor-overlay.tab-code #studio-editor-top-half > div:first-child {
        display: flex !important;
    }

    #studio-editor-overlay.tab-props #studio-editor-top-half {
        display: flex !important;
    }
    #studio-editor-overlay.tab-props #studio-properties-panel {
        display: flex !important;
    }

    #studio-editor-overlay.tab-preview #studio-preview-bottom-half {
        display: flex !important;
    }

    /* モバイルプレビュー内のパディング調整 */
    #studio-preview-frame-container {
        padding: 8px !important;
    }

    /* プロパティのドラッグハンドルの表示調整など */
    .property-card {
        padding: 12px !important;
        border-radius: 16px !important;
    }
}

/* =========================================================
   Mobile Input Zoom Fix (iOS Safari 16px font-size requirement)
   ========================================================= */
@media (max-width: 1024px) {
    /* 16px未満のフォントサイズだとiOSでフォーカス時に自動ズームしてしまうため、16pxに設定 */
    #editor-container input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
    #editor-container select,
    #editor-container textarea,
    #modal-overlay input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
    #modal-overlay select,
    #modal-overlay textarea,
    #dialog-overlay input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]) {
        font-size: 16px !important;
        /* フォントが大きくなった分、高さを圧迫しないようパディングと行高を調整 */
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        line-height: 1.2 !important;
    }
}

/* ---------------- Mobile Modal Overrides ----------------- */
@media (max-width: 767px) {
    .gallery-modal-overlay {
        padding: 0 !important;
    }
    .gallery-modal-content {
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    .gallery-modal-content > div:first-child {
        padding: 8px 12px !important;
    }
    .gallery-modal-content #modal-footer {
        padding: 8px 12px !important;
    }
}

/* ---------------- Hidden Class Utility Override ----------------- */
.hidden {
    display: none !important;
}
