/* 
 * Psychic Source Transcript Analysis Tool - Main stylesheet
 */

:root {
    /* Core Theme Colors */
    --primary-color: #3A0CA3; /* Deep Indigo */
    --secondary-color: #48BFE3; /* Muted Teal */

    /* Neutral Colors */
    --dark-gray: #343a40;
    --light-gray: #F8F9FA;
    --border-gray: #E9ECEF;
    --text-muted: #6c757d;
    --white: #ffffff;

    /* Data Visualization Palette (Update based on new theme) */
    --viz-color-1: #3A0CA3; /* Primary Indigo */
    --viz-color-2: #7209B7; /* Purple */
    --viz-color-3: #F72585; /* Magenta/Pink */
    --viz-color-4: #4CC9F0; /* Light Blue */
    --viz-accent: #48BFE3; /* Accent Teal */
    /* Add more viz colors as needed */

    /* Derived Shades (Examples - adjust as needed based on NEW primary) */
    --primary-light-shade: #B5A4FF; /* Example Light Indigo for Agent Bubble? - TBC */
    --secondary-light-shade: #CAF0F8; /* Example Light Teal for KPI Icon BG? - TBC */

    /* Standard Bootstrap Colors (for reference or overrides) */
    --blue: #0d6efd;
    --indigo: #6610f2;
    --purple: #6f42c1;
    --pink: #d63384;
    --red: #dc3545;
    --orange: #fd7e14;
    --yellow: #ffc107;
    --green: #198754;
    --teal: #20c997;
    --cyan: #0dcaf0;

    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --lily-color: #9370db;
    --caller-color: #f9a825;
    --lily-gradient: linear-gradient(135deg, #8a65df 0%, #6a5acd 100%);
    --caller-gradient: linear-gradient(135deg, #ffb74d 0%, #f9a825 100%);

    /* === Competitive Intelligence Section Styles === */
    --psi-urgent-red:#ff5252;
    --psi-deep-purple:#311b92;
    --psi-teal:#00bfa5;
    --psi-surface:#f7f9fc;
}

body {
    font-family: 'Lato', sans-serif; /* Default body font */
    color: var(--dark-gray);
    background: linear-gradient(to bottom, var(--white) 0%, var(--light-gray) 100%);
    min-height: 100vh;
    /* Add Lato font import if needed */
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-color); /* Default heading color - NOW USES NEW PRIMARY */
    /* Add Montserrat font import if needed */
}

/* Import Google Fonts - Lato and Montserrat */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Montserrat:wght@400;700&display=swap');

/* General Styling */
.content-section {
    /* Existing code */
}

/* Navbar customization */
.navbar-dark.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Card customizations */
.card {
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-gray);
    background: linear-gradient(to bottom right, var(--white) 85%, var(--light-gray) 100%);
}

.card-header {
    border-top-left-radius: 0.5rem !important;
    border-top-right-radius: 0.5rem !important;
}

.card-header.bg-primary {
    background-color: var(--primary-color) !important;
    /* Ensure text is readable on primary background */
    color: var(--white) !important; 
}

.card-header.bg-primary .card-title,
.card-header.bg-primary h5,
.card-header.bg-primary h5 i {
    color: var(--white) !important; /* Ensure title text and icons are white */
}

.card-header.bg-primary .card-title {
    color: var(--white) !important; /* Ensure title text is also white */
}

.card-header.bg-primary .card-title i {
    color: var(--white) !important; /* Ensure icons in title are also white */
}

/* Ensure card bodies handle content flow correctly */
.card-body {
    display: flex;
    flex-direction: column; /* Ensure vertical flow inside card body */
    flex-grow: 1; /* Allow body to grow */
    min-height: 150px; /* Prevent collapsing, adjust as needed */
}

/* Specific adjustment for chart containers if needed */
.chart-container {
    padding: 1rem;
    border-radius: 0.3rem;
    background-color: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    position: relative;
    height: 320px;
}

.chart-container .card-title {
    margin-bottom: 1rem;
    text-align: center;
    color: var(--primary-color);
    font-weight: 600;
}

/* Adjustments for accordion containers within cards */
.category-container .card-body {
    min-height: 200px; /* Ensure accordion containers have enough initial height */
}

/* === NEW Dashboard KPI Card Styles === */

.stats-container .stat-card {
    border: none; /* Remove default card border */
    border-radius: 0.75rem; /* Slightly more rounded */
    background-color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Softer shadow */
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    display: flex; /* Use flex for internal layout */
    flex-direction: column; /* Stack header and body */
    height: 100%; /* Ensure cards in a row are same height */
}

.stats-container .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem; /* Adjust padding */
    border-bottom: 1px solid var(--border-gray);
    background-color: transparent; /* No background color for header */
}

.stat-metric-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.stat-icon-container {
    width: 40px;
    height: 40px;
    border-radius: 50%; 
    display: flex;
    align-items: center;
    justify-content: center;
    /* Use specific background colors based on --viz variables */
}

.stat-icon-container.bg-viz-1 { background-color: var(--viz-color-1); }
.stat-icon-container.bg-viz-2 { background-color: var(--viz-color-2); }
.stat-icon-container.bg-viz-3 { background-color: var(--viz-color-3); }
.stat-icon-container.bg-viz-4 { background-color: var(--viz-color-4); }
.stat-icon-container.bg-viz-accent { background-color: var(--viz-accent); }
/* Add more if needed */

.stat-icon {
    font-size: 1.25rem; /* Adjust icon size */
    color: var(--white); /* White icon */
}

.stat-card-body {
    padding: 1rem; /* Add padding back to body */
    text-align: right; /* Right-align numbers */
    flex-grow: 1; /* Allow body to fill space */
    /* Override the general card-body min-height if needed */
    min-height: auto; 
}

.stat-metric-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.75rem; /* Larger metric value */
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-metric-trend {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Chart Container Constraints */
.chart-card-body {
    position: relative; /* Needed for Chart.js responsiveness */
    /* Set a reasonable default height, adjust as needed */
    /* Option 1: Fixed height 
    height: 300px; 
    */
    /* Option 2: Min/Max height */
    min-height: 250px;
    max-height: 400px; 
    display: flex; /* Use flex to help center canvas */
    justify-content: center;
    align-items: center;
    padding: 1rem; /* Add some padding */
}

.chart-card-body canvas {
    max-width: 100%; /* Ensure canvas doesn't overflow */
    max-height: 100%; /* Ensure canvas doesn't overflow */
}

/* Specific overrides if needed */
/* Example for smaller donut chart */
#sentiment-overview-content .chart-card-body {
    /* max-height: 250px; */ /* If donut needs less space */
}

/* Example for taller trends chart */
#sentiment-trends-chart-container .chart-card-body {
     /* min-height: 300px; */
}

/* Conversation transcript styling */
.conversation-transcript {
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
}

.message {
    margin-bottom: 1.5rem;
    position: relative;
}

.message-agent {
    padding-right: 25%;
}

.message-user {
    padding-left: 25%;
    display: flex;
    flex-direction: row-reverse;
}

/* Avatar styling */
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white; /* Icon color */
    flex-shrink: 0;
    margin: 0 10px; /* Consistent margin */
    font-size: 1rem; /* Adjust icon size if needed */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Agent Avatar Background */
.agent-message .message-avatar {
    background: var(--lily-gradient, #9370db); 
}

/* Caller Avatar Background */
.caller-message .message-avatar {
    background: var(--caller-gradient, #f9a825);
    /* No margin changes needed here due to flex-direction: row-reverse */
}

/* Message Content block */
.message-content {
    display: flex;
    flex-direction: column;
    position: relative; 
}

/* Speaker Label Styling */
.speaker-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d; 
    margin-bottom: 4px; 
    padding: 0 5px; 
}

.agent-message .speaker-label {
    text-align: left;
    color: var(--lily-color, #9370db); 
}

.caller-message .speaker-label {
    text-align: right;
    color: var(--caller-color, #f9a825); 
}

/* Message Bubble styling */
.message-bubble {
    padding: 12px 18px; /* Increased padding */
    border-radius: 20px; /* Slightly more rounded */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Slightly larger shadow */
    position: relative;
    overflow-wrap: break-word;
    border: 1px solid rgba(0,0,0,0.05); /* Add subtle border */
}

.agent-message .message-bubble {
    background-color: var(--primary-light-shade); /* TBC color - now based on new primary */
    color: var(--dark-gray);
    border-top-left-radius: 6px; /* Adjust rounding */
    margin-left: 8px;
}

.user-message .message-bubble {
    background-color: var(--border-gray); /* Neutral light gray */
    color: var(--dark-gray);
    border-top-right-radius: 6px; /* Adjust rounding */
    margin-right: 8px;
}

/* Message text - UPDATED */
.message-text {
    white-space: pre-wrap;
    margin: 0;
    font-size: 16px; /* Increased size */
    line-height: 1.5;
}

/* Timestamp styling - Minor adjustments if needed */
.timestamp {
    font-size: 12px; /* Slightly larger */
    margin-top: 2px;
    opacity: 0.7;
}

.agent-message .timestamp {
    margin-left: 46px;
    color: #666;
}

.user-message .timestamp {
    margin-right: 46px;
    text-align: right;
    color: #a0cfff;
}

/* Highlight styling */
.highlighted-message .message-bubble {
    border: 2px solid #ffc107;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.4);
    animation: pulse 2s infinite;
}

.highlighted-text {
    background-color: rgba(255, 255, 0, 0.4);
    padding: 2px 0;
    border-radius: 2px;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* Custom scrollbar for transcript container */
#transcript-container::-webkit-scrollbar {
    width: 8px;
}

#transcript-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#transcript-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#transcript-container::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Message with agent/caller icons */
.message .message-avatar.bg-primary {
    position: relative;
    overflow: hidden;
}

.message-avatar::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.message-agent .message-avatar::after {
    content: "\f4fc"; /* Using FontAwesome psychic crystal ball icon */
    font-family: "Font Awesome 5 Free";
    font-size: 1.2rem;
}

.message-user .message-avatar::after {
    content: "\f007"; /* Using FontAwesome user icon */
    font-family: "Font Awesome 5 Free";
    font-size: 1.2rem;
}

/* Analysis results */
.analysis-section {
    margin-bottom: 2rem;
}

.sentiment-positive {
    color: var(--success-color);
}

.sentiment-negative {
    color: var(--danger-color);
}

.sentiment-neutral {
    color: var(--secondary-color);
}

/* Simple Accordion Scroll Fix */
/* REMOVE OLD RULE: .accordion-body .list-group-flush {
    max-height: 300px; 
    overflow-y: auto;
} */

/* NEW Specific Accordion Scroll Fix */
#common-questions-accordion .accordion-item .accordion-collapse,
#concerns-skepticism-accordion .accordion-item .accordion-collapse {
    max-height: 300px; /* Adjust as needed */
    overflow-y: auto;
    /* Ensure direct child list-items don't prevent scrolling */
    /* (This might not be needed, but adding for robustness) */
    & > .list-group-item {
      overflow: hidden; /* Prevent item content itself from breaking layout */
      text-overflow: ellipsis; /* Optional: if text within item overflows */
    }
}

/* Ensure accordion body and collapse don't interfere (optional, remove if Bootstrap default works) */
/* REMOVE THESE COMMENTED LINES 
.accordion-body {
    overflow: visible !important; 
}
.accordion-collapse {
    overflow: visible !important;
} 
*/

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .conversation-transcript {
        max-height: 50vh;
    }
    
    .message-agent, .message-user {
        padding-right: 10%;
        padding-left: 0;
    }
    
    .message-user {
        padding-right: 0;
        padding-left: 10%;
    }
}

/* Print styles */
@media print {
    .navbar, .footer, .btn {
        display: none !important;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
    }
    
    .card {
        border: none;
        box-shadow: none;
    }
}

/* === Transcript Viewer Styles (Cleaned) === */

.transcript-container {
    max-height: 60vh; 
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
}

/* General message structure */
.message-group {
    /* display: flex; */ /* Removed - Handled by parent */
    /* align-items: flex-end; */ /* Removed - Handled by parent */
    /* margin-bottom: 1rem; */ /* Keep margin? */
}

/* Container for the avatar icon itself */
.avatar-container {
    /* width: 40px; */ /* Removed */
    /* height: 40px; */ /* Removed */
    /* border-radius: 50%; */ /* Removed */
    /* background-color: var(--secondary-color); */ /* Removed */
    display: flex; /* Keep flex for centering if needed, or remove if icon only */
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* box-shadow: 0 1px 2px rgba(0,0,0,0.15); */ /* Removed */
    width: 32px; /* Give it some base width for alignment */
    height: 40px; /* Match approx height */
    margin: 0 8px; /* Adjust margin slightly */
}

/* Remove general icon color style */
/* .avatar-container i {
    font-size: 1.1rem; 
    color: var(--white); 
} */

/* Apply color directly to the icon based on parent */
.agent-message .avatar-container i {
    color: var(--lily-color, #9370db);
}

.caller-message .avatar-container i {
    color: var(--caller-color, #f9a825);
}

/* Remove background rules for avatar-container */
/* .agent-message .avatar-container {
     background-color: var(--lily-color, #9370db); 
} */

/* .caller-message .avatar-container {
     background-color: var(--caller-color, #f9a825); 
} */

/* AVATAR STYLES FROM PREVIOUS VERSIONS - Ensure these remain removed/commented */
/* Remove the duplicate/old .message-avatar rules */
/* .message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white; 
    flex-shrink: 0;
    margin: 0 10px; 
    font-size: 1rem; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
} */

/* Remove old background rules using gradients/old classes */
/* .agent-message .message-avatar {
    background: var(--lily-gradient, #9370db); 
} */

/* .caller-message .message-avatar {
    background: var(--caller-gradient, #f9a825);
} */

/* Message Content block */
.message-content {
    display: flex;
    flex-direction: column;
    position: relative; 
}

/* Speaker Label Styling */
.speaker-label {
    /* font-size: 0.8rem; */ /* Removed - Handled by avatar-container */
    /* font-weight: 600; */ /* Removed - Handled by avatar-container */
    /* color: #6c757d; */ /* Removed - Handled by avatar-container */
    /* margin-bottom: 4px; */ /* Removed - Handled by avatar-container */
    /* padding: 0 5px; */ /* Removed - Handled by avatar-container */
}

.agent-message .speaker-label {
    /* text-align: left; */ /* Removed - Handled by avatar-container */
    /* color: var(--lily-color, #9370db); */ /* Removed - Handled by avatar-container */
}

.caller-message .speaker-label {
    /* text-align: right; */ /* Removed - Handled by avatar-container */
    /* color: var(--caller-color, #f9a825); */ /* Removed - Handled by avatar-container */
}

/* Message Bubble styling */
.message-bubble {
    /* max-width: 100%; */ /* Removed - Handled by avatar-container */
    /* padding: 10px 15px; */ /* Removed - Handled by avatar-container */
    /* border-radius: 18px; */ /* Removed - Handled by avatar-container */
    /* word-wrap: break-word; */ /* Removed - Handled by avatar-container */
    /* box-shadow: 0 1px 2px rgba(0,0,0,0.08); */ /* Removed - Handled by avatar-container */
    /* position: relative; */ /* Removed - Handled by avatar-container */
}

/* Agent Bubble Style */
.agent-message .message-bubble {
    /* background-color: #f0ebff; */ /* Removed - Handled by avatar-container */
    /* color: #333; */ /* Removed - Handled by avatar-container */
    /* border-top-left-radius: 4px; */ /* Removed - Handled by avatar-container */
    /* border-bottom-left-radius: 18px; */ /* Removed - Handled by avatar-container */
    /* border-bottom-right-radius: 18px; */ /* Removed - Handled by avatar-container */
    /* border-top-right-radius: 18px; */ /* Removed - Handled by avatar-container */
}

/* Caller Bubble Style - REMOVE THIS ENTIRE BLOCK */
/*
.caller-message .message-bubble {
    background-color: #0d6efd; 
    color: white;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 18px;
    border-top-left-radius: 18px;
}
*/

/* Timestamp styling */
.message-timestamp {
    /* font-size: 0.75rem; */ /* Removed - Handled by avatar-container */
    /* color: #adb5bd; */ /* Removed - Handled by avatar-container */
    /* margin-top: 5px; */ /* Removed - Handled by avatar-container */
    /* text-align: right; */ /* Removed - Handled by avatar-container */
}

/* Agent Timestamp Alignment */
.agent-message .message-timestamp {
    /* text-align: left; */ /* Removed - Handled by avatar-container */
    /* color: #6c757d; */ /* Removed - Handled by avatar-container */
}

/* =========================== */
/* === Page Specific Styling === */
/* =========================== */

/* --- Dashboard --- */

/* Subtitle Style */
#dashboard-main-container h1 + p {
    font-size: 1rem; /* Slightly larger */
    color: var(--text-muted); /* Keep muted but ensure weight is normal */
    margin-bottom: 1.5rem; /* Add some space below */
}

/* API Status Compact - NEW Framed Version */
.api-status-frame {
    border: 1px solid var(--border-gray);
    border-radius: 0.3rem;
    padding: 1rem 1.5rem;
    background-color: var(--white);
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.api-status-title {
    text-align: center;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-gray);
    padding-bottom: 0.5rem;
}

.api-status-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: space-around; /* Distribute items */
    align-items: center;
}

.api-status-item {
    font-size: 0.9rem;
    color: var(--dark-gray);
    margin: 0.25rem 0.5rem; /* Spacing between items */
    display: flex;
    align-items: center;
}

.api-status-item i {
    margin-left: 8px;
    font-size: 1.1em; /* Slightly larger */
    vertical-align: middle;
    transition: color 0.3s ease; /* Smooth color change */
}


/* =========================== */
/* === Component Styling === */
/* =========================== */

/* === Transcript Modal Specific Styles === */

/* Make the modal body a flex container to enable alignment */
/*
#transcriptModal .modal-body {
    display: flex;
    flex-direction: column;
}
*/

.transcript-container {
    max-height: 60vh; /* Or adjust as needed */
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
}

/* General message structure within modal */
.message-group {
    /* display: flex; */
    /* align-items: flex-end; */
    /* margin-bottom: 1rem; */
}

/* Agent message alignment */
.agent-message {
    display: flex; /* Ensure flex is enabled */
    justify-content: flex-start; /* Align left */
    margin-bottom: 1rem;
}
.agent-message .message-group {
    /* No specific alignment needed here, defaults work */
    display: flex; /* Ensure inner group is also flex */
    align-items: flex-end;
}

/* Caller message alignment */
.caller-message {
    display: flex; /* Ensure flex is enabled */
    justify-content: flex-end; /* Align right */
    margin-bottom: 1rem;
}
.caller-message .message-group {
    display: flex; /* Ensure inner group is also flex */
    align-items: flex-end;
    flex-direction: row-reverse; /* Crucial for avatar position */
}

/* Avatar styling */
.message-avatar {
    /* width: 40px; */ /* Removed - Handled by avatar-container */
    /* height: 40px; */ /* Removed - Handled by avatar-container */
    /* border-radius: 50%; */ /* Removed - Handled by avatar-container */
    /* display: flex; */ /* Removed - Handled by avatar-container */
    /* align-items: center; */ /* Removed - Handled by avatar-container */
    /* justify-content: center; */ /* Removed - Handled by avatar-container */
    /* color: white; */ /* Removed - Handled by avatar-container */
    /* flex-shrink: 0; */ /* Removed - Handled by avatar-container */
    /* margin: 0 10px; */ /* Removed - Handled by avatar-container */
    /* font-size: 1rem; */ /* Removed - Handled by avatar-container */
    /* box-shadow: 0 1px 3px rgba(0,0,0,0.1); */ /* Removed - Handled by avatar-container */
}

/* Agent Avatar Background */
.agent-message .message-avatar {
    /* background: var(--lily-gradient, #9370db); */ /* Removed - Handled by avatar-container */
}

/* Caller Avatar Background */
.caller-message .message-avatar {
    /* background: var(--caller-gradient, #f9a825); */ /* Removed - Handled by avatar-container */
}

/* Message Content block */
.message-content {
    /* display: flex; */ /* Removed - Handled by avatar-container */
    /* flex-direction: column; */ /* Removed - Handled by avatar-container */
    /* position: relative; */ /* Removed - Handled by avatar-container */
}

/* Speaker Label Styling */
.speaker-label {
    /* font-size: 0.8rem; */ /* Removed - Handled by avatar-container */
    /* font-weight: 600; */ /* Removed - Handled by avatar-container */
    /* color: #6c757d; */ /* Removed - Handled by avatar-container */
    /* margin-bottom: 4px; */ /* Removed - Handled by avatar-container */
    /* padding: 0 5px; */ /* Removed - Handled by avatar-container */
}

.agent-message .speaker-label {
    /* text-align: left; */ /* Removed - Handled by avatar-container */
    /* color: var(--lily-color, #9370db); */ /* Removed - Handled by avatar-container */
}

.caller-message .speaker-label {
    /* text-align: right; */ /* Removed - Handled by avatar-container */
    /* color: var(--caller-color, #f9a825); */ /* Removed - Handled by avatar-container */
}

/* Message Bubble styling */
.message-bubble {
    /* max-width: 100%; */ /* Removed - Handled by avatar-container */
    /* padding: 10px 15px; */ /* Removed - Handled by avatar-container */
    /* border-radius: 18px; */ /* Removed - Handled by avatar-container */
    /* word-wrap: break-word; */ /* Removed - Handled by avatar-container */
    /* box-shadow: 0 1px 2px rgba(0,0,0,0.08); */ /* Removed - Handled by avatar-container */
    /* position: relative; */ /* Removed - Handled by avatar-container */
}

/* Agent Bubble Style */
.agent-message .message-bubble {
    /* background-color: #f0ebff; */ /* Removed - Handled by avatar-container */
    /* color: #333; */ /* Removed - Handled by avatar-container */
    /* border-top-left-radius: 4px; */ /* Removed - Handled by avatar-container */
    /* border-bottom-left-radius: 18px; */ /* Removed - Handled by avatar-container */
    /* border-bottom-right-radius: 18px; */ /* Removed - Handled by avatar-container */
    /* border-top-right-radius: 18px; */ /* Removed - Handled by avatar-container */
}

/* Caller Bubble Style */
.caller-message .message-bubble {
    /* background-color: #0d6efd; */ /* Removed - Handled by avatar-container */
    /* color: white; */ /* Removed - Handled by avatar-container */
    /* border-top-right-radius: 4px; */ /* Removed - Handled by avatar-container */
    /* border-bottom-right-radius: 18px; */ /* Removed - Handled by avatar-container */
    /* border-bottom-left-radius: 18px; */ /* Removed - Handled by avatar-container */
    /* border-top-left-radius: 18px; */ /* Removed - Handled by avatar-container */
}

/* Timestamp styling */
.message-timestamp {
    /* font-size: 0.75rem; */ /* Removed - Handled by avatar-container */
    /* color: #adb5bd; */ /* Removed - Handled by avatar-container */
    /* margin-top: 5px; */ /* Removed - Handled by avatar-container */
    /* text-align: right; */ /* Removed - Handled by avatar-container */
}

/* Agent Timestamp Alignment */
.agent-message .message-timestamp {
    /* text-align: left; */ /* Removed - Handled by avatar-container */
    /* color: #6c757d; */ /* Removed - Handled by avatar-container */
}

/* =========================== */
/* === Page Specific Styling === */
/* =========================== */

.modal-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  color: var(--white) !important; /* Explicitly ensure white color */
} 

/* Accordion Content Scrolling for Themes/Sentiment Page */
/* FINAL ATTEMPT: Apply scroll directly to accordion-body, use !important */
#common-questions-accordion .accordion-body,
#concerns-skepticism-accordion .accordion-body {
    max-height: 300px !important;
    overflow-y: auto !important;
    padding: 1rem !important; /* Ensure padding */
}

/* Remove conflicting styles from list-group */
#common-questions-accordion .accordion-body .list-group,
#concerns-skepticism-accordion .accordion-body .list-group {
   margin-bottom: 0;
   overflow-y: visible;
   display: block !important;
   height: auto !important; /* Explicitly set height based on content */
}

/* === DEBUG STYLES for list items === */
/*
.category-list-container .list-group li,
#positive-interactions-list .list-group li {
    display: block !important;
    min-height: 30px !important; 
    background-color: lightgreen !important; 
    border-bottom: 1px dashed red !important; 
    margin-bottom: 2px !important; 
    padding: 5px !important; 
    overflow: visible !important; 
}
.category-list-container .list-group li a,
#positive-interactions-list .list-group li span.interaction-quote,
#positive-interactions-list .list-group li span.interaction-quote a {
    display: block !important; 
    width: auto !important; 
    height: auto !important; 
    background-color: lightblue !important; 
    color: black !important; 
}
*/
/* === END DEBUG STYLES === */

/* Minor style tweak for accordion button badges */
.accordion-button .badge {
    font-size: 0.75em; /* Slightly smaller badge */
} 

/* Override for accordion cards to prevent flex from interfering with scrolling */
.accordion-card .card-body {
    display: block; /* Change from flex to block */
    min-height: auto; /* Remove min-height */
} 

/* =========================== */

/* --- Transcript Viewer --- */
/* Styles for the main transcript viewer page - these might need duplication/generalization for the modal */
.transcript-viewer-container {
    /* Specific container styles if any */
}

/* === iMessage Style Transcript Bubbles (Ensure these apply to both viewer and modal) === */

/* Target elements within the original viewer OR the new modal */
#transcript-viewer-container .transcript-message, 
#transcriptModal .transcript-message {
    /* Shared styles for message cards */
    /* These styles were previously applied directly by JS, 
       but defining them here ensures consistency and better separation */
    max-width: 75%;
    width: fit-content;
}

#transcript-viewer-container .transcript-list .d-flex, 
#transcriptModal .transcript-list .d-flex {
     /* Ensures the flex alignment works correctly in both contexts */
}

#transcript-viewer-container .transcript-message .card-body,
#transcriptModal .transcript-message .card-body {
    padding: 0.5rem 0.75rem; /* Slightly adjusted padding */
}

#transcript-viewer-container .transcript-message .speaker-label,
#transcriptModal .transcript-message .speaker-label {
    font-weight: bold;
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

#transcript-viewer-container .transcript-message .message-text,
#transcriptModal .transcript-message .message-text {
    margin-bottom: 0.25rem;
    font-size: 0.9rem; /* Slightly smaller font */
    white-space: pre-wrap; /* Ensure line breaks are respected */
}

#transcript-viewer-container .transcript-message .timestamp-label,
#transcriptModal .transcript-message .timestamp-label {
    font-size: 0.75em; 
    display: block;
    text-align: right;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* User message specific styles */
#transcript-viewer-container .transcript-message.ms-auto, /* User messages */
#transcriptModal .caller-message .message-bubble { /* User messages - Target .message-bubble */
    background-color: var(--primary-color); 
    color: var(--white);
}

#transcript-viewer-container .transcript-message.ms-auto .speaker-label,
#transcriptModal .caller-message .speaker-label,
#transcript-viewer-container .transcript-message.ms-auto .timestamp-label,
#transcriptModal .caller-message .timestamp-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Agent message specific styles */
#transcript-viewer-container .transcript-message.me-auto, /* Agent messages */
#transcriptModal .agent-message .message-bubble { /* Agent messages - Target .message-bubble */
    background-color: var(--light-gray);
    color: var(--dark-gray);
    border: 1px solid var(--border-gray);
}

#transcript-viewer-container .transcript-message.me-auto .speaker-label,
#transcriptModal .agent-message .speaker-label {
    color: var(--primary-color);
}

#transcript-viewer-container .transcript-message.me-auto .timestamp-label,
#transcriptModal .agent-message .timestamp-label {
    color: var(--text-muted);
}

/* --- Themes & Sentiment Page --- */

/* User message specific styles */
#transcriptModal .caller-message .message-bubble { /* User messages - Target .message-bubble */
    /* Style to match main viewer: Light background, dark text */
    background-color: var(--light-gray);
    color: var(--dark-gray);
    border: 1px solid var(--border-gray);
    position: relative; 
    z-index: 10; 
    opacity: 1; 
}

/* Set explicit dark color for caller labels/timestamps */
#transcriptModal .caller-message .speaker-label,
#transcriptModal .caller-message .timestamp-label {
    color: var(--text-muted); /* Use standard muted color */
}

/* Agent message specific styles */
#transcriptModal .agent-message .message-bubble { /* Agent messages - Target .message-bubble */
    /* Style to match main viewer: Purple background, dark text */
    background-color: var(--primary-light-shade); /* Use variable for light purple */ 
    color: var(--dark-gray);
    position: relative; 
    z-index: 10; 
    opacity: 1; 
}

/* Adjust agent label/timestamp colors if needed */
#transcriptModal .agent-message .speaker-label {
    color: var(--primary-color); /* Use variable */ 
}

#transcriptModal .agent-message .timestamp-label {
    color: var(--text-muted); /* Use variable */
}

/* Ensure embedded widget stays in container */
#agent-widget-embed-area {
    display: flex !important;          /* Flex layout */
    justify-content: center !important;
    align-items: center !important;
    padding: 0.5rem !important;        /* Much tighter padding */
    background-color: var(--light-gray);
    border: 1px solid var(--border-gray);
    border-radius: 0.25rem;
    min-height: 220px;                 /* Shorter container */
}

#agent-widget-embed-area > elevenlabs-convai {
    display: block !important;
    position: static !important;      /* Prevent widget script from using fixed bottom-right */
    max-width: 360px;                  /* Slightly smaller */
    width: 100%;
    margin: 0 auto;
}

/* Container for email templates */
#caller-email-content,
#team-email-content {
    max-height: 400px !important; /* Increased and added !important */
    overflow-y: auto;
    border: 1px solid var(--border-gray);
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: 0.25rem;
    margin-top: 0.5rem; /* Add some space above */
}

/* Center the embedded widget */
#agent-widget-embed-area {
    display: flex;
    justify-content: center;
    align-items: center; /* Center vertically */
    padding-top: 1rem; /* Add some padding above */
    border: 1px solid var(--border-gray);
    border-radius: 0.25rem;
    margin-top: 0.5rem;
    background-color: var(--light-gray);
    min-height: 300px; /* Ensure it has some height */
}

/* Style the widget itself if needed (example) */
#agent-widget-embed-area > elevenlabs-convai {
    /* Add specific styles for the widget component if necessary */
    /* e.g., width: 100%; max-width: 500px; */
    max-width: 90%; /* Adjust if needed */
    max-height: 90%; /* Prevent widget from overflowing container */
}

/* Style for the prompt viewer */
#agent-prompt-viewer {
    max-height: 400px !important; /* Match email viewer height */
    min-height: 400px; /* ADDED: Force minimum height */
    overflow-y: auto; /* Ensure scrollbar appears if needed */
    white-space: pre-wrap; /* Preserve line breaks and wrap text */
    word-wrap: break-word; /* Break long words */
    font-family: var(--bs-font-monospace); /* Optional: Use monospace for code-like feel */
    font-size: 0.85rem; /* Slightly smaller font */
}

/* Force the card body containing the prompt to be taller */
/* .prompt-column-card-body {
    min-height: 850px; /* Adjust this value as needed for visual alignment */
/* } */ /* Commented out - Trying flex approach instead */

/* Ensure cards within the admin accordion row attempt to fill height */
#agentAdminAccordion .row > .col-md-6 > .card {
    height: 100%;
    display: flex; /* Ensure card itself uses flex */
    flex-direction: column; /* Stack card header/body vertically */
}

/* Ensure the card-body within these cards can grow */
#agentAdminAccordion .row > .col-md-6 > .card > .card-body {
    flex-grow: 1;
}

/* Themed Card Headers for Future Features Section */
.bg-purple {
    background-color: var(--primary-color);
    color: white;
}

.bg-teal {
    background-color: var(--secondary-color);
    color: white;
}

/* Readme Viewer Styles */
.readme-content {
    border-radius: 0.375rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Style markdown elements inside the readme-content */
.readme-content h1 {
    font-size: 1.75rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-gray);
}

.readme-content h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--border-gray);
}

.readme-content h3 {
    font-size: 1.25rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.readme-content h4, 
.readme-content h5, 
.readme-content h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.readme-content p {
    margin-bottom: 1rem;
}

.readme-content ul,
.readme-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.readme-content li {
    margin-bottom: 0.25rem;
}

.readme-content pre {
    background-color: var(--light-gray);
    border: 1px solid var(--border-gray);
    border-radius: 0.25rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

.readme-content code {
    font-family: var(--bs-font-monospace);
    font-size: 0.875em;
    background-color: var(--light-gray);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
}

.readme-content pre code {
    padding: 0;
    background-color: transparent;
}

.readme-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
}

.readme-content th,
.readme-content td {
    border: 1px solid var(--border-gray);
    padding: 0.5rem;
}

.readme-content th {
    background-color: var(--light-gray);
}

.readme-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Fullscreen mode for README viewer */
.readme-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    background-color: white;
    overflow-y: auto;
    padding: 2rem;
}

.readme-container.fullscreen .readme-content {
    max-height: none !important;
    height: calc(100vh - 7rem);
    overflow-y: auto;
}

/* Button to restore from fullscreen */
.readme-container.fullscreen .exit-fullscreen-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

/* Styling for Agent Admin Panel Email Viewers */
#team-email-viewer,
#caller-email-viewer {
    max-height: 300px; /* Adjust height as needed */
    overflow-y: auto;  /* Enable vertical scrolling */
    border: 1px solid #dee2e6; /* Keep the border */
    padding: 1rem; /* Keep padding */
    border-radius: 0.25rem; /* Keep border radius */
    background: linear-gradient(180deg, rgba(181,164,255,0.4) 0%, rgba(255,255,255,1) 100%); /* Light purple gradient to white */
    font-family: Arial, sans-serif; /* Override site font if needed, match email font */
    line-height: 1.6; /* Override site line-height */
    font-size: 0.9rem; /* Adjust font size if needed */
}

/* Ensure content inside viewers doesn't inherit unwanted site styles */
#team-email-viewer *,
#caller-email-viewer * {
   font-family: inherit; /* Inherit from the viewer div */
   /* Add other resets if necessary */
}

/* === OVERRIDE (final) center ElevenLabs widget --- */
#agent-widget-embed-area {
    display: flex !important;          /* Flex layout */
    justify-content: center !important;
    align-items: center !important;
    padding: 0.5rem !important;        /* Much tighter padding */
    background-color: var(--light-gray);
    border: 1px solid var(--border-gray);
    border-radius: 0.25rem;
    min-height: 220px;                 /* Shorter container */
}

#agent-widget-embed-area > elevenlabs-convai {
    display: block !important;
    position: static !important;      /* Prevent widget script from using fixed bottom-right */
    max-width: 360px;                  /* Slightly smaller */
    width: 100%;
    margin: 0 auto;
}

/* Tone down the purple headers in Email Template viewers inside Agent Admin */
#agentAdminAccordion .card-body h5.card-title {
    color: var(--dark-gray) !important;
    font-weight: 500 !important;
}
#agentAdminAccordion .accordion-body h6 {
    color: var(--dark-gray) !important;
    font-weight: 400 !important;
}

@keyframes urgent-blink{0%,100%{opacity:1}50%{opacity:.2}}
.urgent-blink{animation:urgent-blink 1s infinite}

/* Accordion gradients */
 .accordion-button {
     background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* Specific Accordion Button Styles */
#competitiveIntelButton,
#competitiveIntelButton:not(.collapsed) {
    background: linear-gradient(135deg, var(--psi-urgent-red), #b30000);
    color: white !important;
}

#competitiveIntelButton.collapsed {
    background: linear-gradient(135deg, var(--psi-urgent-red), #b30000);
    color: white !important;
}

#futureFeaturesButton,
#futureFeaturesButton:not(.collapsed) {
    background: linear-gradient(135deg, var(--psi-teal), #008f7a);
    color: white !important;
}

#futureFeaturesButton.collapsed {
    background: linear-gradient(135deg, var(--psi-teal), #008f7a);
    color: white !important;
}

/* === Holacracy Roles Modal Styles === */
.card-header { /* Existing rule, add font-size/padding here */
    font-size: 1rem;
    padding: .5rem .75rem;
}

/* Style for the dynamically generated role cards */
#roleCards .card {
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

#roleCards .card-header strong {
    text-transform: uppercase; 
}

#roleCards .card-body ul {
    margin-bottom: .5rem;
    padding-left: 1.2rem; /* Indent lists slightly */
}

#roleCards .card-body strong {
    display: block; /* Ensure strong tags take full width */
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

#roleCards .card-body em { /* Italic for purpose */
    display: block; 
    margin-bottom: 0.5rem;
}

#roleCards .card-body strong:first-of-type { /* No top margin for first strong tag (Purpose) */
   margin-top: 0;
}

/* Improve contrast on Competitive Intel Snapshot Header */
#collapseIntel .card-header.text-white h5 {
    color: var(--secondary-light-shade) !important; /* Light teal for contrast */
}

/* Increase font size for Competitive Intel Snapshot Body */
#collapseIntel .card-body p {
    font-size: 1.05rem; /* Slightly larger font */
}

.border-teal {
    border-color: var(--psi-teal) !important;
}

/* Voice SDK modal styles */
.voice-card {
    background: linear-gradient(180deg, #C12C4F 0%, #F8B36C 100%);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    color: #fff;
    text-align: center;
    position: relative;
}
.voice-avatar {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 4px solid #fff;
}
.voice-mic-btn {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s ease-in-out;
}
.voice-mic-btn:hover { transform: scale(1.05); cursor: pointer; }
.voice-prompts { max-width: 260px; color: #5A0F23; background: rgba(255,255,255,0.8); border-radius: 10px; padding: 1rem; }
.voice-powered-by { color: #f8f9fa; opacity: 0.8; }

#voice-overlay-widget > elevenlabs-convai {
    width: 100%;
    height: 100%;
    display: flex;
}

/* === Voice Drawer Styles === */
.voice-drawer {
    position: fixed;
    bottom: 0;
    right: -350px; /* Start off-screen */
    width: 320px; /* Narrower drawer */
    height: 100%;
    max-height: 80vh; /* Limit height */
    background: linear-gradient(180deg, #8c2d3f 0%, #c12c4f 40%, #e67e22 100%); /* Psychic Source red/orange gradient */
    border-top-left-radius: 15px;
    border-bottom-left-radius: 15px;
    box-shadow: -5px 0px 15px rgba(0, 0, 0, 0.2);
    padding: 1.5rem 1rem;
    transition: right 0.3s ease-in-out;
    z-index: 1055; /* Above debug panel */
    color: #fff;
    display: flex;
    flex-direction: column;
}

.voice-drawer.active {
    right: 0; /* Slide in */
}

#voice-drawer-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.voice-drawer-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    background-color: #C12C4F; /* Match Psychic Source primary red */
    border-color: #a82545;
}

/* Voice card adjustments inside drawer */
.voice-drawer .voice-card {
    background: transparent; /* Use drawer background */
    border: none;
    box-shadow: none;
    max-width: 100%; /* Allow card to fill drawer width */
    padding: 0; /* Remove card padding */
    flex-grow: 1; /* Allow card to take up space */
}

.voice-drawer .voice-avatar {
    width: 80px; height: 80px; margin-bottom: 1rem; /* Smaller avatar */
}

.voice-drawer .voice-mic-btn {
    width: 60px; height: 60px; font-size: 1.5rem; /* Smaller mic button */
    background: rgba(255, 255, 255, 0.2);
}

.voice-drawer .voice-prompts {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.75rem;
    font-size: 0.8rem;
}

.voice-drawer .voice-transcript-area {
    background: rgba(0,0,0,0.1);
    border-radius: 5px;
    padding: 0.5rem;
    color: #eee;
}

.voice-drawer .voice-powered-by {
    color: #eee;
    opacity: 0.7;
}

/* === General Voice Card Mic Button Enhancements === */
.voice-mic-btn {
    transition: transform 0.2s ease, background-color 0.2s ease; /* Add background transition */
}

.voice-mic-btn:hover {
    transform: scale(1.08); /* Slightly larger hover */
    background-color: rgba(255, 255, 255, 0.3);
}

.voice-mic-btn.recording {
    background-color: #dc3545 !important; /* Red background when recording */
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.voice-status-label {
    font-style: italic;
    opacity: 0.9;
}
