:root {
    --bg-main: #212121;
    --bg-sidebar: #171717;
    --bg-panel: #2f2f2f;
    --bg-user-msg: #2f2f2f;
    --text-main: #ececec;
    --text-muted: #a1a1aa;
    --border-color: rgba(255, 255, 255, 0.1);
    --accent: #facc15; 
    --chat-font-size: 15px;
}

body.theme-light {
    --bg-main: #ffffff;
    --bg-sidebar: #f9f9f9;
    --bg-panel: #f4f4f4;
    --bg-user-msg: #f4f4f4;
    --text-main: #0f0f0f;
    --text-muted: #606060;
    --border-color: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #555; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #777; }

.app-wrapper { display: flex; width: 100%; height: 100vh; position: relative; }
.mobile-overlay { display: none; }

/* SIDEBAR CHAT */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px;
    box-sizing: border-box;
    transition: width 0.3s ease, padding 0.3s ease;
    border-right: 1px solid var(--border-color);
    position: relative; 
    z-index: 100;
    overflow: hidden; 
    white-space: nowrap; 
}

.menu-btn {
    background: none; border: none; color: var(--text-muted); cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: flex-start; padding: 10px 14px;
    border-radius: 8px; margin-bottom: 20px; width: 100%;
}
.menu-btn:hover { color: var(--text-main); background: rgba(150, 150, 150, 0.1); }

@media (min-width: 769px) {
    .app-wrapper:not(.sidebar-open) .sidebar { width: 76px; padding: 16px 12px; }
    .app-wrapper:not(.sidebar-open) .search-chat-container,
    .app-wrapper:not(.sidebar-open) .history-list { display: none; }
    .app-wrapper:not(.sidebar-open) .new-chat-btn span,
    .app-wrapper:not(.sidebar-open) .library-btn span,
    .app-wrapper:not(.sidebar-open) .settings-sidebar-btn span { display: none; }
    .app-wrapper:not(.sidebar-open) .new-chat-btn,
    .app-wrapper:not(.sidebar-open) .library-btn,
    .app-wrapper:not(.sidebar-open) .settings-sidebar-btn,
    .app-wrapper:not(.sidebar-open) .menu-btn { justify-content: center; padding: 12px 0; margin-bottom: 12px; width: 100%; }
}

.new-chat-btn, .library-btn {
    background-color: transparent; color: var(--text-main); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; cursor: pointer;
    margin-bottom: 6px; font-weight: 500; transition: all 0.2s;
}
.new-chat-btn:hover, .library-btn:hover { border-color: var(--accent); }
.library-btn { margin-bottom: 16px; }
.library-btn.active { background-color: rgba(150, 150, 150, 0.15); border-color: var(--accent); }

.search-chat-container { margin-bottom: 16px; padding: 0; }
.search-chat-container input {
    width: 100%; background-color: var(--bg-panel); border: 1px solid var(--border-color);
    color: var(--text-main); padding: 8px 12px; border-radius: 8px; font-size: 13px;
    box-sizing: border-box; outline: none; transition: border-color 0.2s;
}
.search-chat-container input:focus { border-color: var(--accent); }

.history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 5px; }

.history-item {
    position: relative; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; display: flex;
    justify-content: space-between; align-items: center; color: var(--text-muted); transition: all 0.2s;
}
.history-item:hover { background-color: rgba(150, 150, 150, 0.1); color: var(--text-main); }
.history-item.active { background-color: rgba(150, 150, 150, 0.15); color: var(--text-main); font-weight: 500; }
.history-item .custom-icon { font-size: 16px; margin-right: 6px; flex-shrink: 0; }

.menu-dots-btn {
    opacity: 0; transition: opacity 0.2s; color: var(--text-muted); border: none; background: none; 
    cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; border-radius: 4px;
}
.history-item:hover .menu-dots-btn, .menu-dots-btn.active { opacity: 1; }
.menu-dots-btn:hover { background-color: var(--bg-panel); color: var(--text-main); }

.chat-options-menu {
    position: absolute; right: 10px; top: 35px; background: var(--bg-panel);
    border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: none; flex-direction: column; z-index: 105; min-width: 150px; overflow: hidden;
}
.chat-options-menu.show { display: flex; }
.chat-option-btn {
    background: none; border: none; color: var(--text-main); padding: 10px 12px;
    text-align: left; cursor: pointer; font-size: 13px; transition: background 0.2s; 
    display: flex; align-items: center; gap: 8px;
}
.chat-option-btn:hover { background: rgba(150,150,150,0.15); }
.chat-option-btn.delete { color: #ef4444; }
.chat-option-btn.delete:hover { background: rgba(239, 68, 68, 0.1); }

.pin-icon { width: 12px; height: 12px; margin-right: 6px; color: var(--accent); flex-shrink: 0; }

.settings-sidebar-btn {
    background: transparent; border: none; border-top: 1px solid var(--border-color);
    color: var(--text-muted); padding: 16px 12px 6px 12px; margin-top: 8px;
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    font-size: 14px; font-weight: 500; transition: color 0.2s; width: 100%; text-align: left;
}
.settings-sidebar-btn:hover { color: var(--text-main); }
.settings-sidebar-btn svg { flex-shrink: 0; }

/* CHAT AREA */
.app-container { flex: 1; display: flex; flex-direction: column; height: 100vh; max-width: 900px; margin: 0 auto; width: 100%; background-color: var(--bg-main); transition: background-color 0.3s, max-width 0.3s;}
.app-container.wide-layout { max-width: 100%; }

.mobile-menu-btn { display: none; }
.header { padding: 16px 24px; display: flex; justify-content: center; align-items: center; background-color: var(--bg-main); position: relative; }
.header h1 { font-size: 1.1rem; margin: 0; font-weight: 600; color: var(--text-muted); }

.chat-container { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 32px; scroll-behavior: smooth; }
.message-row { display: flex; gap: 16px; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message-row.user { flex-direction: row-reverse; }

body.hide-avatars .avatar { display: none !important; }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: bold; font-size: 14px; overflow: hidden;}
.bot .avatar { background-color: var(--accent); color: #000; }
.user .avatar { background-color: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border-color); }

.message-column { display: flex; flex-direction: column; max-width: 80%; }
.message-content { line-height: 1.6; font-size: var(--chat-font-size); transition: font-size 0.2s; }
.bot .message-content { padding: 6px 0; }
.user .message-content { background-color: var(--bg-user-msg); padding: 12px 18px; border-radius: 20px; border-top-right-radius: 4px; }

/* ESTILOS DE BURBUJAS DE CHAT */
body.bubble-square .message-content { border-radius: 4px !important; }
body.bubble-modern .message-content { border-radius: 12px 12px 12px 0 !important; box-shadow: 0 4px 15px rgba(0,0,0,0.15); border: 1px solid var(--border-color); }
body.bubble-modern .message-row.user .message-content { border-radius: 12px 12px 0 12px !important; background-color: var(--bg-panel); }

.message-content img { max-width: 100%; border-radius: 8px; display: block; margin-top: 8px; }

/* PANEL DE SCRIPTS */
.code-block-wrapper { background: #1e1e1e; border-radius: 8px; margin: 12px 0; overflow: hidden; border: 1px solid var(--border-color); }
.code-header { display: flex; justify-content: space-between; align-items: center; background: #2d2d2d; padding: 6px 12px; border-bottom: 1px solid #444; }
.code-lang { color: #a1a1aa; font-size: 12px; text-transform: lowercase; font-family: monospace; }
.code-actions { display: flex; gap: 8px; }
.code-btn { background: none; border: none; color: #a1a1aa; cursor: pointer; padding: 4px; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.code-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.code-block-wrapper pre { margin: 0; padding: 16px; background: transparent; color: #d4d4d4; font-size: 13.5px; line-height: 1.5; overflow-x: auto; font-family: monospace; }

.hl-keyword { color: #569cd6; font-weight: bold; } .hl-string { color: #ce9178; } .hl-number { color: #b5cea8; } .hl-comment { color: #6a9955; font-style: italic; }

body.theme-light .code-block-wrapper { background: #f8f9fa; border-color: #e5e7eb; }
body.theme-light .code-header { background: #e5e7eb; border-bottom: 1px solid #d1d5db; }
body.theme-light .code-lang { color: #4b5563; }
body.theme-light .code-btn { color: #4b5563; } body.theme-light .code-btn:hover { background: rgba(0,0,0,0.1); color: #000; }
body.theme-light .code-block-wrapper pre { color: #24292e; }
body.theme-light .hl-keyword { color: #0000ff; } body.theme-light .hl-string { color: #a31515; } body.theme-light .hl-number { color: #098658; } body.theme-light .hl-comment { color: #008000; }

/* IMAGENES */
.generated-image-container { position: relative; display: inline-block; margin-top: 10px; }
.generated-image-container img { max-width: 100%; border-radius: 8px; display: block; }
.download-img-btn { position: absolute; top: 15px; right: 10px; background: rgba(0, 0, 0, 0.6); color: white; border: none; border-radius: 8px; padding: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); transition: background 0.2s; }
.download-img-btn:hover { background: var(--accent); color: black; }
.download-img-btn svg { width: 18px; height: 18px; }

.message-actions { display: flex; gap: 8px; margin-top: 8px; opacity: 0; transition: opacity 0.2s ease; }
.message-row:hover .message-actions { opacity: 1; }
.action-btn { background: transparent; border: none; color: var(--text-muted); font-size: 13px; cursor: pointer; padding: 6px; border-radius: 6px; transition: all 0.2s; display: flex; align-items: center; gap: 6px; }
.action-btn svg { width: 16px; height: 16px; }
.action-btn:hover { background: var(--bg-panel); color: var(--text-main); }
.action-btn.speaking-active { color: var(--accent); } 

.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: auto 0 20px 0; }
.sug-btn { background: var(--bg-panel); border: 1px solid var(--border-color); color: var(--text-muted); padding: 16px; border-radius: 12px; text-align: left; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.sug-btn b { color: var(--text-main); display: block; margin-bottom: 4px; font-size: 15px; }
.sug-btn:hover { border-color: var(--accent); }

/* INPUT */
.input-container { padding: 0 24px 24px 24px; background-color: var(--bg-main); }
.image-preview-container { position: relative; display: inline-block; padding-bottom: 12px; padding-left: 12px; }
.image-preview-container img { height: 65px; border-radius: 8px; border: 2px solid var(--border-color); object-fit: cover; }
.remove-img-btn { position: absolute; top: -5px; right: -5px; background: #ef4444; color: white; border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.3); transition: background 0.2s; }
.remove-img-btn:hover { background: #dc2626; }

.input-box { display: flex; background-color: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 12px; align-items: center; transition: border-color 0.3s; }
.input-box:focus-within { border-color: var(--accent); }
input { flex: 1; background: none; border: none; color: var(--text-main); outline: none; font-size: 15px; padding: 0 10px; }
input[type="range"] { accent-color: var(--accent); width: 180px; cursor: pointer; }

.mic-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 8px; transition: 0.3s; border-radius: 50%; }
.mic-btn:hover { color: var(--text-main); background: rgba(150,150,150,0.1); }
.mic-btn.listening { color: #ef4444; animation: pulse 1.5s infinite; background: rgba(239, 68, 68, 0.1); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

button#sendBtn { background: var(--text-main); color: var(--bg-main); border: none; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; margin-left: 8px; transition: 0.2s; }
button#sendBtn:hover { background: var(--accent); }
.disclaimer { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 12px; }

/* MODALES */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 999; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.modal-content.dual-pane { display: flex; width: 700px; height: 480px; background: var(--bg-main); border-radius: 12px; overflow: hidden; box-shadow: 0 15px 40px rgba(0,0,0,0.4); border: 1px solid var(--border-color); }
.settings-sidebar { width: 230px; background-color: var(--bg-panel); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; padding: 16px; }
.settings-header-left { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.close-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.close-btn:hover { background: rgba(150,150,150,0.1); color: var(--text-main); }
.settings-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-tab { background: transparent; border: none; color: var(--text-muted); padding: 12px 14px; border-radius: 8px; text-align: left; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 10px; transition: 0.2s; }
.nav-tab:hover { background: rgba(150,150,150,0.1); color: var(--text-main); }
.nav-tab.active { background: rgba(150,150,150,0.15); color: var(--text-main); font-weight: 500; }
.settings-content { flex: 1; padding: 32px 40px; overflow-y: auto; }
.pane-title { margin-top: 0; margin-bottom: 24px; font-size: 1.2rem; font-weight: 500; border-bottom: 1px solid var(--border-color); padding-bottom: 16px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border-color); }
.setting-row label { font-size: 14px; color: var(--text-main); font-weight: 400; }
.setting-row select { background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border-color); padding: 8px 12px; border-radius: 6px; outline: none; cursor: pointer; font-size: 14px; width: 180px; }
.setting-row input[type="color"] { width: 40px; height: 30px; cursor: pointer; background: none; border: none; padding: 0; border-radius: 4px; }
.btn-danger { background: transparent; border: 1px solid #ef4444; color: #ef4444; padding: 10px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; transition: 0.2s; width: 100%; font-weight: 500;}
.btn-danger:hover { background: #ef4444; color: white; }

.modal-content.lot-modal { background: var(--bg-main); border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 15px 40px rgba(0,0,0,0.4); color: var(--text-main); }
.lot-field-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.lot-field-group label { font-size: 14px; font-weight: 500; color: var(--text-main); }
.lot-field-group input[type="text"], .lot-field-group textarea { background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border-color); padding: 10px 12px; border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.2s; font-family: inherit; }
.lot-field-group input[type="text"]:focus, .lot-field-group textarea:focus { border-color: var(--accent); }
.btn-purple { background: #9333ea; color: white; border: none; padding: 10px 16px; border-radius: 8px; font-weight: bold; cursor: pointer; font-size: 14px; transition: background 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-purple:hover { background: #7e22ce; }

/* EXPLORADOR DE LOTS */
.explorer-container { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; background-color: var(--bg-main); transition: background-color 0.3s; }
.explorer-header-top { display: flex; justify-content: center; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.btn-create-lot { background: var(--text-main); color: var(--bg-main); padding: 12px 24px; border-radius: 8px; font-weight: bold; cursor: pointer; border: none; font-size: 15px; transition: transform 0.2s, opacity 0.2s; }
.btn-create-lot:hover { transform: translateY(-2px); opacity: 0.9; }
.explorer-search-wrapper { max-width: 600px; margin: 0 auto; width: 100%; }
.explorer-search-wrapper input { width: 100%; box-sizing: border-box; background-color: var(--bg-panel); border: 1px solid var(--border-color); color: var(--text-main); padding: 12px 16px; border-radius: 8px; outline: none; font-size: 15px; transition: border-color 0.3s; }
.explorer-search-wrapper input:focus { border-color: var(--accent); }

.explorer-section-title { font-size: 1.2rem; font-weight: bold; margin: 20px 0 10px 0; color: var(--text-main); }
.explorer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.lot-card { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; transition: transform 0.2s, border-color 0.2s; cursor: pointer; }
.lot-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.lot-card-header { display: flex; align-items: center; gap: 15px; }
.lot-card-icon { font-size: 32px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--bg-main); border-radius: 50%; overflow: hidden; }
.lot-card-title { font-size: 16px; font-weight: bold; color: var(--text-main); margin: 0; }
.lot-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lot-card-footer { display: flex; justify-content: flex-end; align-items: center; margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.05); font-size: 12px; color: var(--text-muted); }
.lot-join-btn { background: rgba(147, 51, 234, 0.2); color: #c084fc; border: 1px solid rgba(147, 51, 234, 0.5); padding: 6px 12px; border-radius: 12px; font-weight: bold; font-size: 12px; transition: all 0.2s; }
.lot-card:hover .lot-join-btn { background: #9333ea; color: white; border-color: #9333ea; }

/* BIBLIOTECA */
.library-container { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; background-color: var(--bg-main); }
.library-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.library-header h2 { margin: 0; color: var(--text-main); font-weight: 500; font-size: 1.5rem; }
.library-header input { flex: 1; max-width: 300px; background-color: var(--bg-panel); border: 1px solid var(--border-color); color: var(--text-main); padding: 10px 14px; border-radius: 8px; outline: none; transition: border-color 0.3s; }
.library-header input:focus { border-color: var(--accent); }
.library-tabs { display: flex; gap: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.lib-tab { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 8px 16px; border-radius: 6px; font-weight: 500; transition: 0.2s; font-size: 14px; }
.lib-tab:hover { color: var(--text-main); background: rgba(150,150,150,0.1); }
.lib-tab.active { background: rgba(150,150,150,0.15); color: var(--text-main); }

.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.lib-item { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.2s; cursor: pointer; }
.lib-item:hover { transform: translateY(-4px); border-color: var(--accent); }
.lib-item-img { width: 100%; height: 160px; object-fit: cover; background: #000; }
.lib-item-info { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.lib-item-name { color: var(--text-main); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; }
.lib-item-meta { color: var(--text-muted); font-size: 12px; display: flex; justify-content: space-between; }

/* COMPARTIR MODAL */
.share-modal-content { background: #181818; border-radius: 16px; padding: 24px; width: 90%; max-width: 480px; color: #fff; display: flex; flex-direction: column; gap: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid #333; }
.share-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; padding-bottom: 16px; }
.share-header h3 { margin: 0; font-size: 1.2rem; font-weight: 500; color: #fff; text-transform: capitalize; }
.close-share-btn { background: transparent; border: none; color: #aaa; font-size: 1.2rem; cursor: pointer; transition: color 0.2s; }
.close-share-btn:hover { color: #fff; }
.share-image-container { display: flex; justify-content: center; }
.share-image-container img { width: 250px; height: 250px; border-radius: 12px; object-fit: cover; box-shadow: 0 4px 15px rgba(0,0,0,0.4); }
.share-actions { display: flex; justify-content: center; gap: 30px; margin-top: 10px; }
.share-action-item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.share-round-btn { width: 52px; height: 52px; border-radius: 50%; background: #fff; color: #000; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.2s; }
.share-round-btn:hover { transform: scale(1.08); }
.share-round-btn svg { width: 22px; height: 22px; fill: currentColor; }
.share-action-item span { font-size: 12px; color: #ccc; font-weight: 500; }

/* ==================================================== */
/* NUEVO STUDIO DE EDICIÓN (TIPO CANVA/FIGMA)           */
/* ==================================================== */
.editor-layout { width: 95%; height: 95vh; max-width: 1400px; background: var(--bg-main); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,0.6); border: 1px solid var(--border-color); }
.editor-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border-color); }
.editor-header h3 { margin: 0; color: var(--text-main); font-size: 16px; display: flex; align-items: center; gap: 8px; }
.editor-body { display: flex; flex: 1; overflow: hidden; }

/* Sidebar Principal del Studio */
.editor-sidebar { width: 80px; background: var(--bg-sidebar); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; padding: 15px 0; gap: 10px; z-index: 10; }
.ed-tool-btn { background: transparent; border: none; color: var(--text-muted); width: 64px; height: 64px; border-radius: 8px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; cursor: pointer; transition: all 0.2s; }
.ed-tool-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.ed-tool-btn.active { background: var(--bg-panel); color: var(--accent); }
.ed-tool-btn span { font-size: 11px; font-weight: 500; }

/* Panel de Opciones Secundario */
.editor-options-panel { width: 280px; background: var(--bg-panel); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; z-index: 5; }
.ed-panel { padding: 20px; display: none; flex-direction: column; gap: 15px; height: 100%; overflow-y: auto; }
.ed-panel.active { display: flex; }
.ed-panel h4 { margin: 0 0 5px 0; font-size: 14px; color: var(--text-main); border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }

/* Campos del Studio */
.ed-field-group { display: flex; flex-direction: column; gap: 6px; }
.ed-field-group.row { flex-direction: row; align-items: center; gap: 15px; }
.ed-field-group label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.ed-input, .ed-select { width: 100%; background: var(--bg-main); color: var(--text-main); border: 1px solid var(--border-color); padding: 8px 10px; border-radius: 6px; font-size: 13px; outline: none; box-sizing: border-box; transition: border-color 0.2s; }
.ed-input:focus, .ed-select:focus { border-color: var(--accent); }
.ed-color-picker { width: 100%; height: 35px; padding: 0; border: none; background: none; cursor: pointer; border-radius: 6px; }
input[type="range"] { -webkit-appearance: none; width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; outline: none; margin: 8px 0; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.ed-hint { font-size: 11px; color: var(--text-muted); font-style: italic; margin-top: 5px; line-height: 1.4; }

/* Canvas Area */
.editor-canvas-area { flex: 1; background: #0f0f0f; display: flex; justify-content: center; align-items: center; padding: 30px; overflow: auto; background-image: radial-gradient(circle at center, #2a2a2a 0%, #0f0f0f 100%); }
.editor-canvas-area canvas { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,0.5); cursor: grab; transition: transform 0.2s; }
.editor-canvas-area canvas:active { cursor: grabbing !important; }

/* MÓVILES */
@media (max-width: 768px) {
    .sidebar { position: fixed; top: 0; left: 0; width: 280px !important; height: 100vh; z-index: 2000; transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
    .app-wrapper.sidebar-open .sidebar { transform: translateX(0); }
    .mobile-menu-btn { display: flex; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 6px; }
    .mobile-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); z-index: 1999; backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity 0.3s; }
    .app-wrapper.sidebar-open .mobile-overlay { display: block; opacity: 1; visibility: visible; }
    .header { justify-content: space-between; }
    .header h1 { position: absolute; left: 50%; transform: translateX(-50%); }

    .modal-content.dual-pane { flex-direction: column; width: 90%; height: 80%; }
    .settings-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); flex-direction: row; align-items: center; padding: 12px; overflow-x: auto;}
    .settings-header-left { border: none; margin: 0; padding: 0; margin-right: 16px; }
    .settings-nav { flex-direction: row; }
    .suggestions { grid-template-columns: 1fr; }
    .message-actions { opacity: 1; }
    .share-actions { gap: 15px; }
    .share-round-btn { width: 46px; height: 46px; }
    .modal-content.lot-modal { width: 95% !important; height: 90vh !important; }

    /* EDITOR EN MÓVIL */
    .editor-layout { width: 100%; height: 100%; border-radius: 0; border: none; }
    .editor-body { flex-direction: column-reverse; }
    .editor-sidebar { width: 100%; flex-direction: row; justify-content: center; padding: 10px; border-right: none; border-top: 1px solid var(--border-color); height: auto; }
    .ed-tool-btn { width: 70px; height: 60px; }
    .editor-options-panel { width: 100%; flex: 1; max-height: 250px; border-right: none; border-top: 1px solid var(--border-color); }
    .editor-canvas-area { flex: 2; padding: 10px; }
}