/* NinjaVoice Cockpit — AI Telemarketer Management */

/* ===== Layout ===== */
.nv-cockpit {
    padding: 0;
    max-width: 100%;
}

.nv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
    margin-bottom: 0;
}

.nv-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.nv-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

/* ===== Tabs ===== */
.nv-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
    padding: 0 24px;
    margin-top: 16px;
    overflow-x: auto;
}

.nv-tab {
    padding: 10px 18px;
    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;
}

.nv-tab:hover {
    color: var(--text-primary);
}

.nv-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

.nv-tab-content {
    display: none;
    padding: 20px 24px;
}

.nv-tab-content.active {
    display: block;
}

/* ===== KPI Cards ===== */
.nv-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.nv-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 18px 20px;
}

.nv-kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nv-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 4px 0;
    line-height: 1.2;
}

.nv-kpi-change {
    font-size: 12px;
    color: var(--text-muted);
}

.nv-kpi-change.positive { color: #22c55e; }
.nv-kpi-change.negative { color: #ef4444; }

/* ===== Live Calls ===== */
.nv-live-section {
    margin-bottom: 24px;
}

.nv-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nv-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: nv-pulse 2s infinite;
}

@keyframes nv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.nv-live-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nv-live-call {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    font-size: 13px;
}

.nv-live-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nv-live-status.active { background: #22c55e; }
.nv-live-status.ringing { background: #f59e0b; animation: nv-pulse 1s infinite; }

.nv-live-phone {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
}

.nv-live-agent {
    color: #7c3aed;
    min-width: 80px;
}

.nv-live-duration {
    color: var(--text-muted);
    min-width: 50px;
}

.nv-live-status-text {
    color: var(--text-secondary);
    flex: 1;
    font-style: italic;
}

/* ===== Tables ===== */
.nv-table-wrapper {
    overflow-x: auto;
}

.nv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.nv-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.nv-table td {
    padding: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.nv-table tr:hover td {
    background: rgba(124, 58, 237, 0.03);
}

.nv-table tr:last-child td {
    border-bottom: none;
}

/* ===== Badges ===== */
.nv-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.nv-badge.draft { background: #f1f5f9; color: #64748b; }
.nv-badge.running { background: #dcfce7; color: #16a34a; }
.nv-badge.paused { background: #fef3c7; color: #d97706; }
.nv-badge.completed { background: #dbeafe; color: #2563eb; }
.nv-badge.scheduled { background: #f3e8ff; color: #7c3aed; }
.nv-badge.answered { background: #dcfce7; color: #16a34a; }
.nv-badge.no_answer { background: #fee2e2; color: #dc2626; }
.nv-badge.busy { background: #fef3c7; color: #d97706; }
.nv-badge.pending { background: #f1f5f9; color: #64748b; }
.nv-badge.calling { background: #dbeafe; color: #2563eb; }
.nv-badge.qualified { background: #dcfce7; color: #16a34a; }

/* ===== Buttons ===== */
.nv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.15s;
}

.nv-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.nv-btn.primary {
    background: #7c3aed;
    color: white;
    border-color: #7c3aed;
}

.nv-btn.primary:hover {
    background: #6d28d9;
}

.nv-btn.success {
    background: #22c55e;
    color: white;
    border-color: #22c55e;
}

.nv-btn.danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.nv-btn.small {
    padding: 5px 10px;
    font-size: 12px;
}

/* ===== Actions Bar ===== */
.nv-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== Campaign Card ===== */
.nv-campaign-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.nv-campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.15s;
}

.nv-campaign-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.nv-campaign-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.nv-campaign-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.nv-campaign-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.nv-campaign-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.nv-campaign-stat {
    text-align: center;
}

.nv-campaign-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.nv-campaign-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.nv-campaign-progress {
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0;
}

.nv-campaign-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 3px;
    transition: width 0.3s;
}

.nv-campaign-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ===== Call Detail (expandable row) ===== */
.nv-call-detail {
    padding: 16px;
    background: #fafaff;
    border-radius: 8px;
    margin: 8px 0;
}

.nv-transcript {
    font-size: 13px;
    line-height: 1.7;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.nv-transcript-line {
    margin-bottom: 6px;
}

.nv-transcript-role {
    font-weight: 600;
    display: inline;
}

.nv-transcript-role.agent { color: #7c3aed; }
.nv-transcript-role.user { color: #2563eb; }

/* ===== Score Badge ===== */
.nv-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}

.nv-score.high { background: #dcfce7; color: #16a34a; }
.nv-score.medium { background: #fef3c7; color: #d97706; }
.nv-score.low { background: #fee2e2; color: #dc2626; }

/* ===== Empty State ===== */
.nv-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.nv-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.nv-empty-text {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ===== Hourly Chart (simple CSS bars) ===== */
.nv-hourly-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 80px;
    padding: 0;
    margin-bottom: 24px;
}

.nv-hourly-bar {
    flex: 1;
    background: linear-gradient(180deg, #7c3aed, #a78bfa);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    position: relative;
}

.nv-hourly-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--text-muted);
}

/* ===== Modal ===== */
.nv-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nv-modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.nv-modal h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text-primary);
}

.nv-form-group {
    margin-bottom: 16px;
}

.nv-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.nv-form-group input,
.nv-form-group select,
.nv-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-card);
    box-sizing: border-box;
}

.nv-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.nv-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.nv-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ===== Audio Player ===== */
.nv-audio-player {
    margin-top: 8px;
}

.nv-audio-player audio {
    width: 100%;
    height: 32px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nv-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .nv-campaign-cards {
        grid-template-columns: 1fr;
    }
    .nv-tabs {
        padding: 0 12px;
    }
    .nv-tab-content {
        padding: 16px 12px;
    }
    .nv-form-row {
        grid-template-columns: 1fr;
    }
}
