/* ============================================
   AI Voice Actor Recommendation System
   Integrated with SoundMonkey design system
   ============================================ */

/* --- Page Layout --- */

/* --- Page Container --- */
.voice-ai-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 30px 80px;
    transition: max-width 0.4s ease;
}

/* When results are showing, expand to 1500px */
.voice-ai-page.has-results {
    max-width: 1500px;
    padding-left: 20px;
    padding-right: 20px;
}

/* --- Hero Section --- */
.vai-hero {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px 20px;
}

.vai-hero h1 {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    line-height: 1.3;
}

.vai-hero p {
    font-size: 1.05rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* --- Results Area --- */
.vai-results {
    display: none;
    margin-top: 50px;
}

.vai-results.active {
    display: block;
    animation: vai-fadeIn 0.5s ease;
}

/* Results layout */
.vai-results-layout {
    display: block;
}

.vai-results-sidebar {
    display: none;
}

.vai-results-main {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

/* Chat section when inside sidebar */
.vai-results-sidebar .vai-chat-section {
    margin-bottom: 0;
}

/* Analysis summary card in sidebar: compact */
.vai-analysis-summary-card {
    padding: 24px;
}

.vai-analysis-summary-card .vai-section-title {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

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

/* --- Analysis Card --- */
.vai-analysis-card {
    background: white;
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    margin-bottom: 40px;
    border: 1px solid #f0f0f0;
}

.vai-section-title {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vai-section-title i {
    color: #667eea;
}

/* AI Summary Sentence */
.vai-summary {
    display: none;
    align-items: flex-start;
    gap: 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.06) 0%, rgba(118, 75, 162, 0.06) 100%);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 28px;
    animation: vai-fadeIn 0.5s ease;
}

.vai-summary.active {
    display: flex;
}

.vai-summary-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    margin-top: 2px;
}

.vai-summary-text {
    font-size: 1.05rem;
    line-height: 1.75;
    color: #333;
    font-weight: 500;
    word-break: keep-all;
}

/* Analysis Meta */
.vai-meta-row {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.vai-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    background: #f8f7ff;
    color: #5b4ea0;
    border: 1px solid #e8e4ff;
}

.vai-meta-badge i {
    font-size: 1rem;
}

.vai-meta-badge.confidence {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.vai-meta-badge.confidence.low {
    background: #fef9ee;
    color: #92400e;
    border-color: #fde68a;
}

/* Tag Weights */
.vai-tags-group {
    margin-bottom: 24px;
}

.vai-tags-group:last-child {
    margin-bottom: 0;
}

.vai-tags-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 12px;
}

.vai-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vai-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.vai-tag.age {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(22, 163, 74, 0.08));
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.vai-tag.age .vai-tag-bar {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.vai-tag.tone {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #5b4ea0;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.vai-tag.emotion {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(219, 39, 119, 0.08));
    color: #9d174d;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.vai-tag-weight {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.7;
}

.vai-tag-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 10px 10px;
    transition: width 0.5s ease;
}

.vai-tag.tone .vai-tag-bar {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.vai-tag.emotion .vai-tag-bar {
    background: linear-gradient(90deg, #ec4899, #db2777);
}

/* --- Actor Cards Grid (fixed 4 columns) --- */
.vai-actors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    padding: 0;
}

/* Explore section divider */
.vai-explore-title {
    padding-top: 30px;
    border-top: 2px solid #e5e7eb;
}

.vai-actor-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 20px;
    cursor: default;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 140px;
}

.vai-actor-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.vai-actor-card .card-main-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

/* Avatar */
.vai-card-avatar {
    flex-shrink: 0;
    cursor: pointer;
    margin-top: 2px;
}

.vai-card-avatar img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f0f0f0;
    transition: all 0.3s ease;
}

.vai-card-avatar img:hover {
    border-color: #667eea;
}

.vai-default-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #999;
}

/* Info section */
.vai-card-info {
    flex: 1;
    min-width: 0;
}

.vai-card-name {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0 0 8px;
    font-size: 1rem;
}

.vai-card-name a {
    font-size: 1.05rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.vai-card-name a:hover {
    color: #667eea;
}

/* Agency badge */
.vai-agency-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.vai-agency-badge.association {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.vai-agency-badge.agency {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}

.vai-agency-badge.general {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Gender badge */
.vai-gender-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
}

.vai-gender-badge.male {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.vai-gender-badge.female {
    background: #fce7f3;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}

.vai-card-sample-title {
    font-size: 0.92rem;
    color: #444;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.5;
    word-break: keep-all;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vai-card-genre {
    display: inline-block;
    background: #f1f5f9;
    color: #64748b;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    border: 1px solid #e2e8f0;
}

.vai-card-genre i {
    margin-right: 3px;
    font-size: 0.7rem;
}

/* Action buttons (play + select) */
.vai-card-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.vai-play-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.vai-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.vai-play-btn.playing {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.vai-select-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.vai-select-btn:hover {
    background: #667eea;
    color: white;
}

.vai-select-btn.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
}

/* Tag strip on cards */
.vai-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.vai-card-tags .category-tag {
    background: #e0f2fe;
    color: #0277bd;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.73rem;
    border: 1px solid #b3e5fc;
}

/* Selected samples popup (same UI structure as index_main) */
.selected-popup {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 350px !important;
    max-height: 80vh !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
    z-index: 10000001 !important;
    overflow: hidden !important;
    border: 1px solid #e5e7eb !important;
}

.selected-popup .popup-header {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
    color: white !important;
    padding: 15px 20px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.selected-popup .popup-header h3 {
    margin: 0 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
}

.selected-popup .close-popup {
    background: none !important;
    border: none !important;
    color: white !important;
    font-size: 1.2rem !important;
    cursor: pointer !important;
    padding: 5px !important;
    border-radius: 4px !important;
    transition: background 0.3s ease !important;
}

.selected-popup .close-popup:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.selected-popup .popup-content {
    max-height: calc(80vh - 60px) !important;
    overflow-y: auto !important;
}

.selected-popup .selected-samples-list {
    padding: 15px !important;
    max-height: 400px !important;
    overflow-y: auto !important;
}

.selected-popup .selected-sample-item {
    display: flex !important;
    align-items: center !important;
    padding: 12px !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    margin-bottom: 10px !important;
    background: #f8f9fa !important;
    transition: all 0.3s ease !important;
}

.selected-popup .selected-sample-item:hover {
    background: #e9ecef !important;
    transform: translateY(-1px) !important;
}

.selected-popup .sample-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    margin-right: 12px !important;
    object-fit: cover !important;
}

.selected-popup .sample-info {
    flex: 1 !important;
}

.selected-popup .sample-actor-name {
    font-weight: 600 !important;
    color: #1f2937 !important;
    font-size: 0.9rem !important;
    margin-bottom: 2px !important;
}

.selected-popup .sample-title {
    color: #6b7280 !important;
    font-size: 0.8rem !important;
    margin: 0 !important;
    font-weight: 500 !important;
}

.selected-popup .remove-sample {
    background: #ef4444 !important;
    color: white !important;
    border: none !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.7rem !important;
    transition: all 0.3s ease !important;
}

.selected-popup .remove-sample:hover {
    background: #dc2626 !important;
    transform: scale(1.1) !important;
}

.selected-popup .popup-actions {
    padding: 15px 20px !important;
    border-top: 1px solid #e5e7eb !important;
    background: #f8f9fa !important;
    display: flex !important;
    gap: 10px !important;
}

.selected-popup .action-btn {
    flex: 1 !important;
    padding: 12px 16px !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-size: 0.9rem !important;
}

.selected-popup .favorite-btn {
    background: #ec4899 !important;
    color: white !important;
}

.selected-popup .favorite-btn:hover {
    background: #db2777 !important;
    transform: translateY(-1px) !important;
}

.selected-popup .inquiry-btn {
    background: #10b981 !important;
    color: white !important;
}

.selected-popup .inquiry-btn:hover {
    background: #059669 !important;
    transform: translateY(-1px) !important;
}

.selected-popup .empty-selection {
    text-align: center !important;
    padding: 40px 20px !important;
    color: #6b7280 !important;
}

.selected-popup .empty-selection i {
    font-size: 2rem !important;
    margin-bottom: 10px !important;
    opacity: 0.5 !important;
}

/* Force footer audio bar to viewport center */
#audio-player-footer {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
}

/* --- Favorite Modal --- */
.vai-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vai-modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

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

.vai-modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.vai-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 10px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.vai-modal-close:hover {
    background: #e5e7eb;
    color: #333;
}

.vai-modal-body {
    padding: 0;
}

/* --- Chat Bottom Modal --- */
.vai-chat-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10000005;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.35);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.vai-chat-fab::before {
    content: "제 도움이 필요하시면 클릭해주세요!";
    position: absolute;
    right: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: #ffffff;
    color: #374151;
    border: 1px solid #dbe3f4;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
    pointer-events: none;
}

.vai-chat-fab::after {
    content: "";
    position: absolute;
    right: 58px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 9px solid #ffffff;
    pointer-events: none;
}

.vai-chat-fab:hover {
    transform: translateY(-2px);
}

.vai-chat-fab.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

.vai-chat-fab-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.vai-chat-fab-label {
    display: none;
}

.vai-chat-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 10000010;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.vai-chat-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.vai-chat-modal-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: min(460px, calc(100vw - 48px));
    margin: 0;
    z-index: 10000020;
    display: none;
    max-height: calc(100vh - 48px);
}

.vai-chat-modal-panel.open {
    display: flex;
    animation: vai-chat-modal-up 0.2s ease;
}

@keyframes vai-chat-modal-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Chat Section --- */
.vai-chat-section {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Modal visibility control (must override base .vai-chat-section display) */
.vai-chat-section.vai-chat-modal-panel {
    display: none;
}

.vai-chat-section.vai-chat-modal-panel.open {
    display: flex;
}

.vai-chat-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f7ff;
}

.vai-chat-header-main {
    min-width: 0;
}

.vai-chat-section-title {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.vai-chat-section-title i {
    color: #667eea;
    font-size: 1.2rem;
}

.vai-monkey-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.vai-monkey-emoji {
    font-size: 1.1rem;
    line-height: 1;
}

.vai-chat-hint {
    font-size: 0.82rem;
    color: #888;
    margin: 0;
    line-height: 1.6;
}

.vai-chat-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    background: #eceffd;
    color: #5b4ea0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.vai-chat-modal-close:hover {
    background: #dfe4ff;
}

.vai-chat-modal-panel .vai-chat-messages {
    max-height: min(420px, calc(100vh - 300px));
}

.vai-chat-messages {
    display: none;
    max-height: 1500px;
    overflow-y: auto;
    padding: 16px 20px 8px;
    flex-direction: column;
    gap: 12px;
}

.vai-chat-messages.active {
    display: flex;
}

.vai-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.vai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.vai-chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* Chat Bubble */
.vai-chat-bubble {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 85%;
    animation: vai-fadeIn 0.3s ease;
}

.vai-chat-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.vai-chat-bubble.assistant {
    align-self: flex-start;
}

.vai-chat-avatar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.vai-chat-bubble.user .vai-chat-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.vai-chat-bubble.assistant .vai-chat-avatar {
    background: linear-gradient(135deg, #a0522d, #8B4513);
    color: white;
}

.vai-chat-text {
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.65;
    word-break: keep-all;
}

.vai-chat-bubble.user .vai-chat-text {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 6px;
}

.vai-chat-bubble.assistant .vai-chat-text {
    background: #f3f4f6;
    color: #333;
    border-bottom-left-radius: 6px;
}

.vai-chat-text.vai-analysis-chat {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1px solid rgba(102, 126, 234, 0.15);
    font-size: 0.92rem;
    line-height: 1.8;
}

/* Typing indicator */
.vai-chat-bubble.typing {
    align-self: flex-start;
    max-width: none;
}

.vai-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 12px 20px;
    background: #f3f4f6;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
}

.vai-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: vai-typingBounce 1.2s infinite ease-in-out;
}

.vai-typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.vai-typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes vai-typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat Image Preview */
.vai-chat-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.vai-chat-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #667eea;
}

.vai-chat-preview-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #ef4444;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.vai-chat-preview-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Chat Image Bubble (inside conversation) */
.vai-chat-img-bubble {
    max-width: 200px;
}

.vai-chat-img-bubble img {
    width: 100%;
    border-radius: 14px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    display: block;
}

/* Chat Image Upload Button */
.vai-chat-img-btn {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    border: 2px solid #e5e7eb;
    background: white;
    color: #667eea;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.vai-chat-img-btn:hover {
    border-color: #667eea;
    background: #f8f7ff;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* Chat Input */
.vai-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.vai-chat-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    background: #fafafa;
}

.vai-chat-input:focus {
    border-color: #667eea;
    background: white;
}

.vai-chat-input::placeholder {
    color: #aaa;
}

.vai-chat-send {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.vai-chat-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.vai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* --- Empty State --- */
.vai-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.vai-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* --- Error State --- */
.vai-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 16px 24px;
    color: #991b1b;
    margin-bottom: 24px;
    display: none;
}

.vai-error.active {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vai-error i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .vai-results-layout {
        flex-direction: column;
    }

    .vai-results-sidebar {
        width: 100%;
        position: static;
    }

    .voice-ai-page.has-results {
        max-width: 100%;
    }

    .vai-actors-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 599px) {
    .vai-actors-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .voice-ai-page {
        padding: 20px 16px 60px;
    }

    .vai-hero h1 {
        font-size: 1.7rem;
    }

    .vai-hero p {
        font-size: 0.95rem;
    }

    .vai-analysis-card {
        padding: 24px 20px;
    }

    .vai-meta-row {
        gap: 10px;
    }

    .vai-meta-badge {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .vai-actor-card {
        padding: 14px;
    }

    .vai-card-avatar img,
    .vai-default-avatar {
        width: 48px;
        height: 48px;
    }

    .vai-play-btn {
        width: 38px;
        height: 38px;
    }

    .selected-popup {
        left: 10px !important;
        right: 10px !important;
        top: auto !important;
        bottom: 100px !important;
        width: auto !important;
        max-height: 60vh !important;
    }

    .vai-section-title {
        font-size: 1.2rem;
    }

    .vai-chat-fab {
        right: 12px;
        bottom: 12px;
        width: 52px;
        height: 52px;
    }

    .vai-chat-fab::before {
        right: 62px;
        font-size: 12px;
        padding: 8px 10px;
        max-width: min(220px, calc(100vw - 90px));
        white-space: normal;
        line-height: 1.35;
    }

    .vai-chat-fab::after {
        right: 54px;
    }

    .vai-chat-modal-panel {
        right: 12px;
        left: auto;
        width: min(460px, calc(100vw - 24px));
        bottom: 12px;
        max-height: calc(100vh - 24px);
    }

    .vai-chat-modal-panel .vai-chat-messages {
        height: 250px;
    }

    .vai-chat-bubble {
        max-width: 90%;
    }

    .vai-chat-text {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .vai-chat-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .vai-summary {
        padding: 16px 18px;
        gap: 10px;
    }

    .vai-summary-icon {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .vai-summary-text {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .voice-ai-page {
        padding: 14px 12px 50px;
    }

    .vai-hero {
        padding: 20px 10px 14px;
    }

    .vai-hero h1 {
        font-size: 1.4rem;
    }
}
