* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #f5f5f5;
    min-height: 100vh;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.header {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2.5rem;
    color: #2563eb;
    margin-bottom: 8px;
}

.header p {
    font-size: 1.1rem;
    color: #64748b;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.builder-panel,
.preview-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.panel-header h2 {
    font-size: 1.5rem;
    color: #1f2937;
}

.panel-actions {
    display: flex;
    gap: 12px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background: #d1d5db;
}

.btn-secondary:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.builder-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.category-section {
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.category-header {
    padding: 16px 20px;
    background: #f9fafb;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.category-header:hover {
    background: #f3f4f6;
}

.category-header.active {
    background: #eff6ff;
}

.toggle-icon {
    font-size: 1.2rem;
    color: #6b7280;
    transition: transform 0.2s;
}

.category-header.active .toggle-icon {
    transform: rotate(45deg);
}

.category-content {
    display: none;
    padding: 20px;
}

.category-content.active {
    display: block;
}

.trait-group {
    margin-bottom: 24px;
}

.trait-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.trait-selector {
    position: relative;
}

.persona-name-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    margin-bottom: 16px;
    font-weight: 500;
}

.persona-name-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.persona-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    margin-bottom: 16px;
    background: white;
    cursor: pointer;
}

.persona-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.preset-selector {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    margin-bottom: 16px;
    background: white;
    cursor: pointer;
}

.preset-selector:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.trait-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.trait-search:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.trait-options {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    margin-bottom: 12px;
    display: none;
    position: relative;
}

.trait-options.active {
    display: block;
}

.trait-options-wrapper {
    max-height: 250px;
    overflow-y: auto;
}

.show-all-btn {
    width: 100%;
    padding: 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 6px 6px;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.show-all-btn:hover {
    background: #e5e7eb;
}

.trait-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.trait-option:last-child {
    border-bottom: none;
}

.trait-option:hover {
    background: #f3f4f6;
}

.trait-option.selected {
    background: #dbeafe;
    color: #1e40af;
}

/* Grouped trait options */
.trait-group-item {
    border-bottom: 1px solid #f3f4f6;
}

.trait-group-header {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    transition: background 0.2s;
    user-select: none;
}

.trait-group-header:hover {
    background: #f3f4f6;
}

.trait-group-item.expanded .trait-group-header {
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
}

.group-name {
    font-weight: 600;
    color: #1f2937;
    text-transform: capitalize;
}

.group-count {
    color: #6b7280;
    font-size: 0.875rem;
    margin-left: 4px;
}

.group-toggle {
    color: #6b7280;
    font-weight: bold;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.trait-group-items {
    background: white;
    padding-left: 8px;
}

.trait-option-nested {
    padding-left: 24px;
    font-size: 0.9rem;
    color: #4b5563;
}

.trait-option-nested:hover {
    background: #f3f4f6;
}

.selected-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 8px;
    margin-top: 8px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    transition: all 0.2s;
    align-items: center;
    position: relative;
}

.selected-traits:not(:empty) {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-style: solid;
    align-items: flex-start;
}

.selected-traits:empty {
    justify-content: center;
}

.selected-traits:empty::before {
    content: "Selected traits will appear here";
    color: #9ca3af;
    font-size: 0.875rem;
    font-style: italic;
    pointer-events: none;
}

.trait-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #2563eb;
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    gap: 6px;
    margin: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.trait-chip .remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.9;
    font-size: 1.1rem;
    line-height: 1;
    margin-left: 4px;
    padding: 0 2px;
}

.trait-chip .remove:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.trait-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
}

.trait-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.trait-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    background: white;
}

.trait-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.textarea-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
}

/* Format Toggles - Atlas Style */
.format-toggles {
    display: flex;
    align-items: center;
    gap: 24px;
}

.format-option {
    display: flex;
    align-items: center;
    gap: 2px;
}

.radio-button {
    width: 14px;
    height: 14px;
    position: relative;
    cursor: pointer;
}

.radio-outer {
    width: 14px;
    height: 14px;
    position: absolute;
    left: 0;
    top: 0;
    background: #FEFAE0;
    border-radius: 9999px;
    border: 1px solid rgba(96, 108, 56, 0.66);
    transition: border-color 0.2s ease;
}

.radio-button.checked .radio-outer {
    border-color: #606C38;
}

.radio-inner {
    width: 6px;
    height: 6px;
    position: absolute;
    left: 4px;
    top: 4px;
    background: #606C38;
    border-radius: 9999px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.radio-button.checked .radio-inner {
    opacity: 1;
}

.format-option label {
    opacity: 0.66;
    color: #0A0D06;
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
    line-height: 24px;
    letter-spacing: 0.30px;
    cursor: pointer;
    margin-left: 0;
}

.btn-action {
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
    color: rgba(10, 13, 6, 0.66);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    line-height: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover:not(:disabled) {
    outline: 1px solid #0A0D06;
    outline-offset: -1px;
}

.btn-action:disabled {
    color: rgba(96, 108, 56, 0.33);
    cursor: not-allowed;
}

.btn-action:disabled:hover {
    outline: none;
}

.preview-content {
    padding: 20px;
    overflow-y: auto;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    flex: 1;
}

.preview-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.preview-content pre {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.preview-actions {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}



/* Slider Styles */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.slider-dimension {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.slider-container {
    position: relative;
    height: 32px;
    display: flex;
    align-items: center;
}

.tone-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    position: relative;
    z-index: 1;
}

.tone-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #9333ea;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.tone-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #9333ea;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.tone-slider::-webkit-slider-thumb:hover {
    background: #7e22ce;
    transform: scale(1.1);
}

.tone-slider::-moz-range-thumb:hover {
    background: #7e22ce;
    transform: scale(1.1);
}

.personality-slider,
.behavioral-slider,
.interpersonal-slider,
.tier1-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    position: relative;
    z-index: 1;
}

.personality-slider::-webkit-slider-thumb,
.behavioral-slider::-webkit-slider-thumb,
.interpersonal-slider::-webkit-slider-thumb,
.tier1-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #9333ea;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.personality-slider::-moz-range-thumb,
.behavioral-slider::-moz-range-thumb,
.interpersonal-slider::-moz-range-thumb,
.tier1-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #9333ea;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.personality-slider::-webkit-slider-thumb:hover,
.behavioral-slider::-webkit-slider-thumb:hover,
.interpersonal-slider::-webkit-slider-thumb:hover,
.tier1-slider::-webkit-slider-thumb:hover {
    background: #7e22ce;
    transform: scale(1.1);
}

.personality-slider::-moz-range-thumb:hover,
.behavioral-slider::-moz-range-thumb:hover,
.interpersonal-slider::-moz-range-thumb:hover,
.tier1-slider::-moz-range-thumb:hover {
    background: #7e22ce;
    transform: scale(1.1);
}


.tone-preview {
    margin-top: 20px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.preview-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
}

.preview-text {
    font-size: 1rem;
    color: #1f2937;
    line-height: 1.6;
    font-style: italic;
    padding: 12px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #9333ea;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

