/* ===========================================
   SEGMENT BUILDER STYLES
   Phase 4 - SOS Storytelling
   =========================================== */

.sb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sb-modal {
    background: white;
    border-radius: 16px;
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.sb-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px 24px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sb-header h2 {
    margin: 0;
    font-size: 1.2em;
}

.sb-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.sb-body {
    padding: 24px;
}

/* Logic toggle */
.sb-logic-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.sb-logic-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background: white;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
}

.sb-logic-btn.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* Rule rows */
.sb-rule-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
}

.sb-rule-row select,
.sb-rule-row input {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85em;
    background: white;
}

.sb-rule-row select {
    min-width: 120px;
}

.sb-rule-row input[type="text"],
.sb-rule-row input[type="number"] {
    width: 120px;
}

.sb-remove-rule {
    background: none;
    border: none;
    color: #f56565;
    cursor: pointer;
    font-size: 1em;
    padding: 4px;
}

.sb-add-rule {
    background: none;
    border: 2px dashed #667eea;
    color: #667eea;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    width: 100%;
    margin-bottom: 20px;
    transition: all 0.2s;
}

.sb-add-rule:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* Preview count */
.sb-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    border-radius: 10px;
    margin-bottom: 20px;
}

.sb-preview-count {
    font-size: 1.5em;
    font-weight: 700;
    color: #667eea;
}

.sb-preview-label {
    font-size: 0.85em;
    color: #888;
}

.sb-preview-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
}

/* Save section */
.sb-save-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    margin-top: 10px;
}

.sb-save-section input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.sb-save-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9em;
    resize: vertical;
    min-height: 60px;
}

.sb-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.sb-btn-save {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.sb-btn-cancel {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e2e8f0;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
}

/* Saved segments list */
.sb-segments-list {
    margin-top: 20px;
}

.sb-segment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.sb-segment-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.sb-segment-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.sb-segment-info {
    flex: 1;
}

.sb-segment-name {
    font-weight: 600;
    font-size: 0.9em;
}

.sb-segment-count {
    font-size: 0.8em;
    color: #888;
}

.sb-segment-actions {
    display: flex;
    gap: 6px;
}

.sb-segment-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    padding: 4px 8px;
    border-radius: 6px;
}

.sb-segment-actions button:hover {
    background: #f0f0f0;
}

/* Color picker */
.sb-color-picker {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.sb-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.sb-color-swatch.active,
.sb-color-swatch:hover {
    border-color: #333;
}
