/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #e4e4e7;
    overflow: hidden;
}

/* Top Navigation Bar */
.editor-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 16px;
    background: #16161a;
    border-bottom: 1px solid #2d2d3a;
}

.nav-left, .nav-center, .nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    font-weight: 600;
    font-size: 16px;
    color: #fff;
}

/* Device Buttons */
.device-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #71717a;
    cursor: pointer;
    transition: all 0.2s;
}

.device-btn:hover {
    background: #2d2d3a;
    color: #e4e4e7;
}

.device-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* Navigation Buttons */
.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #2d2d3a;
    border-radius: 6px;
    color: #a1a1aa;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.nav-btn:hover {
    background: #2d2d3a;
    color: #e4e4e7;
}

.nav-btn.primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.nav-btn.primary:hover {
    background: #2563eb;
}

.nav-btn.nav-btn-live {
    background: #059669;
    border-color: #059669;
    color: #fff;
}

.nav-btn.nav-btn-live:hover {
    background: #047857;
}

.nav-btn.nav-btn-coming-soon {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}

.nav-btn.nav-btn-coming-soon:hover {
    background: #b45309;
}

.divider {
    width: 1px;
    height: 24px;
    background: #2d2d3a;
    margin: 0 4px;
}

/* Main Editor Container */
.editor-container {
    display: flex;
    height: calc(100vh - 50px);
}

/* Panels */
.panel-left, .panel-right {
    width: 260px;
    background: #16161a;
    border-right: 1px solid #2d2d3a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-right {
    width: 320px;
    border-right: none;
    border-left: 1px solid #2d2d3a;
}

.panel-header {
    display: flex;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid #2d2d3a;
}

.panel-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #71717a;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.panel-tab:hover {
    background: #2d2d3a;
    color: #e4e4e7;
}

.panel-tab.active {
    background: #2d2d3a;
    color: #fff;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Style Mode Toggle */
.style-mode-toggle {
    display: flex;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid #2d2d3a;
}

.mode-btn {
    flex: 1;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #2d2d3a;
    border-radius: 4px;
    color: #71717a;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: #2d2d3a;
    color: #e4e4e7;
}

.mode-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* Guided Styles Panel */
.guided-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guided-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guided-section label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #71717a;
    letter-spacing: 0.5px;
}

/* Color Presets */
.color-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.color-preset {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-preset:hover {
    transform: scale(1.1);
}

.color-preset.active {
    border-color: #fff;
}

/* Heading Level Buttons */
.heading-level-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.heading-level-btn {
    padding: 8px 4px;
    background: #374151;
    color: #9ca3af;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}

.heading-level-btn:hover {
    background: #4b5563;
    color: #fff;
}

.heading-level-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #60a5fa;
}

/* Gradient Presets */
.gradient-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.gradient-preset {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #71717a;
}

.gradient-preset:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.gradient-preset.active {
    border-color: #fff;
}

.gradient-preset svg {
    opacity: 0.7;
}

.gradient-preset:hover svg {
    opacity: 1;
}

/* Size/Spacing/Radius/Thickness Presets */
/* Hide GrapesJS default panel buttons and views that conflict with our custom UI */
.gjs-pn-views,
.gjs-pn-views-container,
.gjs-pn-commands {
    display: none !important;
}

/* Ensure the GrapesJS editor fills all available width */
.gjs-editor-cont {
    width: 100% !important;
}

.gjs-cv-canvas {
    width: 100% !important;
    left: 0 !important;
}

.alignment-presets {
    display: flex;
    gap: 4px;
}

.alignment-preset {
    flex: 1;
    padding: 8px 4px;
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    border-radius: 4px;
    color: #a1a1aa;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s;
}

.alignment-preset:hover {
    background: #3f3f46;
    color: #e4e4e7;
}

.alignment-preset.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.size-presets, .spacing-presets, .radius-presets, .thickness-presets {
    display: flex;
    gap: 4px;
}

.size-preset, .spacing-preset, .radius-preset, .thickness-preset {
    flex: 1;
    padding: 8px 4px;
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    border-radius: 4px;
    color: #a1a1aa;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
}

.size-preset:hover, .spacing-preset:hover, .radius-preset:hover, .thickness-preset:hover {
    background: #3f3f46;
    color: #e4e4e7;
}

.size-preset.active, .spacing-preset.active, .radius-preset.active, .thickness-preset.active,
.font-preset.active, .weight-preset.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* Font Presets */
.font-presets, .weight-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.font-preset, .weight-preset {
    flex: 1;
    min-width: calc(50% - 2px);
    padding: 8px 4px;
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    border-radius: 4px;
    color: #a1a1aa;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
}

.font-preset:hover, .weight-preset:hover {
    background: #3f3f46;
    color: #e4e4e7;
}

/* Guided Input */
.guided-input {
    width: 100%;
    padding: 10px 12px;
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    color: #e4e4e7;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.guided-input:focus {
    border-color: #3b82f6;
}

.guided-input::placeholder {
    color: #71717a;
}

/* Link Options */
.link-options {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #a1a1aa;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

/* HTML Editor */
.html-editor-textarea {
    width: 100%;
    padding: 10px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 6px;
    color: #f3f4f6;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    min-height: 150px;
}

.html-editor-textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.guided-button {
    padding: 8px 16px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.guided-button:hover {
    background: #2563eb;
}

.guided-button.secondary {
    background: #374151;
}

.guided-button.secondary:hover {
    background: #4b5563;
}

/* No Selection Message */
.no-selection-text {
    text-align: center;
    color: #71717a;
    font-size: 13px;
    padding: 20px 10px;
}

/* Context Sections */
.context-section {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Canvas Area */
.editor-canvas {
    flex: 1;
    background: #0f0f14;
    overflow: hidden;
}

#gjs {
    height: 100%;
    border: none;
}

/* GrapesJS Overrides */
.gjs-one-bg {
    background-color: #16161a;
}

.gjs-two-color {
    color: #e4e4e7;
}

.gjs-three-bg {
    background-color: #2d2d3a;
}

.gjs-four-color, .gjs-four-color-h:hover {
    color: #3b82f6;
}

/* Blocks styling */
.gjs-block {
    width: auto;
    min-height: auto;
    padding: 12px;
    margin: 4px;
    border-radius: 6px;
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    transition: all 0.2s;
}

.gjs-block:hover {
    background: #3f3f46;
    border-color: #3b82f6;
}

.gjs-block-label {
    font-size: 11px;
    color: #a1a1aa;
}

.gjs-block svg {
    fill: #a1a1aa;
}

/* Canvas frame */
.gjs-frame-wrapper {
    background: #0f0f14;
}

.gjs-cv-canvas {
    background: #1a1a2e;
}

/* Selected component */
.gjs-selected {
    outline: 2px solid #3b82f6 !important;
    outline-offset: -2px;
}

/* Toolbar */
.gjs-toolbar {
    background: #16161a;
    border-radius: 6px;
    border: 1px solid #2d2d3a;
}

.gjs-toolbar-item {
    padding: 6px 8px;
    color: #a1a1aa;
}

.gjs-toolbar-item:hover {
    color: #3b82f6;
}

/* Rich Text Editor */
.gjs-rte-toolbar {
    background: #16161a;
    border: 1px solid #2d2d3a;
    border-radius: 6px;
}

.gjs-rte-action {
    color: #a1a1aa;
    border-right: 1px solid #2d2d3a;
}

.gjs-rte-action:hover {
    color: #3b82f6;
}

/* Layers */
.gjs-layer {
    background: transparent;
    font-size: 13px;
}

.gjs-layer:hover {
    background: #2d2d3a;
}

.gjs-layer.gjs-selected {
    background: #3b82f6;
}

/* Style Manager */
.gjs-sm-sector {
    border-bottom: 1px solid #2d2d3a;
}

.gjs-sm-sector-title {
    background: #16161a;
    color: #e4e4e7;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid #2d2d3a;
}

.gjs-sm-property {
    padding: 8px 0;
}

.gjs-sm-label {
    color: #a1a1aa;
    font-size: 11px;
}

.gjs-field {
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    border-radius: 4px;
    color: #e4e4e7;
}

.gjs-field:focus-within {
    border-color: #3b82f6;
}

.gjs-field input {
    color: #e4e4e7;
}

/* Buttons in style manager */
.gjs-sm-btn {
    background: #2d2d3a;
    border-radius: 4px;
    color: #a1a1aa;
}

.gjs-sm-btn:hover {
    background: #3f3f46;
    color: #e4e4e7;
}

.gjs-sm-btn.gjs-sm-btn-active {
    background: #3b82f6;
    color: #fff;
}

/* Trait Manager */
.gjs-trt-trait {
    padding: 10px 12px;
    margin-bottom: 4px;
}

.gjs-trt-trait__wrp-label {
    color: #a1a1aa;
    font-size: 11px;
    margin-bottom: 6px;
}

/* Trait buttons (like Apply Video) */
.gjs-trt-trait button {
    width: 100%;
    padding: 10px 16px;
    margin-top: 8px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.gjs-trt-trait button:hover {
    background: #2563eb;
}

/* Save Status Indicator */
.save-status {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #16161a;
    border: 1px solid #2d2d3a;
    border-radius: 20px;
    font-size: 12px;
    color: #a1a1aa;
    z-index: 100;
    transition: all 0.3s;
}

.save-status.saving {
    border-color: #f59e0b;
}

.save-status.saving .status-dot {
    background: #f59e0b;
    animation: pulse 1s infinite;
}

.save-status.saved .status-dot {
    background: #10b981;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

::-webkit-scrollbar-track {
    background: #16161a;
}

::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}

/* Block Categories */
.gjs-blocks-c {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.gjs-block-category {
    width: 100%;
}

.gjs-title {
    background: transparent;
    color: #71717a;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px 8px;
    border-bottom: none;
}

/* Component Highlight on Hover */
.gjs-comp-selected {
    outline: 2px solid #3b82f6 !important;
}

.gjs-hovered {
    outline: 1px dashed #6366f1 !important;
}

/* Resizer */
.gjs-resizer-h {
    border: 2px solid #3b82f6;
    border-radius: 2px;
}

/* Badge */
.gjs-badge {
    background: #3b82f6;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Placeholder */
.gjs-placeholder {
    border: 2px dashed #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Row and Cell Styles in Editor */
.gjs-frame .row {
    min-height: 50px;
}

.gjs-frame .cell {
    outline: 1px dashed rgba(59, 130, 246, 0.3);
    min-height: 50px;
    transition: outline-color 0.2s;
}

.gjs-frame .cell:hover {
    outline-color: rgba(59, 130, 246, 0.6);
}

/* Block Category Styling */
.gjs-block-category .gjs-title {
    background: #1e1e24;
    border-bottom: 1px solid #2d2d3a;
}

/* Block icons */
.gjs-block .fa {
    font-size: 28px;
    color: #a1a1aa;
}

.gjs-block:hover .fa {
    color: #3b82f6;
}

/* Hide GrapesJS default device buttons (we use our own custom ones) */
.gjs-pn-devices-c {
    display: none !important;
}

/* Also hide the device dropdown if present */
.gjs-devices-c {
    display: none !important;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #1e1e24;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    padding: 6px 0;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    animation: contextMenuFadeIn 0.15s ease;
}

.context-menu.visible {
    display: block;
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: #e4e4e7;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: #2d2d3a;
}

.context-menu-item svg {
    flex-shrink: 0;
    color: #a1a1aa;
}

.context-menu-item:hover svg {
    color: #e4e4e7;
}

.context-menu-item span:first-of-type {
    flex: 1;
}

.context-menu-item .shortcut {
    font-size: 11px;
    color: #71717a;
    margin-left: auto;
}

.context-menu-item.danger {
    color: #ef4444;
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.context-menu-item.danger svg {
    color: #ef4444;
}

.context-menu-item.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.context-menu-divider {
    height: 1px;
    background: #3f3f46;
    margin: 6px 0;
}

/* Pages Panel */
.pages-header {
    margin-bottom: 12px;
}

.add-page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.add-page-btn:hover {
    background: #2563eb;
}

.pages-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-item:hover {
    background: #3f3f46;
}

.page-item.active {
    background: #3b82f6;
    border-color: #3b82f6;
}

.page-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #a1a1aa;
}

.page-item.active .page-item-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.page-item-info {
    flex: 1;
    min-width: 0;
}

.page-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #e4e4e7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-item.active .page-item-name {
    color: #fff;
}

.page-item-slug {
    font-size: 11px;
    color: #71717a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-item.active .page-item-slug {
    color: rgba(255, 255, 255, 0.7);
}

.page-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

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

.page-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #a1a1aa;
    cursor: pointer;
    transition: all 0.2s;
}

.page-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e4e4e7;
}

.page-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.page-item.active .page-action-btn {
    color: rgba(255, 255, 255, 0.7);
}

.page-item.active .page-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Page Settings Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.2s;
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: #1e1e24;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    padding: 24px;
    width: 400px;
    max-width: 90vw;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.visible .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #e4e4e7;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #71717a;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #2d2d3a;
    color: #e4e4e7;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #a1a1aa;
}

.form-group input {
    padding: 10px 12px;
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    color: #e4e4e7;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #3b82f6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-secondary {
    background: #2d2d3a;
    color: #e4e4e7;
}

.modal-btn-secondary:hover {
    background: #3f3f46;
}

.modal-btn-primary {
    background: #3b82f6;
    color: #fff;
}

.modal-btn-primary:hover {
    background: #2563eb;
}

.modal-btn-danger {
    background: #dc2626;
    color: #fff;
}

.modal-btn-danger:hover {
    background: #b91c1c;
}

/* ==========================================
   Background Image Controls
   ========================================== */

.bg-image-controls {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.guided-select {
    flex: 1;
    padding: 8px 12px;
    background: #2d2d3a;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    color: #e4e4e7;
    font-size: 13px;
    cursor: pointer;
}

.guided-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.guided-btn-primary,
.guided-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.guided-btn-primary {
    background: #3b82f6;
    color: #fff;
}

.guided-btn-primary:hover {
    background: #2563eb;
}

.guided-btn-secondary {
    background: #2d2d3a;
    color: #e4e4e7;
}

.guided-btn-secondary:hover {
    background: #3f3f46;
}

/* ==========================================
   Overlay Controls
   ========================================== */

.overlay-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.overlay-color-row {
    display: flex;
    gap: 6px;
}

.opacity-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.opacity-label {
    font-size: 12px;
    color: #a1a1aa;
    min-width: 50px;
}

.opacity-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #3f3f46;
    border-radius: 3px;
    cursor: pointer;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.opacity-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.opacity-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.opacity-value {
    font-size: 12px;
    color: #e4e4e7;
    min-width: 35px;
    text-align: right;
}

/* ==========================================
   Navigation Link Controls
   ========================================== */

.nav-links-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.nav-links-controls .guided-btn-primary,
.nav-links-controls .guided-btn-secondary {
    flex: 1;
}

.nav-links-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #2d2d3a;
    border-radius: 6px;
}

.nav-link-text {
    font-size: 13px;
    color: #e4e4e7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.nav-link-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #71717a;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-link-delete:hover {
    background: #ef4444;
    color: #fff;
}

.no-links-msg {
    font-size: 12px;
    color: #71717a;
    text-align: center;
    padding: 12px;
}

/* ==========================================
   Export Modal
   ========================================== */

.export-modal {
    width: 500px;
}

.export-description {
    font-size: 14px;
    color: #a1a1aa;
    line-height: 1.6;
    margin-bottom: 20px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: #2d2d3a;
    border-radius: 8px;
}

.export-pages-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #3f3f46;
    border-radius: 8px;
}

.export-page-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #3f3f46;
}

.export-page-item:last-child {
    border-bottom: none;
}

.export-page-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.export-page-icon {
    width: 32px;
    height: 32px;
    background: #3b82f6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.export-page-name {
    font-weight: 500;
    color: #e4e4e7;
}

.export-page-file {
    font-size: 12px;
    color: #71717a;
}

#export-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#export-download svg {
    flex-shrink: 0;
}

/* Assets Grid */
.assets-grid {
    max-height: calc(100vh - 250px);
}

.assets-grid > div:hover {
    border-color: #3b82f6 !important;
}

/* Head Elements */
#head-elements-container textarea {
    font-family: 'Source Code Pro', monospace;
    font-size: 12px;
}

/* Panel tab overflow for many tabs */
.panel-header {
    flex-wrap: nowrap;
    overflow-x: auto;
}

.panel-tab {
    white-space: nowrap;
    font-size: 12px;
}

/* ==========================================
   Asset Management System
   ========================================== */

/* Asset Grid Items */
.asset-grid-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #2d2d3a;
    cursor: pointer;
    aspect-ratio: 1;
    background: #16161a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.asset-grid-item:hover {
    border-color: #3b82f6;
}

.asset-grid-item .asset-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: rgba(0,0,0,0.75);
    font-size: 10px;
    color: #e4e4e7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-grid-item .asset-icon {
    text-align: center;
    color: #71717a;
}

.asset-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    border: none;
    color: #fff;
    width: 20px;
    height: 20px;
    min-height: 20px !important;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
}

.asset-grid-item:hover .asset-delete-btn,
.asset-list-item:hover .asset-delete-btn {
    opacity: 1;
}

.asset-delete-btn:hover {
    background: #ef4444;
}

/* Asset List Items (CSS/JS) */
.asset-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #2d2d3a;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s;
    position: relative;
}

.asset-list-item:hover {
    border-color: #3b82f6;
}

.asset-list-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.asset-list-name {
    font-size: 12px;
    color: #a1a1aa;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Drop Zone */
.asset-drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(59, 130, 246, 0.1);
    border: 2px dashed #3b82f6;
    border-radius: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone-text {
    text-align: center;
    color: #3b82f6;
    font-size: 14px;
    font-weight: 500;
}

/* Asset Browser Modal */
.asset-browser-tabs {
    display: flex;
    border-bottom: 1px solid #2d2d3a;
    padding: 0 16px;
}

.asset-tab {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #71717a;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: auto !important;
}

.asset-tab:hover {
    color: #e4e4e7;
}

.asset-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.asset-browser-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: min-content;
    gap: 10px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.asset-browser-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #2d2d3a;
    cursor: pointer;
    aspect-ratio: 1;
    background: #16161a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.asset-browser-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.asset-browser-item:hover {
    border-color: #3b82f6;
    transform: scale(1.02);
}

.asset-browser-item-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    background: rgba(0,0,0,0.8);
    font-size: 11px;
    color: #e4e4e7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Deploy Modal */
.deploy-info {
    background: #16161a;
    border: 1px solid #2d2d3a;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
}

.deploy-info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.deploy-info-row span:first-child {
    color: #71717a;
}

.deploy-info-row span:last-child {
    color: #e4e4e7;
    font-family: 'Source Code Pro', monospace;
    font-size: 12px;
}

.deploy-status {
    margin-top: 16px;
    padding: 16px;
    background: #16161a;
    border: 1px solid #2d2d3a;
    border-radius: 8px;
}

.deploy-progress-bar {
    height: 6px;
    background: #2d2d3a;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.deploy-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.deploy-status-text {
    font-size: 12px;
    color: #a1a1aa;
    line-height: 1.5;
}

/* ==========================================
   Template Browser (now in modal)
   ========================================== */

#templates-browser-modal .modal {
    width: 80vw;
    max-width: 1200px;
    max-height: 85vh;
    overflow: hidden;
}

#templates-browser-modal .modal-body {
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

.templates-browser {
    padding: 0;
    height: auto;
    overflow: visible;
}

.templates-filter {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.template-filter-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #2d2d3a;
    border-radius: 6px;
    color: #71717a;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.template-filter-btn:hover {
    background: #2d2d3a;
    color: #e4e4e7;
}

.template-filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

.template-card {
    border: 1px solid #2d2d3a;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: #1e1e2a;
}

.template-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

.template-card-thumb {
    width: 100%;
    height: 140px;
    display: block;
    object-fit: cover;
    background: #16161a;
}

.template-card-info {
    padding: 12px;
}

.template-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #e4e4e7;
    margin-bottom: 4px;
}

.template-card-desc {
    font-size: 11px;
    color: #71717a;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.template-tag {
    padding: 2px 8px;
    background: #2d2d3a;
    border-radius: 4px;
    font-size: 10px;
    color: #a1a1aa;
}

.template-card-colors {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.template-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
}
