/* --- Bot Cards Grid --- */
.bot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.bot-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.bot-card:hover {
    box-shadow: var(--shadow-md);
}
.bot-card-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--border-light);
    flex-shrink: 0;
}
.bot-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.bot-card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Filters */
.bot-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.bot-filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--border-light);
    border-radius: var(--radius);
    padding: 3px;
}
.bot-filter-tab {
    padding: 6px 14px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition);
}
.bot-filter-tab:hover {
    color: var(--text);
}
.bot-filter-tab.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.bot-search {
    width: 200px;
    font-size: 0.8rem;
}
.bot-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}
.bot-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.bot-card-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.bot-card-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.bot-card-actions {
    display: flex;
    gap: 8px;
}

.bot-card-embed-panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.embed-row label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 4px;
}

.embed-code-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
}

.embed-code-inline code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.embed-code-inline .btn {
    flex-shrink: 0;
}

/* --- Wizard / Multi-step --- */
.wizard {
    max-width: 800px;
    margin: 0 auto;
}

.wizard-steps {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
    padding: 0 20px;
}

.wizard-step {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
}

.wizard-step-indicator {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--border-light);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    flex-shrink: 0;
    border: 2px solid var(--border);
    z-index: 1;
    transition: all var(--transition);
}

.wizard-step.active .wizard-step-indicator {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.wizard-step.completed .wizard-step-indicator {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.wizard-step.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.wizard-step-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}
.wizard-step.active .wizard-step-label {
    color: var(--primary);
    font-weight: 500;
}
.wizard-step.completed .wizard-step-label {
    color: var(--success);
}

.wizard-step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 8px;
}
.wizard-step.completed + .wizard-step .wizard-step-line,
.wizard-step.completed .wizard-step-line {
    background: var(--success);
}

.wizard-content {
    min-height: 400px;
}

.wizard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* --- Video Preview in Wizard --- */
.preview-container {
    background: var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.preview-widget {
    width: 360px;
    max-width: 100%;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* --- Sortable list (videos in wizard) --- */
.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sortable-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.sortable-item-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 1.25rem;
}
.sortable-item-thumb {
    width: 80px;
    height: 45px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}
.sortable-item-thumb img,
.sortable-item-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sortable-item-info {
    flex: 1;
    min-width: 0;
}
.sortable-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sortable-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.sortable-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* --- Position Selector --- */
.position-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 220px;
}
.position-option {
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.position-option:hover {
    border-color: var(--text-muted);
}
.position-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

/* --- Color Picker --- */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.color-picker-wrap input[type="color"] {
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    background: none;
}
.color-picker-wrap input[type="text"] {
    width: 120px;
}

/* --- Code snippet / Embed --- */
.code-snippet {
    position: relative;
    background: #1E1B4B;
    border-radius: var(--radius);
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: #E0E7FF;
    overflow-x: auto;
    line-height: 1.6;
}
.code-snippet .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.code-snippet .copy-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .bot-grid {
        grid-template-columns: 1fr;
    }
    .bot-filters {
        flex-direction: column;
        gap: 10px;
    }
    .bot-search {
        width: 100%;
    }
    .embed-code-inline {
        flex-direction: column;
        align-items: stretch;
    }
    .embed-code-inline code {
        white-space: normal;
        word-break: break-all;
    }
    .wizard-steps {
        overflow-x: auto;
        padding-bottom: 24px;
    }
    .wizard-step-label {
        display: none;
    }
}

/* --- Downgrade grace period --- */
.downgrade-banner {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    color: #92400E;
    font-size: 0.875rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.bot-card-dimmed {
    opacity: 0.5;
    border-color: #E5E7EB;
}
.bot-card-dimmed:hover {
    opacity: 0.7;
}

.bot-card-keep {
    padding: 0 16px 12px;
}
