:root {
    --primary: #0f91bd;
    --primary-hover: #0d82aa;
    --bg-light: #f7f7f8;
    --text-dark: #111618;
    --border-color: #e2e8f0;

    /* Editor Dark Theme */
    --editor-bg: #0f172a;
    --sidebar-bg: #1e1e1e;
    --sidebar-border: #333;
    --sidebar-text: #e0e0e0;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.hidden {
    display: none !important;
}

/* --- Editor Overlay --- */
.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.editor-header {
    height: 60px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: #fff;
    flex-shrink: 0;
}

.header-left,
.header-center,
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-center {
    gap: 10px;
}

.divider {
    width: 1px;
    height: 20px;
    background: #444;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-hover);
}

.btn.secondary {
    background: #333;
    color: #fff;
    border: 1px solid #444;
}

.btn.secondary:hover {
    background: #444;
}

.btn.sm {
    padding: 6px 12px;
    font-size: 12px;
}

.device-btn {
    background: transparent;
    border: none;
    color: #666;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
}

.device-btn:hover {
    color: #ccc;
    background: #333;
}

.device-btn.active {
    color: var(--primary);
    background: rgba(15, 145, 189, 0.1);
}

/* Workspace */
/* Workspace */
.editor-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    flex-direction: row;
    /* Explicit row */
}

.editor-canvas-area {
    flex: 1;
    background: #0f172a;
    display: flex;
    justify-content: center;
    /* Keep centered for smaller device views */
    align-items: flex-start;
    /* Start from top */
    padding: 0;
    /* REMOVED padding for edge-to-edge */
    overflow: auto;
    position: relative;
}

/* New Sidebar Class for non-fixed */
.right-sidebar-panel {
    width: 320px;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    flex-shrink: 0;
}

.dark .right-sidebar-panel {
    background: #18181b;
    /* zinc-900 */
    border-color: #27272a;
    /* zinc-800 */
}

.canvas-wrapper {
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: white;
    transition: max-width 0.3s ease;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.canvas-frame {
    width: 100%;
    height: 100%;
}

/* --- Bottom AI Bar --- */
.bottom-ai-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90%;
    z-index: 2050;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Context Indicator (e.g. "Editing: Header") */
.ai-context-indicator {
    background: rgba(30, 30, 30, 0.9);
    color: #aaa;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid #333;
    align-self: center;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.ai-context-indicator span {
    color: #fff;
    font-weight: 600;
}

.btn-icon-xs {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

.btn-icon-xs:hover {
    color: #fff;
}


.ai-input-wrapper {
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.ai-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 10px 50px rgba(15, 145, 189, 0.2);
    transform: translateY(-2px);
}

.ai-icon {
    color: var(--primary);
    font-size: 20px;
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        opacity: 0.8;
        text-shadow: 0 0 10px rgba(15, 145, 189, 0.5);
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 20px rgba(15, 145, 189, 0.9);
    }
}

.ai-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    outline: none;
    padding: 8px 0;
}

.ai-input-wrapper input::placeholder {
    color: #666;
}

.btn-send-ai {
    background: var(--primary);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-send-ai:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.btn-send-ai span {
    font-size: 18px;
}


/* --- Floating Toolbar (Redesigned) --- */
.floating-toolbar {
    position: absolute;
    z-index: 9999;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.2s, top 0.2s, left 0.2s;
}

.ft-btn {
    background: transparent;
    border: none;
    color: #ccc;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.ft-btn:hover {
    background: #444;
    color: #fff;
}

.ft-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.ft-btn.ai-trigger {
    color: var(--primary);
}

.ft-btn.ai-trigger:hover {
    background: rgba(15, 145, 189, 0.2);
}

.ft-divider {
    width: 1px;
    height: 16px;
    background: #555;
    margin: 0 4px;
}

.ft-btn span {
    font-size: 18px;
}

/* Tooltip on hover */
.ft-btn::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #000;
    color: #fff;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.ft-btn:hover::after {
    opacity: 1;
}



/* Inputs & Controls (Legacy Support for Modals if any) */
.input-full,
.input-sm,
.color-input,
textarea,
select {
    background: #333;
    border: 1px solid #444;
    color: #fff;
    border-radius: 4px;
    padding: 8px;
    font-size: 13px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.input-full:focus,
.input-sm:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
}


/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

.close-btn-success {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.link-box {
    background: #f0f9ff;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    word-break: break-all;
    color: var(--primary);
    font-weight: 500;
    font-size: 14px;
    text-align: center;
}

.hidden-control {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- AI Chat & Status Overlays --- */
.ai-chat-history {
    display: none;
    /* User requested to NOT show chat over screen */
}

.ai-status {
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    margin-bottom: 10px;
    align-self: center;
    /* Center in the flex column of bottom-ai-bar */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-status.hidden {
    display: none !important;
}