/**
 * Train Your AI Persona Styles
 * v2026-01-16a
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --tp-primary: #9810FA;
    --tp-primary-dark: #7C0ED1;
    --tp-primary-light: #F3E8FF;
    --tp-secondary: #6B7280;
    --tp-dark: #1F2937;
    --tp-light: #F9FAFB;
    --tp-white: #FFFFFF;
    --tp-border: #E5E7EB;
    --tp-success: #10B981;
    --tp-warning: #F59E0B;
    --tp-error: #EF4444;
    --tp-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --tp-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --tp-radius: 12px;
    --tp-radius-sm: 8px;
    --tp-transition: all 0.2s ease;
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--tp-light);
    color: var(--tp-dark);
    line-height: 1.5;
    min-height: 100vh;
}

/* ============================================
   Container
   ============================================ */
.tp-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

@media (max-width: 768px) {
    .tp-container {
        padding: 1rem;
    }
}

/* ============================================
   Header
   ============================================ */
.tp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tp-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tp-dark);
}

.tp-header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ============================================
   Buttons
   ============================================ */
.tp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--tp-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--tp-transition);
    white-space: nowrap;
}

.tp-btn-primary {
    background: var(--tp-primary);
    color: var(--tp-white);
}

.tp-btn-primary:hover {
    background: var(--tp-primary-dark);
}

.tp-btn-secondary {
    background: var(--tp-white);
    color: var(--tp-dark);
    border: 1px solid var(--tp-border);
}

.tp-btn-secondary:hover {
    background: var(--tp-light);
}

.tp-btn-outline {
    background: transparent;
    color: var(--tp-dark);
    border: 1px solid var(--tp-border);
}

.tp-btn-outline:hover {
    background: var(--tp-light);
    border-color: var(--tp-primary);
    color: var(--tp-primary);
}

.tp-btn-icon {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
}

.tp-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.tp-btn-record {
    padding: 0.875rem 1.5rem;
}

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

/* ============================================
   Progress Card
   ============================================ */
.tp-progress-card {
    background: var(--tp-white);
    border-radius: var(--tp-radius);
    padding: 1.5rem;
    box-shadow: var(--tp-shadow);
    margin-bottom: 2rem;
}

.tp-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.tp-progress-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.tp-progress-percent {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tp-primary);
}

.tp-progress-bar {
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.tp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9810FA 0%, #E879F9 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.tp-progress-text {
    font-size: 0.875rem;
    color: var(--tp-secondary);
    margin-bottom: 1rem;
}

/* Category Tabs */
.tp-category-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tp-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--tp-secondary);
    background: transparent;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--tp-transition);
}

.tp-tab:hover {
    background: var(--tp-light);
}

.tp-tab.active {
    background: var(--tp-primary-light);
    color: var(--tp-primary);
}

.tp-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.5;
}

.tp-tab.active .tp-tab-dot {
    opacity: 1;
}

/* ============================================
   Add Content Section
   ============================================ */
.tp-add-content {
    margin-bottom: 2rem;
}

.tp-add-content h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.tp-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

@media (min-width: 768px) {
    .tp-content-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Content Cards */
.tp-content-card {
    background: var(--tp-white);
    border-radius: var(--tp-radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--tp-shadow);
    cursor: pointer;
    transition: var(--tp-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.tp-content-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tp-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.tp-icon-bio { background: #FEF3C7; color: #D97706; }
.tp-icon-qa { background: #F3E8FF; color: #9810FA; }
.tp-icon-transcripts { background: #DBEAFE; color: #2563EB; }
.tp-icon-voice { background: #FCE7F3; color: #DB2777; }
.tp-icon-social { background: #FEE2E2; color: #DC2626; }
.tp-icon-url { background: #E0E7FF; color: #4F46E5; }

.tp-content-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tp-dark);
}

.tp-content-card p {
    font-size: 0.75rem;
    color: var(--tp-secondary);
    margin-bottom: 0.5rem;
}

.tp-content-card .tp-btn {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

/* ============================================
   Modal Styles
   ============================================ */
.tp-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.tp-modal.active {
    display: flex;
}

.tp-modal-content {
    background: var(--tp-white);
    border-radius: var(--tp-radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--tp-shadow-lg);
    animation: modalSlideIn 0.2s ease;
}

.tp-modal-large {
    max-width: 640px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--tp-border);
}

.tp-modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.tp-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tp-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: var(--tp-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: var(--tp-transition);
}

.tp-modal-close:hover {
    background: var(--tp-light);
    color: var(--tp-dark);
}

.tp-modal-body {
    padding: 1.5rem;
}

.tp-modal-desc {
    font-size: 0.875rem;
    color: var(--tp-secondary);
    margin-bottom: 1.5rem;
}

.tp-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--tp-border);
    background: var(--tp-light);
    border-radius: 0 0 var(--tp-radius) var(--tp-radius);
}

/* ============================================
   Form Styles
   ============================================ */
.tp-form-group {
    margin-bottom: 1.25rem;
}

.tp-form-group:last-child {
    margin-bottom: 0;
}

.tp-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tp-dark);
    margin-bottom: 0.5rem;
}

.tp-required {
    color: var(--tp-error);
}

.tp-hint {
    font-size: 0.75rem;
    color: var(--tp-secondary);
    margin-top: 0.25rem;
}

.tp-input,
.tp-textarea,
.tp-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-sm);
    background: var(--tp-white);
    color: var(--tp-dark);
    transition: var(--tp-transition);
}

.tp-input:focus,
.tp-textarea:focus,
.tp-select:focus {
    outline: none;
    border-color: var(--tp-primary);
    box-shadow: 0 0 0 3px rgba(152, 16, 250, 0.1);
}

.tp-input::placeholder,
.tp-textarea::placeholder {
    color: #9CA3AF;
}

.tp-textarea {
    resize: vertical;
    min-height: 100px;
}

.tp-textarea-large {
    min-height: 200px;
}

.tp-char-count {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--tp-secondary);
    margin-top: 0.25rem;
}

/* Checkbox Grid */
.tp-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.tp-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--tp-dark);
    cursor: pointer;
}

.tp-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--tp-primary);
    cursor: pointer;
}

/* ============================================
   Q&A Specific Styles
   ============================================ */
.tp-starter-section {
    background: var(--tp-primary-light);
    border-radius: var(--tp-radius-sm);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.tp-starter-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tp-starter-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--tp-dark);
}

.tp-starter-desc {
    font-size: 0.8125rem;
    color: var(--tp-secondary);
    margin-bottom: 1rem;
}

.tp-starter-questions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tp-starter-question {
    background: var(--tp-white);
    border-radius: var(--tp-radius-sm);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.tp-starter-question span {
    font-size: 0.875rem;
    color: var(--tp-dark);
}

.tp-starter-question .tp-btn {
    flex-shrink: 0;
}

.tp-question-display {
    background: var(--tp-light);
    border-radius: var(--tp-radius-sm);
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--tp-dark);
}

/* Q&A List */
.tp-qa-section h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.tp-qa-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tp-qa-item {
    background: var(--tp-light);
    border-radius: var(--tp-radius-sm);
    padding: 1rem;
}

.tp-qa-item-question {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tp-dark);
    margin-bottom: 0.5rem;
}

.tp-qa-item-answer {
    font-size: 0.8125rem;
    color: var(--tp-secondary);
}

/* ============================================
   Upload Options
   ============================================ */
.tp-upload-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tp-upload-option {
    background: var(--tp-light);
    border-radius: var(--tp-radius-sm);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--tp-transition);
}

.tp-upload-option:hover {
    background: #F3F4F6;
}

.tp-upload-icon {
    margin-bottom: 0.75rem;
}

.tp-upload-option h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--tp-dark);
    margin-bottom: 0.25rem;
}

.tp-upload-option p {
    font-size: 0.75rem;
    color: var(--tp-secondary);
    margin-bottom: 1rem;
}

/* ============================================
   Help Sections
   ============================================ */
.tp-help-section {
    margin-bottom: 1.5rem;
}

.tp-help-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--tp-light);
    border: none;
    border-radius: var(--tp-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tp-dark);
    cursor: pointer;
    transition: var(--tp-transition);
}

.tp-help-toggle:hover {
    background: #F3F4F6;
}

.tp-help-toggle .tp-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.tp-help-toggle.active .tp-chevron {
    transform: rotate(180deg);
}

.tp-help-content {
    padding: 1rem;
    background: var(--tp-white);
    border: 1px solid var(--tp-border);
    border-top: none;
    border-radius: 0 0 var(--tp-radius-sm) var(--tp-radius-sm);
}

.tp-help-content ol {
    margin: 0;
    padding-left: 1.25rem;
}

.tp-help-content li {
    font-size: 0.8125rem;
    color: var(--tp-secondary);
    margin-bottom: 0.5rem;
}

.tp-help-alt {
    font-size: 0.8125rem;
    color: var(--tp-primary);
    margin-top: 0.75rem;
    font-style: italic;
}

/* ============================================
   Voice Recording
   ============================================ */
.tp-suggestions-box {
    background: var(--tp-primary-light);
    border-radius: var(--tp-radius-sm);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.tp-suggestions-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tp-dark);
}

.tp-suggestions-list {
    margin: 0;
    padding-left: 1.25rem;
}

.tp-suggestions-list li {
    font-size: 0.8125rem;
    color: var(--tp-secondary);
    margin-bottom: 0.375rem;
}

.tp-recorder {
    text-align: center;
    padding: 2rem 0;
}

.tp-recorder-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--tp-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--tp-primary);
    transition: var(--tp-transition);
}

.tp-recorder-circle.recording {
    background: var(--tp-primary);
    color: var(--tp-white);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.tp-recorder-time {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--tp-dark);
    margin-bottom: 1rem;
}

.tp-recorder-hint {
    font-size: 0.8125rem;
    color: var(--tp-secondary);
    margin-top: 0.75rem;
}

/* ============================================
   Empty States
   ============================================ */
.tp-empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--tp-secondary);
}

.tp-empty-state svg {
    margin-bottom: 0.75rem;
}

.tp-empty-state p {
    font-size: 0.875rem;
}

/* ============================================
   Content Lists
   ============================================ */
.tp-transcripts-section h3,
.tp-captions-section h3,
.tp-urls-section h3,
.tp-voice-section h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.tp-content-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--tp-light);
    border-radius: var(--tp-radius-sm);
    margin-bottom: 0.5rem;
}

.tp-content-item-info {
    flex: 1;
}

.tp-content-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tp-dark);
}

.tp-content-item-meta {
    font-size: 0.75rem;
    color: var(--tp-secondary);
}

.tp-content-item-actions {
    display: flex;
    gap: 0.5rem;
}

.tp-content-item-btn {
    padding: 0.375rem;
    background: transparent;
    border: none;
    color: var(--tp-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--tp-transition);
}

.tp-content-item-btn:hover {
    background: var(--tp-white);
    color: var(--tp-dark);
}

.tp-content-item-btn.delete:hover {
    color: var(--tp-error);
}

/* ============================================
   Test Chat
   ============================================ */
.tp-chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
}

.tp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tp-chat-message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.tp-chat-message.tp-chat-user {
    flex-direction: row-reverse;
}

.tp-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tp-primary);
    color: var(--tp-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.tp-chat-user .tp-chat-avatar {
    background: var(--tp-secondary);
}

.tp-chat-bubble {
    background: var(--tp-light);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 80%;
    font-size: 0.875rem;
    color: var(--tp-dark);
}

.tp-chat-user .tp-chat-bubble {
    background: var(--tp-primary);
    color: var(--tp-white);
}

.tp-chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tp-border);
}

.tp-chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
}

.tp-chat-input:focus {
    outline: none;
    border-color: var(--tp-primary);
}

/* ============================================
   Loading Spinner
   ============================================ */
.tp-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tp-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 640px) {
    .tp-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .tp-header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .tp-category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .tp-tab {
        flex-shrink: 0;
    }

    .tp-content-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tp-upload-options {
        grid-template-columns: 1fr;
    }

    .tp-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .tp-modal-content {
        max-height: 95vh;
        margin: auto 0.5rem;
    }
}
