/* NinjaAvatar — AI Avatar Video Studio */

/* ===== Override parent section padding ===== */
#section-ninjaavatar.app-section {
    padding: 0;
    max-width: 100%;
}

/* ===== Layout ===== */
.na-cockpit {
    padding: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
}

.na-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 0;
    margin-bottom: 0;
    flex-shrink: 0;
}

.na-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.na-header p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.na-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== Tabs ===== */
.na-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
    padding: 0 16px;
    margin-top: 8px;
    overflow-x: auto;
    flex-shrink: 0;
}

.na-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.na-tab:hover {
    color: var(--text-primary);
}

.na-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

.na-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--border-light);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    padding: 0 5px;
}

.na-tab.active .na-tab-badge {
    background: #7c3aed20;
    color: #7c3aed;
}

.na-tab-content {
    display: none;
    padding: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.na-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ===== Empty state ===== */
.na-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    flex: 1;
}

.na-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.na-empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.na-empty-state p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 20px;
    max-width: 360px;
}

/* ===== Buttons ===== */
.na-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.na-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.na-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.na-btn-secondary:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.na-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.15s;
    flex-shrink: 0;
}

.na-btn-icon:hover {
    border-color: #7c3aed;
    color: #7c3aed;
    background: #f5f3ff;
}

/* ===== Studio — 2-column layout ===== */
.na-studio-layout {
    display: flex;
    gap: 0;
    flex: 1;
    min-height: 0;
}

.na-studio-left {
    width: 340px;
    min-width: 280px;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-body);
}

.na-studio-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 12px 16px;
    gap: 10px;
}

.na-studio-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 10px 12px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== Avatar Grid ===== */
.na-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    padding: 4px 12px 12px;
    flex: 1;
    align-content: start;
}

.na-avatar-card {
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.na-avatar-card:hover {
    border-color: #c4b5fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
}

.na-avatar-card.selected {
    border-color: #7c3aed;
    box-shadow:
        0 0 0 2px #7c3aed40,
        0 4px 12px rgba(124, 58, 237, 0.15);
}

.na-avatar-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}

.na-avatar-card-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 4px 4px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.na-avatar-card.selected .na-avatar-card-name {
    color: #7c3aed;
}

.na-avatar-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 16px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Gender filter buttons ===== */
.na-gender-filter {
    display: flex;
    gap: 2px;
}

.na-filter-btn {
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.na-filter-btn:hover {
    border-color: #c4b5fd;
    color: var(--text-primary);
}

.na-filter-btn.active {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

/* ===== Selected avatar info ===== */
.na-selected-info {
    padding: 8px 0;
    min-height: 32px;
    display: flex;
    align-items: center;
}

.na-selected-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    background: #f5f3ff;
    border: 1px solid #e9d5ff;
    padding: 4px 12px;
    border-radius: 6px;
}

.na-selected-badge strong {
    color: #7c3aed;
}

/* ===== Form cards (Voice, Script, Format sections) ===== */
.na-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
}

.na-form-card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== Voice source toggle (HeyGen / ElevenLabs) ===== */
.na-voice-source-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 2px;
}

.na-source-btn {
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.na-source-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.na-source-btn.active {
    background: #7c3aed;
    color: #fff;
    box-shadow: 0 1px 3px rgba(124, 58, 237, 0.3);
}

/* ===== Select dropdowns ===== */
.na-select {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-body);
    box-sizing: border-box;
    transition: border-color 0.15s;
    cursor: pointer;
}

.na-select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px #7c3aed20;
}

.na-select-small {
    padding: 4px 8px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-body);
    cursor: pointer;
    transition: border-color 0.15s;
}

.na-select-small:focus {
    outline: none;
    border-color: #7c3aed;
}

/* ===== Script textarea ===== */
.na-script-textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    box-sizing: border-box;
    resize: vertical;
    transition: border-color 0.15s;
    font-family: inherit;
    flex: 1;
}

.na-script-textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px #7c3aed20;
}

.na-script-textarea::placeholder {
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== Script meta (word count, time, cost) ===== */
.na-script-meta {
    display: flex;
    gap: 16px;
    padding: 6px 0 0;
    font-size: 11px;
    color: var(--text-muted);
}

.na-script-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ===== Template cards (Szablony tab) ===== */
.na-template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 10px;
    transition: all 0.15s;
    cursor: pointer;
}

.na-template-card:hover {
    border-color: #7c3aed;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

.na-template-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.na-template-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.na-template-card-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.na-template-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

/* ===== Video gallery grid ===== */
.na-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 12px 16px;
}

.na-video-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.15s;
}

.na-video-card:hover {
    border-color: #7c3aed;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

.na-video-thumb {
    width: 100%;
    aspect-ratio: 9/16;
    background: #1e1b4b;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.na-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.na-video-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.na-video-play-btn {
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.15s;
}

.na-video-play-btn:hover {
    transform: scale(1.1);
}

.na-video-info {
    padding: 10px 12px;
}

.na-video-info-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.na-video-info-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.na-video-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.na-video-status.completed {
    background: #dcfce7;
    color: #16a34a;
}

.na-video-status.processing {
    background: #fef3c7;
    color: #d97706;
}

.na-video-status.failed {
    background: #fef2f2;
    color: #ef4444;
}

/* ===== Settings panel ===== */
.na-settings {
    max-width: 600px;
    padding: 12px 16px;
}

.na-settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.na-settings-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.na-form-group {
    margin-bottom: 12px;
}

.na-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.na-form-group input,
.na-form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-body);
    box-sizing: border-box;
}

.na-form-group input:focus,
.na-form-group select:focus {
    outline: none;
    border-color: #7c3aed;
}

.na-form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Stats ===== */
.na-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.na-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.na-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .na-studio-layout {
        flex-direction: column;
    }
    .na-studio-left {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        max-height: 40vh;
    }
    .na-avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
    }
    .na-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
