/* ==============================================
   LK-Call Dashboard - Dashboard Styles
   ============================================== */

/* Call List Items */
.call-item {
    padding: 12px 15px;
    border: 1px solid #dee2e6;
    margin: 8px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.call-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.call-item.completed {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.call-item.failed {
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.call-item.default {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.call-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.call-item-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.call-item-id {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.call-item-duration {
    color: #666;
    font-size: 13px;
}

.call-item-date {
    text-align: right;
    color: #666;
    font-size: 13px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error-state {
    text-align: center;
    padding: 40px;
    color: #f00;
}

/* Modal Styles */
.modal-content-container {
    max-height: 75vh;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.modal-two-column {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* AI Evaluation Section */
.ai-evaluation-section {
    /* Left column container */
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.section-indicator {
    width: 4px;
    height: 20px;
    border-radius: 2px;
}

.section-indicator.ai-evaluation {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.section-indicator.call-details {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.section-indicator.no-data {
    background: linear-gradient(135deg, #cbd5e0 0%, #a0aec0 100%);
}

.section-title {
    margin: 0;
    color: #1a202c;
    font-size: 16px;
    font-weight: 600;
}

.section-title.no-data {
    color: #718096;
}

.ai-evaluation-card {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
}

.ai-evaluation-summary {
    margin-bottom: 16px;
}

.evaluation-label {
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.evaluation-text {
    color: #1f2937;
    line-height: 1.5;
    font-size: 14px;
}

.evaluation-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.metric-item {
    text-align: center;
}

.metric-score {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-score.high { color: #10B981; }
.metric-score.medium { color: #F59E0B; }
.metric-score.low { color: #EF4444; }

.metric-verified-yes { color: #10B981; }
.metric-verified-no { color: #EF4444; }

.metric-label {
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
}

.metric-outcome {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.evaluation-issues {
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

.evaluation-other-fields {
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.other-fields-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.issues-label {
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.issues-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.issue-tag {
    background: #fee2e2;
    color: #dc2626;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

/* No Data State */
.no-data-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #718096;
}

.no-data-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* Call Details Section */
.call-details-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
}

.call-details-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.call-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f7fafc;
}

.call-detail-item:last-child {
    border-bottom: none;
}

.call-detail-label {
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
}

.call-detail-value {
    color: #1f2937;
    font-weight: 600;
}

.call-detail-value.monospace {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 13px;
}

.call-detail-value-with-copy {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.completed {
    background: #10B981;
    color: white;
}

.status-badge.failed {
    background: #EF4444;
    color: white;
}

/* Copy Button */
.copy-button {
    padding: 2px 6px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: #6b7280;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.copy-button:hover {
    background: #e5e7eb;
}

.copy-button.success {
    background: #10b981;
    color: white;
}

/* Event Tooltip */
.event-tooltip {
    position: fixed;
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
    transform: translateX(-50%) translateY(-120%);
}

.tooltip-event-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.tooltip-timestamp {
    color: #d1d5db;
    font-size: 11px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-two-column {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .call-item-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .call-item-left {
        justify-content: space-between;
    }
    
    .call-item-date {
        text-align: left;
    }
    
    .evaluation-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .metric-score {
        font-size: 20px;
    }

    .call-detail-item {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        text-align: left;
    }
    
    .call-detail-value-with-copy {
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .modal-content-container {
        max-height: 85vh;
        padding: 10px;
    }
    
    .modal-two-column {
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .ai-evaluation-card,
    .call-details-card {
        padding: 15px;
    }
    
    .section-title {
        font-size: 14px;
    }
    
    .evaluation-metrics {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .call-item {
        padding: 10px 12px;
        margin: 6px 0;
    }
    
    .call-item-id {
        font-size: 13px;
    }
    
    .call-item-duration,
    .call-item-date {
        font-size: 12px;
    }
}

/* Play Button Styles */
.play-button {
    margin-left: auto;
    padding: 6px 10px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}

.play-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.play-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.play-button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.play-button svg {
    width: 16px;
    height: 16px;
}

/* Spinning animation for loading state */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.play-button svg.spin {
    animation: spin 1s linear infinite;
}

/* Recording Buttons (for inline play/download) */
.recording-button {
    padding: 6px 8px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 12px;
}

.recording-button:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.recording-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.recording-button:first-child {
    background: #3b82f6;
    color: white;
    border-color: #2563eb;
}

.recording-button:first-child:hover {
    background: #2563eb;
    border-color: #1d4ed8;
}

/* Section indicator for call recording */
.section-indicator.call-recording {
    background: #8b5cf6;
}

/* Inline Audio Player Styling */
.audio-player-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin: 10px 0;
}

.inline-audio-player audio {
    width: 100%;
    height: 32px;
    background: white;
    border-radius: 4px;
}

/* Custom audio controls styling */
.inline-audio-player audio::-webkit-media-controls-panel {
    background-color: white;
    border-radius: 4px;
}

.inline-audio-player audio::-webkit-media-controls-play-button {
    background-color: #3b82f6;
    border-radius: 50%;
}

.inline-audio-player audio::-webkit-media-controls-current-time-display,
.inline-audio-player audio::-webkit-media-controls-time-remaining-display {
    color: #374151;
    font-size: 12px;
}

/* Call History Section - New Design */
.call-history-card {
    background: #f5f5f5;
    border: none;
    padding: 0;
}

.call-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.call-history-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.call-history-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.call-campaign-filter {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
    transition: border-color 0.2s;
    background-color: white;
    cursor: pointer;
}

.call-campaign-filter:focus {
    outline: none;
    border-color: #4a90e2;
}

.call-search-input {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 250px;
    transition: border-color 0.2s;
}

.call-search-input:focus {
    outline: none;
    border-color: #4a90e2;
}

.call-search-input::placeholder {
    color: #999;
}

.call-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.call-btn-search {
    background: #4a90e2;
    color: white;
}

.call-btn-search:hover {
    background: #357abd;
}

.call-btn-clear {
    background: white;
    color: #666;
    border: 1px solid #ddd;
}

.call-btn-clear:hover {
    background: #f5f5f5;
}

.call-btn-refresh {
    background: #4caf50;
    color: white;
}

.call-btn-refresh:hover {
    background: #45a049;
}

.call-btn-export {
    background: #ff9800;
    color: white;
}

.call-btn-export:hover {
    background: #e68900;
}

/* Call List */
.call-list {
    padding: 15px;
    background: #f5f5f5;
    min-height: 400px;
    overflow-x: hidden;
}

/* Call Entry Cards */
.call-entry {
    background: #e0e0e0;
    border-radius: 6px;
    padding: 12px 20px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-width: 0;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.call-entry:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Success state - completed with evaluation data */
.call-entry-success {
    background: #c8e6c9;
}

.call-entry-success:hover {
    background: #b2d4b3;
}

/* Warning state - completed but no evaluation data */
.call-entry-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.call-entry-warning:hover {
    background: #ffe69c;
}

.call-entry-warning .call-entry-id {
    color: #856404;
}

/* Failed state */
.call-entry-failed {
    background: #ffcdd2;
}

.call-entry-failed:hover {
    background: #ffb3b8;
}

.call-entry-failed .call-entry-id {
    color: #c62828;
}

.call-entry-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    flex-wrap: wrap;
    min-width: 0;
}

.call-entry-id {
    font-size: 15px;
    font-weight: 500;
    color: #2e7d32;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 40ch;
}

.call-entry-duration {
    font-size: 14px;
    color: #666;
    background: rgba(255,255,255,0.5);
    padding: 2px 8px;
    border-radius: 4px;
}

.call-entry-badge {
    font-size: 12px;
    color: #856404;
    background: rgba(255,193,7,0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    margin-left: 10px;
}

.call-entry-campaign {
    font-size: 12px;
    color: #546e7a;
    background: rgba(96, 125, 139, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    margin-left: 8px;
}

.call-entry-termination-reason {
    font-size: 13px;
    color: #c62828;
    background: rgba(255,255,255,0.7);
    padding: 3px 10px;
    border-radius: 4px;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 10px;
    font-weight: 500;
    border: 1px solid rgba(198,40,40,0.2);
    cursor: default;
}

.call-entry-termination-reason:hover {
    max-width: none;
    white-space: normal;
    word-break: break-word;
    z-index: 10;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.call-entry-timestamp {
    font-size: 14px;
    color: #666;
    flex: 0 0 auto;
}

/* Empty states */
.call-list .empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

.call-list .error-state {
    text-align: center;
    padding: 40px;
    color: #f44336;
    font-size: 16px;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

/* Responsive adjustments for narrow layouts */
@media (max-width: 900px) {
    .call-history-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .call-history-controls {
        justify-content: flex-start;
        gap: 8px;
    }
    .call-campaign-filter,
    .call-search-input {
        width: 100%;
        max-width: 100%;
    }
    .call-btn {
        flex: 0 0 auto;
    }

    .call-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .call-entry-timestamp {
        align-self: flex-start;
    }
    .call-entry-id {
        max-width: 100%;
        white-space: normal;
    }
    .call-entry-termination-reason {
        max-width: 100%;
    }
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #999;
}

.pagination-btn:disabled,
.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9f9f9;
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.pagination-count {
    color: #666;
    font-weight: normal;
    font-size: 13px;
}

#currentPage,
#totalPages {
    font-weight: 600;
    color: #4a90e2;
}

#totalCalls {
    font-weight: 500;
}

@media (max-width: 600px) {
    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .pagination-info {
        justify-content: center;
    }
}
