/* --- GLOBAL STYLES & NEUMORPHIC-INSPIRED THEME --- */
:root {
    --bg-color: #e0e5ec;
    --bg-panel: #e0e5ec;
    --text-primary: #333;
    --text-secondary: #555;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --danger-color: #dc3545;
    --border-color: #d1d9e6;
    --shadow-light: #ffffff;
    --shadow-dark: #a3b1c6;
    --main-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    --inset-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; } /* Removed overflow: hidden */

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Set overflow on body */
}

:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* --- MAIN LAYOUT --- */
.app-container { display: flex; flex-direction: column; height: 100%; }
.header-bar { display: flex; align-items: center; padding: 0 20px; height: 60px; background-color: var(--bg-panel); box-shadow: var(--main-shadow); z-index: 100; flex-shrink: 0; }
.logo-title { font-size: 1.5rem; font-weight: 600; color: var(--accent-color); margin-right: auto; }
.page-tabs-container { flex-grow: 1; margin-left: 20px; overflow-x: auto; height: 100%; }
.page-tabs { display: flex; list-style: none; height: 100%; align-items: flex-end; }
.page-tab { padding: 10px 15px; cursor: grab; border-top-left-radius: 8px; border-top-right-radius: 8px; margin-right: 2px; border: 1px solid transparent; border-bottom: none; background-color: #d1d9e6; box-shadow: 3px 3px 6px #a3b1c6, -3px -3px 6px #ffffff; display: flex; align-items: center; gap: 8px; }
.page-tab.active-tab { background-color: var(--bg-color); box-shadow: none; position: relative; top: 1px; }
.tab-name { white-space: nowrap; }
.close-tab-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-secondary); line-height: 1; }
.add-page-btn { font-size: 1.8rem; cursor: pointer; margin: 0 10px; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; box-shadow: var(--main-shadow); flex-shrink: 0; }
.add-page-btn:active { box-shadow: var(--inset-shadow); }
.global-actions { display: flex; align-items: center; gap: 10px; }

.main-content { position: relative; display: flex; flex-grow: 1; overflow: hidden; }
.inspector-panel { width: 380px; flex-shrink: 0; background-color: var(--bg-panel); padding: 25px; overflow-y: auto; box-shadow: var(--main-shadow); transition: transform 0.3s ease-in-out; }
.preview-panel { flex-grow: 1; display: flex; justify-content: center; align-items: flex-start; padding: 30px; overflow: auto; position: relative; }
.preview-canvas-wrapper { transform-origin: top left; } /* Changed for better zooming */
.preview-canvas { background: white; box-shadow: 0 10px 30px rgba(0,0,0,0.2); position: relative; overflow: hidden; }

/* --- UI ELEMENTS (BUTTONS, INPUTS) --- */
.btn { padding: 10px 20px; border: none; border-radius: 8px; background-color: var(--bg-panel); box-shadow: var(--main-shadow); cursor: pointer; font-weight: 600; transition: box-shadow 0.1s ease-in-out; text-align: center; }
.btn:disabled { cursor: not-allowed; opacity: 0.6; box-shadow: var(--inset-shadow); }
.btn:not(:disabled):active { box-shadow: var(--inset-shadow); }
.btn-primary { background-color: var(--accent-color); color: white; }
.btn-primary:not(:disabled):active { background-color: var(--accent-hover); box-shadow: var(--inset-shadow); }

.dropdown { position: relative; display: inline-block; }
/* Dropdown content is hidden by default */
.dropdown-content { display: none; position: absolute; background-color: var(--bg-panel); min-width: 180px; box-shadow: var(--main-shadow); z-index: 101; border-radius: 8px; right: 0; overflow: hidden; }
/* Show dropdown when parent has .is-active class (JS controlled) */
.dropdown.is-active .dropdown-content { display: block; }

.dropdown-content a { color: var(--text-primary); padding: 12px 16px; text-decoration: none; display: flex; align-items: center; gap: 10px; } /* Flex for icon alignment */
.dropdown-content a:hover { background-color: #d1d9e6; }
.dropdown-content a svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }

/* Styles from previous steps... */
#inspector-panel h2, #inspector-panel h3 { margin-bottom: 15px; color: var(--text-secondary); font-weight: 600; }
#inspector-panel h2 { font-size: 1.2rem; margin-top: 10px; }
#inspector-panel h3 { font-size: 1rem; margin-top: 25px; }
.inspector-group { margin-bottom: 25px; }
.inspector-group label { display: block; margin-bottom: 10px; font-weight: 500; color: var(--text-secondary); }
.inspector-group input, .inspector-group select, .inspector-group textarea { width: 100%; padding: 12px; border: none; border-radius: 8px; background-color: var(--bg-panel); box-shadow: var(--inset-shadow); }
textarea { min-height: 80px; resize: vertical; }
.inspector-group-actions { display: flex; gap: 10px; }
.inspector-panel .btn { padding: 9px 15px; flex-grow: 1; }
#inspector-panel hr { border: none; height: 2px; background-color: transparent; box-shadow: var(--inset-shadow); margin: 35px 0; }

/* --- RESPONSIVE & MOBILE --- */
.mobile-only { display: none; }

.mobile-header-actions { align-items: center; gap: 5px; }
.mobile-icon-btn { background: none; border: none; padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--main-shadow); }
.mobile-icon-btn:active { box-shadow: var(--inset-shadow); }
.mobile-icon-btn svg { color: var(--text-secondary); }
.mobile-page-switcher { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-color: var(--bg-panel); border: none; box-shadow: var(--inset-shadow); border-radius: 8px; padding: 8px 28px 8px 12px; font-weight: 500; max-width: 150px; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 8px center; background-size: 1em; }
.close-inspector-btn { position: absolute; top: 15px; right: 15px; z-index: 1; }

@media (max-width: 800px) {
    body { overflow-y: auto; } /* Allow scrolling for zoom */
    .desktop-only { display: none; }
    .mobile-only { display: flex; }
    .logo-title { margin-right: auto; font-size: 1.2rem; }
    .main-content { flex-direction: column; overflow: visible; }
    .inspector-panel { position: fixed; top: 0; left: 0; width: 80vw; max-width: 320px; height: 100%; z-index: 1500; transform: translateX(-100%); }
    .inspector-panel.is-open { transform: translateX(0); }
    .preview-panel { width: 100%; height: auto; padding: 15px; overflow: visible; } /* Allow zoom overflow */
    
    /* Redesigned mobile menu */
    .dropdown .dropdown-content {
        position: fixed;
        top: 65px;
        right: 10px;
        width: 75vw;
        max-width: 300px;
    }
}