/**
 * Personas Panel Styles
 * Witit - AI Image Generator
 */

/* Personas Panel (Full Screen Overlay) */
.personas-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(6, 6, 10, 0.98);
    backdrop-filter: blur(20px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease,
                visibility 0.35s ease;
}

.personas-panel.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

/* Personas Header */
.personas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.personas-title {
    font-size: 20px;
    font-weight: 600;
    color: white;
    flex: 1;
    text-align: center;
    padding-right: 80px;
}

.back-panel-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.back-panel-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.back-panel-btn svg {
    width: 20px;
    height: 20px;
}

/* Personas Content Layout */
.personas-content {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

/* Personas List Section */
.personas-list-section {
    width: 260px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
}

.personas-list-header {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.add-persona-btn {
    width: 100%;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(255, 0, 170, 0.2) 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.add-persona-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3) 0%, rgba(255, 0, 170, 0.3) 100%);
}

.add-persona-btn svg {
    width: 16px;
    height: 16px;
}

/* Personas List */
.personas-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.persona-item {
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.persona-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.persona-item.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.persona-item-avatar {
    transition: transform 0.2s ease;
}

.persona-item:hover .persona-item-avatar {
    transform: scale(1.05);
}

.persona-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.persona-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.persona-item-avatar svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.3);
}

.persona-item-info {
    flex: 1;
    min-width: 0;
}

.persona-item-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.persona-item-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

/* Persona Editor */
.persona-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 700px;
}

.persona-editor-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
}

.persona-editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
}

/* Editor Header */
.persona-editor-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Editor Back Button (visible on mobile) */
.editor-back-btn {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.editor-back-btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 900px) {
    .editor-back-btn {
        display: flex;
    }
}

.persona-editor-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

/* Save Button */
.save-persona-btn {
    background: linear-gradient(135deg, #00d4ff 0%, #ff00aa 100%);
    border: none;
    border-radius: 10px;
    padding: 10px 24px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Shimmer sweep for save button */
.save-persona-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.save-persona-btn:hover::before {
    left: 100%;
}

.save-persona-btn:hover {
    transform: scale(1.02) translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 212, 255, 0.4);
}

.save-persona-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.save-persona-btn svg {
    width: 18px;
    height: 18px;
}

/* Delete Button */
.delete-persona-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 10px 18px;
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.delete-persona-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.delete-persona-btn svg {
    width: 16px;
    height: 16px;
}

/* Profile Photo Section */
.persona-profile-section {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-photo-wrapper {
    flex-shrink: 0;
}

.profile-photo-slot {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 3px dashed rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.profile-photo-slot:hover {
    border-color: rgba(0, 212, 255, 0.5);
    background: rgba(0, 212, 255, 0.05);
}

.profile-photo-slot.drag-over {
    border-color: rgba(0, 212, 255, 0.7);
    background: rgba(0, 212, 255, 0.1);
    transform: scale(1.03);
}

.profile-photo-slot.has-image {
    border-style: solid;
    border-color: rgba(0, 212, 255, 0.4);
}

.profile-photo-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo-slot .add-icon {
    color: rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.profile-photo-slot .add-icon svg {
    width: 32px;
    height: 32px;
}

.profile-photo-slot .add-icon span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-photo-delete {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.profile-photo-slot:hover .profile-photo-delete {
    opacity: 1;
}

.profile-photo-delete svg {
    width: 14px;
    height: 14px;
}

/* Name and Info Section */
.persona-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.name-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.name-input-wrapper .field-input {
    font-size: 24px;
    font-weight: 600;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
}

.name-input-wrapper .field-input::placeholder {
    font-weight: 400;
}

/* Autocomplete Button */
.autocomplete-btn {
    background: rgba(255, 170, 0, 0.15);
    border: 1px solid rgba(255, 170, 0, 0.4);
    border-radius: 10px;
    padding: 12px 20px;
    color: #ffaa00;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    align-self: flex-start;
}

.autocomplete-btn:hover {
    background: rgba(255, 170, 0, 0.25);
}

.autocomplete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.autocomplete-btn svg {
    width: 16px;
    height: 16px;
}

.autocomplete-btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 170, 0, 0.3);
    border-top-color: #ffaa00;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-sizing: border-box;
    flex-shrink: 0;
    transform-origin: center;
}

/* Reference Photos Section */
.persona-reference-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.persona-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    gap: 12px;
}

.persona-image-slot {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.persona-image-slot:hover {
    border-color: rgba(0, 212, 255, 0.4);
    background: rgba(0, 212, 255, 0.05);
}

.persona-image-slot.drag-over {
    border-color: rgba(0, 212, 255, 0.6);
    background: rgba(0, 212, 255, 0.1);
    transform: scale(1.02);
}

.persona-image-slot.has-image {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.1);
}

.persona-image-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.persona-image-slot .add-icon {
    color: rgba(255, 255, 255, 0.3);
}

.persona-image-slot .add-icon svg {
    width: 24px;
    height: 24px;
}

.persona-image-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.persona-image-slot:hover .persona-image-delete {
    opacity: 1;
}

.persona-image-delete svg {
    width: 14px;
    height: 14px;
}

/* Drag-to-reorder styles */
.persona-image-slot.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    border-color: rgba(0, 212, 255, 0.6);
}

.persona-image-slot.drag-over-reorder {
    border-color: rgba(0, 212, 255, 0.8);
    background: rgba(0, 212, 255, 0.15);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.persona-image-slot.has-image {
    cursor: grab;
}

.persona-image-slot.has-image:active {
    cursor: grabbing;
}

.drag-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    color: rgba(255, 255, 255, 0.9);
    font-size: 9px;
    padding: 4px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.persona-image-slot:hover .drag-hint {
    opacity: 1;
}

.drag-hint.visible {
    opacity: 1;
    background: rgba(0, 212, 255, 0.9);
}

/* Persona Fields */
.persona-fields {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Type-specific field sections - breathing room from reference section */
.persona-fields.friend-fields,
.persona-fields.utility-fields {
    margin-top: 8px;
}

/* Common field section (Additional Context) - visual separator */
.persona-editor-content > .persona-fields:last-child {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.persona-field .field-label {
    margin-bottom: 6px;
}

.persona-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 8px;
}

.persona-field.full-width {
    grid-column: 1 / -1;
}

.persona-field textarea.field-input {
    min-height: 80px;
    resize: vertical;
}

/* Toggle field (horizontal layout with toggle on right) */
.persona-field.toggle-field {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
}

.persona-field.toggle-field .toggle-field-content {
    flex: 1;
}

.persona-field.toggle-field .field-label {
    margin-bottom: 4px;
    font-weight: 500;
}

.persona-field.toggle-field .field-hint {
    font-size: 0.8rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.5));
    line-height: 1.4;
}

/* "Me" Persona Section */
.me-persona-section {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.me-persona-item {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.05) 0%, rgba(255, 0, 170, 0.05) 100%);
    border: 1px solid rgba(0, 212, 255, 0.15);
}

.me-persona-item:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(255, 0, 170, 0.1) 100%);
}

.me-persona-item.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(255, 0, 170, 0.15) 100%);
    border-color: rgba(0, 212, 255, 0.4);
}

.me-avatar {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(255, 0, 170, 0.2) 100%);
    border-color: rgba(0, 212, 255, 0.3);
}

/* "Me" Editor Sections */
.me-account-section,
.me-socials-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.me-account-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.me-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.me-socials-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.me-social-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.me-social-field.full-width {
    grid-column: 1 / -1;
}

/* Images grid - 4 columns for all personas */
.persona-images-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .personas-content {
        flex-direction: column;
        position: relative;
    }

    .personas-list-section {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        flex-shrink: 0;
        transition: max-height 0.3s ease;
    }

    /* When no persona is selected, show full list */
    .personas-list-section:not(.collapsed) {
        max-height: none;
        flex: 1;
    }

    /* When editing a persona, collapse the list */
    .personas-list-section.collapsed {
        max-height: 80px;
        overflow: hidden;
    }

    .personas-list-section.collapsed .personas-list {
        display: none;
    }

    .personas-list-section.collapsed .me-persona-section {
        display: none;
    }

    .persona-editor {
        flex: 1;
        max-width: none;
    }

    .persona-editor-content {
        padding: 16px;
    }

    .persona-editor-header {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .persona-editor-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .persona-profile-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
        margin-bottom: 24px;
        padding-bottom: 20px;
    }

    .profile-photo-slot {
        width: 100px;
        height: 100px;
    }

    .persona-info-section {
        width: 100%;
    }

    .name-input-wrapper .field-input {
        font-size: 18px;
        padding: 10px 14px;
    }

    .autocomplete-btn {
        width: 100%;
        justify-content: center;
    }

    .persona-images-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .persona-image-slot {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }

    .persona-field textarea.field-input {
        min-height: 60px;
    }

    .persona-reference-section {
        padding-bottom: 16px;
        margin-bottom: 20px;
    }

    .persona-editor-content > .persona-fields:last-child {
        margin-top: 20px;
        padding-top: 16px;
    }

    .me-account-fields,
    .me-socials-grid {
        grid-template-columns: 1fr;
    }

    .save-persona-btn,
    .delete-persona-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* Hide styles section on mobile when editing */
    .personas-list-section.collapsed .styles-section {
        display: none;
    }

    .style-usage-hint {
        padding: 12px;
        font-size: 12px;
    }
}

/* ============================================
   Persona Type Selector
   ============================================ */

.persona-type-selector {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

/* Type Selector Back Button */
.type-selector-back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-selector-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.type-selector-back-btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 900px) {
    .type-selector-back-btn {
        display: flex;
    }
}

.type-selector-title {
    font-size: 24px;
    font-weight: 600;
    color: white;
    margin-bottom: 32px;
}

.type-cards {
    display: flex;
    gap: 24px;
    max-width: 600px;
    width: 100%;
}

.type-card {
    flex: 1;
    padding: 32px 24px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

/* Friend Card - Warm styling */
.type-card.friend-card {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 170, 0, 0.1) 100%);
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.type-card.friend-card:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2) 0%, rgba(255, 170, 0, 0.2) 100%);
    border-color: rgba(255, 107, 107, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.2);
}

.type-card.friend-card .type-card-icon {
    color: #ff6b6b;
}

/* Utility Card - Clean styling */
.type-card.utility-card {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(138, 43, 226, 0.1) 100%);
    border: 2px solid rgba(0, 212, 255, 0.3);
}

.type-card.utility-card:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(138, 43, 226, 0.2) 100%);
    border-color: rgba(0, 212, 255, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.2);
}

.type-card.utility-card .type-card-icon {
    color: #00d4ff;
}

.type-card-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
}

.type-card-icon svg {
    width: 100%;
    height: 100%;
}

.type-card h4 {
    font-size: 18px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.type-card p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

/* ============================================
   Persona Type Indicator
   ============================================ */

.section-label-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.persona-type-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.persona-type-indicator.friend {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.persona-type-indicator.utility {
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

/* ============================================
   Persona List Type Styling
   ============================================ */

/* Utility persona avatar - rounded square */
.persona-item.utility-type .persona-item-avatar,
.persona-item-avatar.utility-avatar {
    border-radius: 10px;
}

/* Friend persona avatar - circle (default) */
.persona-item.friend-type .persona-item-avatar,
.persona-item-avatar.friend-avatar {
    border-radius: 50%;
}

/* Utility persona subtle styling */
.persona-item.utility-type {
    border-left: 3px solid rgba(0, 212, 255, 0.4);
}

.persona-item.utility-type:hover {
    border-left-color: rgba(0, 212, 255, 0.6);
}

.persona-item.utility-type.active {
    border-left-color: rgba(0, 212, 255, 0.8);
}

/* Utility avatar styling */
.persona-item.utility-type .persona-item-avatar {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.2);
}

/* Responsive type selector */
@media (max-width: 768px) {
    .persona-type-selector {
        padding: 24px;
    }

    .type-selector-title {
        font-size: 20px;
        margin-bottom: 24px;
    }

    .type-cards {
        flex-direction: column;
        gap: 16px;
    }

    .type-card {
        padding: 24px 20px;
    }

    .type-card-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 12px;
    }

    .type-card h4 {
        font-size: 16px;
    }

    .type-card p {
        font-size: 12px;
    }
}

/* ============================================
   GALLERY LAYOUT (Unified Design)
   ============================================ */

/* Gallery Section */
.personas-gallery {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: linear-gradient(180deg, rgba(6, 6, 10, 0) 0%, rgba(6, 6, 10, 0.5) 100%);
}

/* Gallery Scroll Container */
.gallery-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    scroll-behavior: smooth;
}

/* Section Styling */
.gallery-section {
    margin-bottom: 32px;
}

.gallery-section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.section-title svg {
    color: rgba(255, 170, 0, 0.8);
}

.section-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

/* Me Card Wrapper */
.me-card-wrapper {
    max-width: 280px;
}

/* Featured Section */
.featured-section {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.03) 0%, rgba(255, 200, 100, 0.01) 100%);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 170, 0, 0.1);
}

.featured-section .section-header {
    border-bottom-color: rgba(255, 170, 0, 0.15);
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

/* Personas Grid */
.personas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Create Button (in section header) */
.section-header .add-persona-btn {
    padding: 8px 16px;
    font-size: 13px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(255, 0, 170, 0.15) 100%);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 10px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-header .add-persona-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25) 0%, rgba(255, 0, 170, 0.25) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.2);
}

.section-header .add-persona-btn svg {
    width: 14px;
    height: 14px;
}

/* Gallery Empty State */
.gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.02) 0%, rgba(255, 0, 170, 0.02) 100%);
    border-radius: 20px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.gallery-empty .empty-illustration {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.3);
}

.gallery-empty .empty-illustration svg {
    width: 100%;
    height: 100%;
}

.gallery-empty .empty-title {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.gallery-empty .empty-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    max-width: 320px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.empty-cta-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #00d4ff 0%, #ff00aa 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.empty-cta-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.4);
}

.empty-cta-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   PERSONA CARDS (Redesigned)
   ============================================ */

.persona-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
}

/* Card entrance animation */
.persona-card.animate-in {
    animation: cardFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: calc(var(--card-index, 0) * 0.05s);
}

@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.persona-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.02) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.persona-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.persona-card:hover::before {
    opacity: 1;
}

/* Card Avatar */
.card-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-avatar svg {
    width: 36px;
    height: 36px;
    color: rgba(255, 255, 255, 0.35);
}

.persona-card:hover .card-avatar {
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Card Info */
.card-info {
    width: 100%;
}

.card-name {
    font-size: 16px;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-description {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

/* Type Badge */
.card-type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.persona-card:hover .card-type-badge {
    opacity: 1;
}

.card-type-badge.friend {
    background: rgba(255, 107, 157, 0.15);
    border: 1px solid rgba(255, 107, 157, 0.3);
}

.card-type-badge.friend svg {
    color: #ff6b9d;
}

.card-type-badge.utility {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.card-type-badge.utility svg {
    color: #00d4ff;
}

/* Featured Badge */
.card-featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.2) 0%, rgba(255, 200, 100, 0.1) 100%);
    border: 1px solid rgba(255, 170, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 170, 0, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.card-featured-badge svg {
    color: rgba(255, 170, 0, 0.9);
}

/* Friend Card Styles */
.persona-card.friend {
    border-color: rgba(255, 107, 157, 0.12);
    background: linear-gradient(180deg, rgba(255, 107, 157, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.persona-card.friend:hover {
    border-color: rgba(255, 107, 157, 0.35);
    box-shadow: 0 12px 40px rgba(255, 107, 157, 0.15);
}

.persona-card.friend .card-avatar {
    border-color: rgba(255, 107, 157, 0.25);
}

.persona-card.friend:hover .card-avatar {
    border-color: rgba(255, 107, 157, 0.5);
    box-shadow: 0 8px 24px rgba(255, 107, 157, 0.2);
}

/* Utility Card Styles */
.persona-card.utility {
    border-color: rgba(0, 212, 255, 0.12);
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.persona-card.utility:hover {
    border-color: rgba(0, 212, 255, 0.35);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.15);
}

.persona-card.utility .card-avatar {
    border-radius: 16px;
    border-color: rgba(0, 212, 255, 0.25);
}

.persona-card.utility:hover .card-avatar {
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.2);
}

/* System Card Styles */
.persona-card.system {
    border-color: rgba(255, 170, 0, 0.15);
    background: linear-gradient(180deg, rgba(255, 170, 0, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.persona-card.system:hover {
    border-color: rgba(255, 170, 0, 0.4);
    box-shadow: 0 12px 40px rgba(255, 170, 0, 0.15);
}

.persona-card.system .card-avatar {
    border-radius: 16px;
    border-color: rgba(255, 170, 0, 0.35);
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.12) 0%, rgba(255, 200, 100, 0.06) 100%);
}

.persona-card.system:hover .card-avatar {
    border-color: rgba(255, 170, 0, 0.6);
    box-shadow: 0 8px 24px rgba(255, 170, 0, 0.2);
}

.persona-card.system .card-avatar svg {
    color: rgba(255, 170, 0, 0.7);
}

/* Me Card Special Styling */
.persona-card.me-card {
    border-color: rgba(100, 180, 255, 0.15);
    background: linear-gradient(180deg, rgba(100, 180, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    opacity: 1;
    transform: none;
}

.persona-card.me-card:hover {
    border-color: rgba(100, 180, 255, 0.35);
    box-shadow: 0 12px 40px rgba(100, 180, 255, 0.15);
}

.persona-card.me-card .card-avatar.me-avatar {
    border-color: rgba(100, 180, 255, 0.35);
    background: linear-gradient(135deg, rgba(100, 180, 255, 0.1) 0%, rgba(180, 100, 255, 0.05) 100%);
}

.persona-card.me-card:hover .card-avatar.me-avatar {
    border-color: rgba(100, 180, 255, 0.55);
    box-shadow: 0 8px 24px rgba(100, 180, 255, 0.2);
}

/* ============================================
   SYSTEM PERSONA VIEW (Read-Only)
   ============================================ */

.system-persona-view {
    display: none;
    flex-direction: column;
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.system-persona-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.back-to-gallery-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-to-gallery-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.back-to-gallery-btn svg {
    width: 16px;
    height: 16px;
}

.system-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 170, 0, 0.15);
    border: 1px solid rgba(255, 170, 0, 0.3);
    border-radius: 20px;
    color: rgba(255, 170, 0, 0.9);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.system-persona-content {
    max-width: 600px;
    margin: 0 auto;
}

.system-persona-profile {
    text-align: center;
    margin-bottom: 32px;
}

.system-avatar {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.15) 0%, rgba(255, 200, 100, 0.08) 100%);
    border: 2px solid rgba(255, 170, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.system-avatar svg {
    width: 40px;
    height: 40px;
    color: rgba(255, 170, 0, 0.7);
}

.system-persona-name {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.system-persona-description {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

.system-persona-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.detail-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px;
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 170, 0, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.detail-value {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.system-persona-usage {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.usage-tip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.usage-tip svg {
    color: rgba(255, 170, 0, 0.6);
    flex-shrink: 0;
}

.usage-tip code {
    background: rgba(255, 170, 0, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    color: rgba(255, 170, 0, 0.9);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
}

/* ============================================
   EDITOR ADJUSTMENTS FOR GALLERY LAYOUT
   ============================================ */

/* Editor now slides over gallery */
.persona-editor {
    width: 50%;
    min-width: 400px;
    max-width: 600px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.persona-editor.editing .persona-editor-empty {
    display: none;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS FOR GALLERY
   ============================================ */

@media (max-width: 1200px) {
    .personas-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .featured-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 900px) {
    .personas-content {
        flex-direction: column;
        position: relative;
    }

    .personas-gallery {
        flex: 1;
    }

    .gallery-scroll {
        padding: 20px 16px;
    }

    .persona-editor {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        background: rgba(6, 6, 10, 0.98);
        z-index: 10;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .persona-editor.editing {
        transform: translateX(0);
    }

    .personas-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .section-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .section-header .add-persona-btn {
        order: 1;
    }

    .me-card-wrapper {
        max-width: 100%;
    }

    .featured-section {
        padding: 16px;
    }
}

@media (max-width: 600px) {
    .gallery-scroll {
        padding: 16px 12px;
    }

    .personas-grid,
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .persona-card {
        padding: 16px 14px;
        border-radius: 16px;
    }

    .card-avatar {
        width: 64px;
        height: 64px;
        margin-bottom: 12px;
    }

    .card-avatar svg {
        width: 28px;
        height: 28px;
    }

    .card-name {
        font-size: 14px;
    }

    .card-description {
        font-size: 12px;
        -webkit-line-clamp: 2;
        min-height: 2.4em;
    }

    .card-type-badge {
        width: 20px;
        height: 20px;
        top: 8px;
        left: 8px;
    }

    .card-featured-badge {
        padding: 3px 8px;
        font-size: 9px;
        top: 8px;
        right: 8px;
    }

    .section-title {
        font-size: 13px;
    }

    .gallery-empty {
        padding: 32px 20px;
    }

    .gallery-empty .empty-illustration {
        width: 80px;
        height: 80px;
    }

    .gallery-empty .empty-title {
        font-size: 16px;
    }

    .gallery-empty .empty-description {
        font-size: 13px;
    }

    .empty-cta-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .gallery-scroll {
        padding: 12px 10px;
    }

    .personas-grid,
    .featured-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .persona-card {
        padding: 14px 12px;
        border-radius: 14px;
    }

    .card-avatar {
        width: 56px;
        height: 56px;
        margin-bottom: 10px;
        border-width: 2px;
    }

    .card-name {
        font-size: 13px;
    }

    .card-description {
        font-size: 11px;
        -webkit-line-clamp: 1;
        min-height: 1.3em;
    }

    .gallery-section {
        margin-bottom: 24px;
    }

    .featured-section {
        padding: 14px;
        border-radius: 14px;
    }
}

/* ============================================
   Voice Section Styles
   ============================================ */

.persona-voice-section {
    margin: 20px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.section-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.voice-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-status.active {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.15);
}

/* Voice Selector Dropdown */
.voice-selector-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.voice-select {
    flex: 1;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.voice-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.voice-select:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.voice-select option {
    background: #1a1a2e;
    color: white;
    padding: 8px;
}

.voice-select optgroup {
    background: #1a1a2e;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    font-style: normal;
}

/* Voice Preview Button */
.voice-preview-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: #a855f7;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.voice-preview-btn:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.25);
    transform: scale(1.05);
}

.voice-preview-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.voice-preview-btn.playing {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

/* Clone Option */
.voice-clone-option {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.or-divider {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-voice-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-voice-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

/* Current Voice Info (for cloned voices) */
.current-voice-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 8px;
}

.voice-info-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #a855f7;
    font-size: 12px;
    font-weight: 500;
}

.btn-link {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.btn-link.danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Voice Design Section */
.voice-design-section {
    margin-bottom: 16px;
}

.voice-prompt-input {
    width: 100%;
    min-height: 60px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: white;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
    transition: border-color 0.2s ease;
}

.voice-prompt-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.voice-prompt-input:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.15);
}

.generate-voice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 10px;
    color: #a855f7;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.generate-voice-btn:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.25);
    border-color: rgba(168, 85, 247, 0.4);
}

.generate-voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Voice Previews Container */
.voice-previews {
    margin: 16px 0;
    padding: 12px;
    background: rgba(168, 85, 247, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 10px;
}

.voice-previews-header {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.voice-preview-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 8px;
}

.voice-preview-card:last-child {
    margin-bottom: 0;
}

.voice-preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.voice-preview-label {
    font-size: 13px;
    font-weight: 500;
    color: white;
}

.voice-preview-duration {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

.voice-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.play-preview-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.play-preview-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.play-preview-btn.playing {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

/* Subtle pill badge for voice selection */
.use-voice-btn {
    padding: 5px 14px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 20px;
    color: #22c55e;
    cursor: pointer;
    transition: all 0.2s ease;
}

.use-voice-btn:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
}

.use-voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Voice Library Section */
.voice-library-section {
    margin-top: 12px;
}

.voice-library-section .or-divider {
    display: block;
    margin-bottom: 10px;
}

/* ================================================
   COLLAPSED VOICE STATE
   When a voice is selected, show compact card
   ================================================ */

.voice-selected-state {
    margin-top: 8px;
}

.selected-voice-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 10px;
}

.selected-voice-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a855f7;
    font-size: 13px;
    font-weight: 500;
}

.selected-voice-info svg {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.selected-voice-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Circular preview button in collapsed state */
.voice-preview-pill {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: #a855f7;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.voice-preview-pill svg {
    width: 14px;
    height: 14px;
}

.voice-preview-pill:hover {
    background: rgba(168, 85, 247, 0.25);
    transform: scale(1.05);
}

.voice-preview-pill.playing {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.voice-preview-pill.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Remove button pill */
.voice-remove-pill {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.voice-remove-pill:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Voice mode selector (creative/natural/robust) */
.voice-mode-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(168, 85, 247, 0.04);
    border: 1px solid rgba(168, 85, 247, 0.12);
    border-radius: 8px;
}

.voice-mode-selector label {
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
}

.voice-mode-selector select {
    padding: 6px 28px 6px 10px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 6px;
    color: #a855f7;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a855f7' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.2s ease;
}

.voice-mode-selector select:hover {
    background-color: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.35);
}

.voice-mode-selector select:focus {
    outline: none;
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.1);
}

.voice-mode-selector select option {
    background: #1f2937;
    color: #e5e7eb;
}

/* Voice options container (expanded state) */
.voice-options-container {
    /* Default visible, JS will hide when voice is selected */
}

/* Mobile adjustments for voice section */
@media (max-width: 600px) {
    .persona-voice-section {
        padding: 12px;
    }

    .voice-selector-wrapper {
        flex-direction: column;
    }

    .voice-select {
        width: 100%;
    }

    .voice-preview-btn {
        width: 100%;
        height: 36px;
    }

    .voice-clone-option {
        flex-direction: column;
        align-items: flex-start;
    }

    .or-divider {
        margin: 4px 0;
    }

    /* Collapsed state mobile */
    .selected-voice-card {
        padding: 10px 12px;
    }

    .selected-voice-info {
        font-size: 12px;
    }

    .voice-preview-pill {
        width: 28px;
        height: 28px;
    }

    .voice-preview-pill svg {
        width: 12px;
        height: 12px;
    }
}

/* ==========================================
   Voice Recording Panel Styles
   ========================================== */

.voice-record-option {
    margin-top: 12px;
}

.record-voice-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 8px;
    color: #a855f7;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.record-voice-btn:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
}

.record-voice-btn svg {
    width: 14px;
    height: 14px;
}

/* Recording Panel */
.voice-recording-panel {
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 16px;
    padding: 24px;
    margin-top: 16px;
}

.recording-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.recording-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.close-recording-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-recording-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

/* Device Selector */
.recording-device-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.recording-device-selector label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.recording-device-selector select {
    flex: 1;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.recording-device-selector select:hover {
    border-color: rgba(168, 85, 247, 0.4);
}

.recording-device-selector select:focus {
    outline: none;
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.recording-device-selector select option {
    background: #1a1a2e;
    color: white;
    padding: 8px;
}

/* Script Display */
.recording-script {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.85);
    white-space: pre-wrap;
}

/* Waveform Visualizer */
.recording-visualizer {
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.recording-visualizer canvas {
    width: 100%;
    height: 100%;
}

.recording-visualizer.recording {
    border: 2px solid rgba(239, 68, 68, 0.5);
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-color: rgba(239, 68, 68, 0.3);
    }
    50% {
        border-color: rgba(239, 68, 68, 0.7);
    }
}

/* Recording Controls */
.recording-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.recording-duration {
    font-size: 32px;
    font-weight: 300;
    color: white;
    font-variant-numeric: tabular-nums;
}

.recording-min-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.recording-min-hint.met {
    color: #22c55e;
}

/* Start Recording Button */
.start-record-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 180px;
    height: 56px;
    border-radius: 28px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    border: none;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.start-record-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.4);
}

.start-record-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Stop Recording Button */
.stop-record-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 140px;
    height: 56px;
    border-radius: 28px;
    background: #ef4444;
    border: none;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

.stop-record-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.stop-record-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
    }
}

/* Recording Review */
.recording-review {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 16px;
}

.recording-review audio {
    width: 100%;
    height: 40px;
}

.review-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.review-actions .btn-secondary {
    padding: 12px 24px;
    font-size: 14px;
}

.review-actions .btn-primary {
    padding: 12px 24px;
    font-size: 14px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.review-actions .btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.4);
}

.review-actions .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Recording Tips */
.recording-tips {
    padding: 12px 16px;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 8px;
}

.recording-tips p {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

/* Recording Duration Warning */
.recording-duration.warning {
    color: #fbbf24;
}

.recording-duration.ready {
    color: #22c55e;
}

/* Mobile adjustments for recording panel */
@media (max-width: 600px) {
    .voice-recording-panel {
        padding: 16px;
    }

    .recording-script {
        font-size: 14px;
        padding: 16px;
    }

    .recording-duration {
        font-size: 28px;
    }

    .start-record-btn,
    .stop-record-btn {
        width: 100%;
        max-width: 200px;
    }

    .review-actions {
        flex-direction: column;
    }

    .review-actions .btn-secondary,
    .review-actions .btn-primary {
        width: 100%;
    }
}

/* =============================================================================
   Profile Fields Styles
   ============================================================================= */

.profile-fields {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 8px;
}

.profile-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-field.full-width {
    grid-column: span 2;
}

/* Select dropdown styling */
.field-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.field-select:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.field-select:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.field-select option {
    background: #1a1a24;
    color: white;
    padding: 8px;
}

/* Custom input for gender/pronouns */
.gender-custom-input,
.pronouns-custom-input {
    margin-top: 8px;
}

/* Date input styling */
input[type="date"].field-input {
    color-scheme: dark;
}

input[type="date"].field-input::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

/* =============================================================================
   Chip Select Component
   ============================================================================= */

.chip-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.chip.selected {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(255, 0, 170, 0.2) 100%);
    border-color: rgba(0, 212, 255, 0.4);
    color: white;
}

.chip.selected:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25) 0%, rgba(255, 0, 170, 0.25) 100%);
    border-color: rgba(0, 212, 255, 0.5);
}

/* =============================================================================
   Profile Fields Responsive
   ============================================================================= */

@media (max-width: 600px) {
    .profile-fields-grid {
        grid-template-columns: 1fr;
    }

    .profile-field.full-width {
        grid-column: span 1;
    }

    .chip-select {
        gap: 6px;
    }

    .chip {
        padding: 5px 12px;
        font-size: 12px;
    }
}
