/* =============================================================================
   CALL EXPLORER - Modern Light Theme (Hawx Design System)
   Aligned with BI Dashboard and Config Dashboard styling
   ============================================================================= */

:root {
    /* Hawx Brand Colors */
    --hawx-primary: #637675;
    --hawx-primary-hover: #546463;
    --hawx-primary-light: rgba(99, 118, 117, 0.1);
    --hawx-accent: #EAB749;
    --hawx-accent-hover: #DFAA3A;

    /* Background colors */
    --bg-light: #f0f2f5;
    --bg-white: #ffffff;
    --bg-card: #ffffff;

    /* Text colors */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Status colors */
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #3b82f6;
    --info-bg: #dbeafe;

    /* Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* UI */
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: 0.15s ease;
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.5;
}

/* =============================================================================
   CONTAINER OVERRIDES
   ============================================================================= */

.container-fluid {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* =============================================================================
   CARD STYLES
   ============================================================================= */

.card {
    background: var(--bg-white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
}

.card-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* =============================================================================
   FILTERS SECTION
   ============================================================================= */

#filtersCard {
    margin-bottom: 1.5rem;
}

#filtersCard .card-header {
    cursor: pointer;
    transition: background var(--transition);
}

#filtersCard .card-header:hover {
    background: var(--gray-100);
}

#filterCollapseBtn {
    border: 1px solid var(--gray-300);
    background: var(--bg-white);
    color: var(--gray-600);
    transition: all var(--transition);
}

#filterCollapseBtn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

#expandFiltersText {
    font-size: 0.875rem;
    color: var(--hawx-primary);
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--hawx-accent);
    color: var(--gray-900);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 10px;
    margin-left: 0.5rem;
}

/* Form Controls */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    background-color: var(--bg-white);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hawx-primary);
    box-shadow: 0 0 0 3px var(--hawx-primary-light);
    outline: none;
}

/* Select2 Customization */
.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    min-height: 42px;
    background: var(--bg-white);
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--hawx-primary);
    box-shadow: 0 0 0 3px var(--hawx-primary-light);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--hawx-primary);
    border: none;
    color: white;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.8125rem;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255, 255, 255, 0.8);
    margin-right: 5px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: white;
    background: transparent;
}

.select2-dropdown {
    border-color: var(--gray-300);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--hawx-primary);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--hawx-primary);
    border-color: var(--hawx-primary);
    color: white;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--hawx-primary-hover);
    border-color: var(--hawx-primary-hover);
    box-shadow: 0 2px 4px rgba(99, 118, 117, 0.3);
}

.btn-outline-secondary {
    background: var(--bg-white);
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-900);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Action Buttons Cell */
td.action-buttons {
    white-space: nowrap;
}

td.action-buttons .btn {
    margin-right: 0.375rem;
}

td.action-buttons .btn:last-child {
    margin-right: 0;
}

/* =============================================================================
   TABLE STYLES
   ============================================================================= */

.table-responsive {
    min-height: 400px;
    border-radius: var(--radius);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Sortable Columns */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 28px;
    transition: background var(--transition);
}

th.sortable:hover {
    background: var(--gray-100);
}

.sort-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.sort-indicator i.bi {
    font-size: 0.75rem;
    color: var(--gray-400);
    transition: color var(--transition);
}

.sort-indicator i.bi.active-sort {
    color: var(--hawx-primary);
}

th.sortable:hover .sort-indicator i.bi {
    color: var(--gray-600);
}

/* Table Row Hover */
.table-hover tbody tr {
    transition: background var(--transition);
    cursor: pointer;
}

.table-hover tbody tr:hover {
    background: var(--hawx-primary-light) !important;
}

/* Call Duration Badge */
.call-duration {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   STATUS BADGES
   ============================================================================= */

.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
}

.badge-inbound {
    background: var(--info-bg);
    color: #1d4ed8;
}

.badge-outbound {
    background: var(--success-bg);
    color: #047857;
}

.badge-manual {
    background: var(--warning-bg);
    color: #92400e;
}

/* =============================================================================
   LOADING & EMPTY STATES
   ============================================================================= */

.loading {
    display: none;
    text-align: center;
    padding: 3rem;
}

.loading.show {
    display: block;
}

.spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 3px;
    color: var(--hawx-primary);
}

.loading p {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

#noData {
    padding: 3rem;
    text-align: center;
}

#noData p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Loading Spinner (Small) */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-200);
    border-top-color: var(--hawx-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =============================================================================
   PAGINATION
   ============================================================================= */

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-100);
}

.pagination-container .d-flex {
    gap: 0.5rem;
}

.pagination-container label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

#pageSize {
    width: auto;
    min-width: 80px;
}

.pagination {
    margin: 0;
    gap: 0.25rem;
}

.pagination .page-link {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.pagination .page-link:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-900);
}

.pagination .page-item.active .page-link {
    background: var(--hawx-primary);
    border-color: var(--hawx-primary);
    color: white;
}

.pagination .page-item.disabled .page-link {
    background: var(--gray-50);
    color: var(--gray-400);
}

/* =============================================================================
   MODAL STYLES
   ============================================================================= */

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

#callDetailModal .modal-dialog {
    max-width: 850px;
}

.modal-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

/* Call Metadata */
.call-metadata {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.call-metadata p {
    margin: 0.375rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.call-metadata strong {
    color: var(--text-primary);
    font-weight: 500;
}

.call-metadata span {
    color: var(--text-primary);
}

/* =============================================================================
   TABS
   ============================================================================= */

.nav-tabs {
    border-bottom: 2px solid var(--gray-200);
    gap: 0.5rem;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 0;
    transition: all var(--transition);
    color: var(--text-secondary);
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--gray-300);
}

.nav-tabs .nav-link.active {
    color: var(--hawx-primary);
    border-bottom-color: var(--hawx-primary);
    background: transparent;
}

.tab-content {
    padding: 1.25rem 0;
}

.tab-pane {
    transition: opacity 0.2s ease;
}

.tab-pane.fade {
    opacity: 0;
}

.tab-pane.fade.show {
    opacity: 1;
}

/* =============================================================================
   QA RESULTS
   ============================================================================= */

.qa-result-pass {
    color: var(--success);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.qa-result-pass::before {
    content: "✓";
    font-size: 0.875rem;
}

.qa-result-fail {
    color: var(--danger);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.qa-result-fail::before {
    content: "✕";
    font-size: 0.875rem;
}

.qa-result-na {
    color: var(--text-muted);
    font-style: italic;
}

/* =============================================================================
   GEMINI RESPONSE
   ============================================================================= */

.gemini-response {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border-left: 4px solid var(--hawx-primary);
    padding: 1.25rem;
    margin-top: 1rem;
    border-radius: var(--radius);
}

.gemini-response h5 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hawx-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gemini-response p {
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin: 0;
}

/* Summary Text */
.summary-text {
    line-height: 1.7;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

/* =============================================================================
   AUDIO PLAYER
   ============================================================================= */

#audioPlayerContainer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to right, #1e293b 0%, #334155 100%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    transition: transform 0.3s ease;
}

#audioPlayerContainer.d-none {
    transform: translateY(100%);
}

#audioPlayerContainer .container {
    padding: 1rem 1.5rem;
}

#closeAudioPlayer {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

#closeAudioPlayer:hover {
    background: rgba(255, 255, 255, 0.2);
}

#nowPlayingText {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.375rem;
}

#audioPlayer {
    height: 40px;
    filter: invert(1);
}

/* Play Audio Buttons */
.play-audio,
.play-detail-audio {
    transition: all var(--transition);
}

.play-audio:hover,
.play-detail-audio:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(99, 118, 117, 0.3);
}

/* =============================================================================
   TRAINING TAB
   ============================================================================= */

#trainingContent {
    min-height: 200px;
}

#trainingContent .card {
    border: 1px solid var(--gray-200);
    margin-bottom: 1rem;
}

#trainingContent .card-header {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
}

/* =============================================================================
   QUESTION INPUT (Ask Gemini)
   ============================================================================= */

#questionInput {
    resize: vertical;
    min-height: 100px;
}

#askQuestion {
    margin-top: 0.5rem;
}

#questionResponse {
    min-height: 50px;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 1200px) {
    .container-fluid {
        padding: 1.25rem 1.5rem;
    }
}

@media (max-width: 992px) {
    .table thead th,
    .table tbody td {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }

    /* Hide less important columns on tablet */
    .table thead th:nth-child(4),
    .table tbody td:nth-child(4) {
        display: none;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }

    .card-header h5 {
        font-size: 0.9375rem;
    }

    .pagination-container {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .pagination-container .d-flex {
        justify-content: center;
    }

    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Hide more columns on mobile */
    .table thead th:nth-child(4),
    .table thead th:nth-child(5),
    .table tbody td:nth-child(4),
    .table tbody td:nth-child(5) {
        display: none;
    }

    #callDetailModal .modal-dialog {
        margin: 0.5rem;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.625rem 0.5rem;
        font-size: 0.75rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.25rem;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

.hidden {
    display: none !important;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ensure body has padding when audio player is visible */
body.audio-player-visible {
    padding-bottom: 80px;
}

/* =============================================================================
   SUMMARY FEEDBACK BUTTON
   ============================================================================= */

.ce-summary-thumbs-down {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
}

.ce-summary-thumbs-down:hover {
    background-color: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}
