/* Batch Story Creator Styles */

.batch-section {
    padding: 20px;
    background: var(--surface);
    /* Fallback or existing var */
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

/* Step Indicator */
.batch-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0 auto;
    max-width: 300px;
}

.batch-step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.batch-step-dot.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.batch-step-dot.completed {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.batch-step-line {
    flex: 1;
    height: 3px;
    background: var(--border);
    min-width: 40px;
    transition: background 0.3s ease;
}

.batch-step-line.completed {
    background: var(--success);
}

/* Step Actions Container */
.batch-step-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}


.batch-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.batch-child-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    background: var(--surface-elevated);
    /* Use elevated for contrast */
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    animation: fadeIn 0.3s ease-out;
}

.batch-child-row .input-group {
    margin-bottom: 0;
}

.batch-child-row label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: block;
}

/* Enhanced Batch Input Styling */
.batch-section input[type="text"],
.batch-section input[type="number"],
.batch-section select,
.batch-child-row input,
.batch-child-row select {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.batch-section input[type="text"]:hover,
.batch-section input[type="number"]:hover,
.batch-section select:hover,
.batch-child-row input:hover,
.batch-child-row select:hover {
    border-color: var(--primary-light, #a5b4fc);
}

.batch-section input[type="text"]:focus,
.batch-section input[type="number"]:focus,
.batch-section select:focus,
.batch-child-row input:focus,
.batch-child-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: var(--surface-elevated, #fff);
}

.batch-section input::placeholder,
.batch-child-row input::placeholder {
    color: var(--text-tertiary);
}

/* Custom select styling */
.batch-section select,
.batch-child-row select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* Series name input special styling */
#batch-series-name {
    font-size: 16px;
    font-weight: 500;
    padding: 16px 20px;
}


.remove-child-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-child-btn:hover {
    background: #fee2e2;
    /* light red */
    color: #ef4444;
    /* red */
    border-color: #ef4444;
}

.small-tabs .tab-btn {
    padding: 8px 16px;
    font-size: 13px;
}

.small-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.small-grid .story-card {
    border-width: 2px;
}

/* Selection State */
.story-card.selection-card {
    position: relative;
    border-color: var(--border);
}

.story-card.selection-card:hover {
    border-color: var(--primary-light);
    /* Assuming these vars exist */
    border-color: #a5b4fc;
    /* Fallback light indigo */
}

.story-card.selection-card.selected {
    border-color: var(--primary);
    /* Assuming var exists */
    border-color: #6366f1;
    /* Fallback indigo */
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.selection-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.story-card.selection-card:hover .selection-overlay {
    opacity: 0.5;
    transform: scale(1);
}

.story-card.selection-card.selected .selection-overlay {
    opacity: 1;
    transform: scale(1);
    background: #6366f1;
    color: white;
}

.batch-preview-list {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.match-item {
    transition: background 0.2s ease;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.match-item:hover {
    background: var(--surface-hover);
}

.match-item:last-child {
    border-bottom: none !important;
}

/* Dropdown styling */
.select-match {
    padding: 4px 8px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.select-match:focus {
    outline: none;
    border-color: var(--primary);
}

@media (max-width: 640px) {
    .batch-child-row {
        grid-template-columns: 1fr 1fr;
    }

    .batch-child-row .input-group:first-child {
        grid-column: 1 / -1;
    }

    .remove-child-btn {
        grid-column: 2;
        justify-self: end;
    }
}