/* Bot Editor styles */

.bot-editor-layout {
    display: flex;
    gap: 24px;
}
.bot-editor-main { flex: 1; min-width: 0; }
.bot-editor-aside { width: 320px; flex-shrink: 0; }

@media (max-width: 1024px) {
    .bot-editor-layout { flex-direction: column; }
    .bot-editor-aside { width: 100%; }
}
@media (max-width: 768px) {
    .bp-style-row { flex-wrap: wrap; }
    .bp-position-grid { width: 100%; max-width: 160px; }
    .bp-orient-row { flex-wrap: wrap; }
    .bp-color-presets { gap: 6px; }
    .bp-color-dot { width: 28px; height: 28px; }
    .button-row { flex-wrap: wrap; }
    .wizard-nav { flex-direction: column; gap: 8px; }
    .tabs { overflow-x: auto; flex-wrap: nowrap; }
    .tab-btn { white-space: nowrap; font-size: 0.8rem; }
}

/* Video items */
.video-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    background: #fff;
}

.video-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.video-item-header:hover { background: #F9FAFB; }

.video-item-header .drag-handle {
    color: #D1D5DB;
    cursor: grab;
    font-size: 1rem;
}

.video-item-header .thumb {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    background: #E5E7EB;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-item-header .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-item-header .video-name {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
}

.video-item-header .video-name:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
}

.video-item-header .video-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.video-item-buttons {
    padding: 12px 14px;
    border-top: 1px solid #F3F4F6;
    background: #FAFBFF;
}

/* Button row */
.button-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    flex-wrap: wrap;
    border-bottom: 1px solid #F3F4F6;
}

.button-row:last-child { border-bottom: none; }

.button-row .form-input,
.button-row select {
    font-size: 0.8rem;
    padding: 5px 8px;
}

/* --- Reusable Preview Component --- */
.bot-preview-panel {
    position: sticky;
    top: 80px;
}

.bot-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #F3F4F6;
    border-radius: 12px;
}

.bot-preview-phone {
    width: 240px;
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid #D1D5DB;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.bot-preview-phone.horizontal {
    width: 340px;
}
.bot-preview-phone.square {
    width: 300px;
}

.bot-preview-screen {
    aspect-ratio: 9/16;
    position: relative;
    overflow: hidden;
    background: #E5E7EB;
}

.bot-preview-phone.horizontal .bot-preview-screen {
    aspect-ratio: 16/9;
}
.bot-preview-phone.square .bot-preview-screen {
    aspect-ratio: 1/1;
}

.bot-preview-screen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
    color: #9CA3AF;
}

.bot-preview-placeholder span { font-size: 2rem; }
.bot-preview-placeholder small { font-size: 0.7rem; }

.bot-preview-btns {
    position: absolute;
    bottom: 12px;
    left: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.bot-preview-btn-toggle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.bot-preview-btn-toggle:hover { opacity: 0.85; }

.bot-preview-btn-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

.bot-preview-phone.horizontal .bot-preview-btn-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.bot-preview-phone.horizontal .bot-preview-btn-list .bot-preview-btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    max-width: 60%;
    justify-self: center;
}

.bot-preview-btn {
    padding: 7px 10px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: transform 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.bot-preview-btn:hover { transform: translateY(-1px); }

.bot-preview-branding {
    padding: 5px;
    text-align: center;
    font-size: 0.55rem;
    color: #9CA3AF;
    background: #F9FAFB;
    border-top: 1px solid #E5E7EB;
}

.bot-preview-bubble {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    margin-top: 8px;
    align-self: flex-end;
    overflow: hidden;
}

.bot-preview-bubble-logo {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.bot-preview-videos {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.bot-preview-video-thumb {
    width: 40px;
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid #E5E7EB;
    cursor: pointer;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #9CA3AF;
}

.bot-preview-video-thumb.active {
    border-color: var(--primary);
}

.bot-preview-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Branding accordion */
.branding-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.branding-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    background: #FAFBFF;
    user-select: none;
}

.branding-section-header:hover { background: #F3F4F6; }

.branding-section-body {
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* Position grid */
.position-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    max-width: 180px;
}

.position-option {
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.15s;
}

.position-option.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary);
}

/* Branding: color presets */
.bp-color-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.bp-color-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.bp-color-dot:hover { transform: scale(1.1); }
.bp-color-dot.selected { border-color: var(--text); transform: scale(1.15); }

/* Branding: button style */
.bp-style-row {
    display: flex;
    gap: 10px;
}
.bp-style-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 72px;
}
.bp-style-option:hover { border-color: var(--text-muted); }
.bp-style-option.selected { border-color: var(--primary); background: rgba(79,70,229,0.05); }
.bp-style-option span { font-size: 0.72rem; color: var(--text-secondary); font-weight: 500; }
.bp-style-preview { width: 48px; height: 20px; }

/* Branding: position grid */
.bp-position-grid {
    position: relative;
    width: 160px;
    height: 100px;
    background: var(--border-light);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: default;
}
.bp-pos-dot {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.bp-pos-dot:hover { background: var(--text-secondary); transform: scale(1.15); }
.bp-pos-dot.active { background: var(--primary); box-shadow: 0 0 0 4px rgba(79,70,229,0.25); }
.bp-pos-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: capitalize;
    white-space: nowrap;
}

/* Branding: orientation */
.bp-orient-row {
    display: flex;
    gap: 10px;
}
.bp-orient-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.bp-orient-option:hover { border-color: var(--text-muted); }
.bp-orient-option.selected { border-color: var(--primary); background: rgba(79,70,229,0.05); }
.bp-orient-option.disabled { opacity: 0.5; cursor: not-allowed; }
.bp-orient-option span { font-size: 0.72rem; color: var(--text-secondary); font-weight: 500; }
.bp-orient-icon {
    border: 2px solid var(--text-muted);
    border-radius: 3px;
}
.bp-orient-v { width: 20px; height: 32px; }
.bp-orient-sq { width: 26px; height: 26px; }
.bp-orient-h { width: 32px; height: 20px; }

/* Upgrade hint */
.upgrade-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Embed code block */
.embed-code-block {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #F3F4F6;
    border-radius: 6px;
    font-size: 0.78rem;
}

.embed-code-block code {
    flex: 1;
    word-break: break-all;
    font-size: 0.72rem;
}

/* Hint box */
.hint {
    padding: 10px 14px;
    background: #F9FAFB;
    border-radius: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 12px;
}

/* Button style selector */
.btn-style-option {
    text-align: center;
    cursor: pointer;
    padding: 6px;
    border: 2px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.15s;
    flex: 1;
    max-width: 80px;
}

.btn-style-option.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.btn-style-option small {
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Wizard nav */
.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}
