@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* CTL Brand Colors */
    --ctl-red: #FF3E41;
    --ctl-red-light: #FF6B6E;
    --ctl-red-lighter: #FFE4E5;
    --ctl-pink: #FFB3BA;
    --ctl-pink-light: #FFC9CE;
    --ctl-coral: #FF8A80;
    --ctl-peach: #FFAB91;
    
    /* Supporting Colors */
    --charcoal: #2D2D2D;
    --gray-dark: #4A4A4A;
    --gray-medium: #757575;
    --gray-light: #B8B8B8;
    --gray-lighter: #E8E8E8;
    --gray-lightest: #F5F5F5;
    --white: #FFFFFF;
    
    /* Semantic Colors */
    --success: #4CAF50;
    --warning: #FF9800;
    --info: #2196F3;
    
    /* Shadows */
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-large: 0 8px 24px rgba(0, 0, 0, 0.16);
    --shadow-pink: 0 4px 12px rgba(255, 62, 65, 0.15);
}

body {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #FFF5F5 0%, #FFFFFF 100%);
    color: var(--charcoal);
    line-height: 1.6;
    padding: 0;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 20px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Desktop only elements */
.desktop-only {
    display: flex;
}

/* Spacer for mobile layout */
.header-spacer {
    flex: 1 1 auto;
    display: none; /* Hidden by default, shown on mobile */
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--ctl-red);
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.logo-divider {
    width: 1px;
    height: 24px;
    background: var(--gray-lighter);
}

.page-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-dark);
}

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

.data-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--gray-lightest);
    border-radius: 24px;
    font-size: 14px;
    color: var(--gray-dark);
}

/* Assignment indicator - simplified to just a dot */
.assignment-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.assignment-dot .dot {
    width: 10px;
    height: 10px;
    background: var(--ctl-red);
    border-radius: 50%;
    animation: assignmentPulse 1s infinite;
}

@keyframes assignmentPulse {
    0% { 
        opacity: 1; 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 62, 65, 0.4);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.1);
        box-shadow: 0 0 0 4px rgba(255, 62, 65, 0.2);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 62, 65, 0);
    }
}

/* Mobile optimization for header actions */
@media (max-width: 768px) {
    .header {
        padding: 8px 10px;
        overflow-x: hidden; /* Hide overflow */
        min-height: 40px;
        max-height: 40px;
    }
    
    .header-content {
        gap: 6px;
        flex-wrap: nowrap !important; /* Force prevent wrapping */
        align-items: center;
        display: flex;
        flex-direction: row !important; /* Force horizontal */
        min-width: 0;
        width: 100%;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Show spacer on mobile to push settings to the right */
    .header-spacer {
        display: block;
        flex: 1 1 auto;
        min-width: 10px; /* Minimum width but can grow */
    }
    
    .play-btn-compact {
        width: 26px;
        height: 26px;
        font-size: 10px;
        flex: 0 0 26px; /* Fixed width, prevent shrinking */
        min-width: 26px;
        max-width: 26px;
    }
    
    /* Group the three playback buttons visually */
    .play-btn-compact:first-of-type {
        border-radius: 6px 0 0 6px;
        background: var(--gray-lightest);
    }
    
    .play-btn-compact.running-indicator {
        border-radius: 0;
        background: var(--gray-lightest);
        margin: 0 1px;
    }
    
    .play-btn-compact:nth-of-type(3) {
        border-radius: 0 6px 6px 0;
        background: var(--gray-lightest);
        margin-right: 6px;
    }
    
    .play-btn-compact:hover {
        background: var(--white);
    }
    
    .play-btn-compact.running {
        background: var(--ctl-red) !important;
    }
    
    .time-display-compact {
        font-size: 12px;
        gap: 4px;
        flex: 0 0 auto;
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        white-space: nowrap;
    }
    
    .time-display-compact span:first-child {
        font-weight: 500;
        min-width: 38px;
        font-size: 12px;
        display: inline-block;
    }
    
    .speed-indicator {
        font-size: 10px;
        padding: 1px 4px;
        display: inline-block;
    }
    
    .settings-btn-compact {
        width: 28px;
        height: 28px;
        font-size: 14px;
        flex: 0 0 28px;
        min-width: 28px;
        max-width: 28px;
    }
}

/* Fixed height conversation containers on mobile to prevent flicker */
@media (max-width: 768px) {
    .conversations-container {
        height: 120px; /* Increased height for better visibility */
        max-height: 120px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Ensure circles stay at consistent size */
    .conversation-item {
        width: 35px !important;
        height: 35px !important;
        flex-shrink: 0;
    }
    
    /* Adjust grid for smaller circles */
    .conversations-container {
        grid-template-columns: repeat(auto-fill, 35px);
        gap: 6px;
        padding: 4px;
    }
    
    /* Make state columns consistent height */
    .state-column {
        min-height: 160px;
        max-height: 160px;
    }
    
    /* In-service container also needs fixed height */
    .in-service-container {
        height: 120px;
        max-height: 120px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Force horizontal layout on portrait mobile */
@media (max-width: 768px) and (orientation: portrait) {
    .header {
        padding: 12px 12px; /* More padding */
        min-height: 56px; /* Taller header */
        max-height: 56px;
    }
    
    .header-content {
        display: inline-flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        white-space: nowrap;
        gap: 8px; /* More gap between elements */
        height: 100%;
    }
    
    .header-content > * {
        display: inline-flex !important;
        vertical-align: middle;
    }
    
    /* Hide logo and title in portrait to save space */
    .logo-section,
    .page-title,
    .logo,
    .logo-divider {
        display: none !important;
    }
    
    /* Larger buttons in portrait - individual rounded buttons */
    .play-btn-compact {
        width: 36px !important;
        height: 36px !important;
        font-size: 12px !important;
        flex: 0 0 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        background: var(--gray-lightest) !important;
        border-radius: 8px !important; /* All corners rounded */
        margin: 0 2px !important; /* Space between buttons */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Individual button spacing */
    #reset-btn {
        margin-left: 0 !important;
        margin-right: 2px !important;
    }
    
    #start-btn {
        margin: 0 2px !important;
    }
    
    #speed-btn {
        margin-left: 2px !important;
        margin-right: 8px !important; /* More space before time display */
    }
    
    /* Hover and active states */
    .play-btn-compact:hover {
        background: var(--ctl-pink-light) !important;
    }
    
    .play-btn-compact.running {
        background: var(--ctl-red) !important;
        color: white !important;
    }
    
    /* Ensure play icon displays correctly */
    .play-btn-compact .play-icon {
        display: inline-block !important;
        line-height: 1;
    }
    
    /* Position status dot correctly */
    .play-btn-compact .status-dot {
        position: absolute;
        top: 4px;
        right: 4px;
        width: 6px !important;
        height: 6px !important;
    }
    
    /* Larger time display */
    .time-display-compact {
        font-size: 14px !important;
        gap: 6px !important;
    }
    
    .time-display-compact span:first-child {
        min-width: 42px !important;
        font-size: 14px !important;
        font-weight: 600;
    }
    
    .speed-indicator {
        font-size: 11px !important;
        padding: 2px 6px !important;
    }
    
    /* Larger settings button */
    .settings-btn-compact {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
        flex: 0 0 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        background: var(--gray-lightest);
        border-radius: 8px;
    }
    
    /* Keep assignment dot small and subtle */
    .assignment-dot {
        width: 14px !important;
        height: 14px !important;
        margin: 0 2px;
    }
    
    .assignment-dot .dot {
        width: 8px !important;
        height: 8px !important;
    }
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Compact Playback Controls in Header - NOW FLAT STRUCTURE */

.play-btn-compact {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--gray-lightest);
    border: none;
    color: var(--gray-medium);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 12px;
    font-family: monospace;
    letter-spacing: -2px;
    font-weight: bold;
    position: relative;
    flex: 0 0 auto;
}

.play-btn-compact:hover {
    background: var(--ctl-pink-light);
    color: var(--gray-dark);
}

.play-btn-compact.running-indicator {
    position: relative;
}

.play-btn-compact .play-icon {
    transition: color 0.2s;
}

.play-btn-compact .status-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    display: none;
}

.play-btn-compact.running {
    background: var(--ctl-red);
    color: white;
}

.play-btn-compact.running .status-dot {
    display: block;
    animation: statusPulse 2s infinite;
}

.time-display-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-dark);
    flex-shrink: 1; /* Allow some shrinking but not complete collapse */
}

.time-display-compact span:first-child {
    min-width: 45px; /* Fixed width for time to prevent flickering */
    text-align: center;
}

.speed-indicator {
    padding: 2px 6px;
    background: var(--ctl-pink-light);
    color: var(--ctl-red);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
}

.settings-btn-compact {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gray-lightest);
    border: none;
    color: var(--gray-medium);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 18px;
}

.settings-btn-compact:hover {
    background: var(--ctl-pink-light);
    color: var(--charcoal);
}


.playback-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.playback-buttons {
    display: flex;
    gap: 4px;
    background: var(--gray-lightest);
    padding: 4px;
    border-radius: 12px;
}

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--gray-medium);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
    /* Ensure minimum touch target for mobile */
    min-width: 36px;
    min-height: 36px;
    -webkit-tap-highlight-color: rgba(255, 62, 65, 0.1);
    /* Unicode symbols styling */
    font-family: monospace, 'Courier New', Courier;
    letter-spacing: -2px;
    font-weight: bold;
}

.play-btn:hover {
    background: var(--ctl-pink-light);
    color: var(--charcoal);
}

.play-btn.running {
    background: var(--ctl-red);
    color: white;
}

.play-btn.flash {
    background: var(--ctl-red);
    color: white;
    animation: flashButton 0.3s ease;
}

@keyframes flashButton {
    0% { background: var(--ctl-red); }
    100% { background: transparent; }
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.speed-display {
    font-weight: 600;
    color: var(--ctl-red);
    font-size: 14px;
    padding: 6px 12px;
    background: var(--ctl-pink-light);
    border-radius: 12px;
    min-width: 70px;
    text-align: center;
}

/* Removed old assignment-indicator styles - now using data-badge with assignment-badge modifier */

.timestamp {
    font-weight: 600;
    color: var(--gray-dark);
    font-size: 16px;
    padding: 8px 16px;
    background: var(--gray-lightest);
    border-radius: 12px;
}

/* Stop Control */
.stop-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stop-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-medium);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stop-options {
    display: flex;
    gap: 4px;
    background: var(--gray-lightest);
    padding: 4px;
    border-radius: 12px;
}

.stop-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--gray-medium);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    /* Better touch targets */
    min-height: 32px;
    -webkit-tap-highlight-color: rgba(255, 62, 65, 0.1);
    /* Center text */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stop-btn:hover {
    background: var(--white);
    color: var(--gray-dark);
}

.stop-btn.active {
    background: var(--ctl-red);
    color: white;
}

/* Mode toggle removed - keeping styles commented in case needed later
.mode-toggle {
    display: flex;
    background: var(--gray-lightest);
    border-radius: 12px;
    padding: 4px;
}

.mode-option {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-medium);
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    border: none;
}

.mode-option.active {
    background: var(--white);
    color: var(--ctl-red);
    box-shadow: var(--shadow-soft);
}
*/

/* Main Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 20px;
}

h1 {
    display: none; /* Hide old title, using header instead */
}

/* Mode Selector */
.mode-selector-container {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 20px;
}

.mode-selector-container label {
    font-weight: 500;
    color: var(--gray-dark);
    font-size: 14px;
}

#mode-selector {
    padding: 10px 16px;
    border-radius: 24px;
    border: 2px solid var(--ctl-pink);
    background: var(--white);
    color: var(--charcoal);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#mode-selector:hover {
    background: var(--ctl-red-lighter);
    border-color: var(--ctl-red);
}

/* Settings Sidebar */
.settings-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--white);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.settings-sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--gray-dark);
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

.sidebar-restore-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-medium);
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-restore-btn:hover {
    background: var(--ctl-red-lighter);
    color: var(--ctl-red);
}

.sidebar-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 40px; /* Extra space at bottom */
    min-height: 0; /* Fix for flex overflow */
    background: var(--gray-lightest);
    max-height: calc(100vh - 80px); /* Account for header */
}

/* Settings Button in Header */
.settings-btn {
    background: transparent;
    border: 2px solid var(--ctl-red);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--ctl-red);
    font-weight: 600;
    font-size: 14px;
}

.settings-btn:hover {
    background: var(--ctl-red);
    color: white;
}

.settings-btn span:first-child {
    font-size: 16px;
}

/* Control Cards - updated for sidebar */
.controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-section {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    border: 1px solid var(--gray-lighter);
}

.control-section:hover {
    box-shadow: var(--shadow-medium);
    border-color: var(--ctl-pink);
}

.section-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--gray-lightest);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--gray-lighter);
}

.section-header:hover {
    background: var(--ctl-red-lighter);
}

.section-header h3 {
    margin: 0;
    font-size: 13px;
    color: var(--charcoal);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.section-icon {
    margin-right: 12px;
    font-size: 0.8em;
    color: var(--ctl-red);
    transition: transform 0.3s ease;
    display: inline-block;
    width: 12px;
    text-align: center;
}

/* Remove rotation - handled by text content change instead */

.section-content {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    transition: padding 0.3s ease;
    overflow: visible;
}

.section-content.collapsed {
    display: none;
    padding: 0 16px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Reduced gap since we're managing spacing with margins */
}

label {
    font-weight: 500;
    color: var(--gray-dark);
    font-size: 13px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px; /* Very small gap between label and its control */
    margin-top: 20px; /* Clear separation from control above */
}

/* First label in a control group shouldn't have top margin */
.control-group label:first-child {
    margin-top: 0;
}

/* For nested control groups (like in kinesis-config), adjust spacing */
#kinesis-config .control-group,
#webhook-config .control-group,
#local-config .control-group {
    margin-top: 12px;
}

#kinesis-config .control-group:first-child,
#webhook-config .control-group:first-child,
#local-config .control-group:first-child {
    margin-top: 0;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-lighter);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--ctl-red);
    cursor: grab;
    box-shadow: var(--shadow-medium);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    border-color: var(--ctl-red-light);
}

input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(0.95);
}

select {
    padding: 10px 16px;
    border-radius: 12px;
    border: 2px solid var(--gray-lighter);
    background: var(--white);
    color: var(--charcoal);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

select:hover {
    border-color: var(--ctl-pink);
    background: var(--ctl-red-lighter);
}

select:focus {
    outline: none;
    border-color: var(--ctl-red);
    box-shadow: 0 0 0 3px rgba(255, 62, 65, 0.1);
}

.value-display {
    font-size: 14px;
    font-weight: 600;
    color: var(--ctl-red);
    text-align: right;
    background: var(--ctl-red-lighter);
    padding: 2px 8px;
    border-radius: 8px;
    min-width: 50px;
    display: inline-block;
}

/* Toggle Switch Styles */
.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.toggle-label span {
    flex: 1;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
}

/* Stop Duration Options in Sidebar */
.stop-duration-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.stop-duration-btn {
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--gray-lightest);
    border: none;
    color: var(--gray-medium);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.stop-duration-btn:hover {
    background: var(--ctl-pink-light);
    color: var(--gray-dark);
}

.stop-duration-btn.active {
    background: var(--ctl-red);
    color: white;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-light);
    transition: all 0.3s ease;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--ctl-red);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Metrics */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    border-color: var(--ctl-pink);
}

.metric-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ctl-red-lighter);
    border-radius: 12px;
}

.metric-content {
    flex: 1;
}

.metric-main {
    margin-bottom: 12px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--charcoal);
    line-height: 1;
}

.metric-label {
    font-size: 13px;
    color: var(--gray-medium);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.metric-sub {
    display: flex;
    gap: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-lighter);
}

.sub-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sub-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--charcoal);
}

.sub-label {
    font-size: 11px;
    color: var(--gray-medium);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Secondary Metrics */
.metrics-secondary {
    display: flex;
    gap: 16px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.metric-small {
    background: var(--gray-lightest);
    border-radius: 12px;
    padding: 12px 20px;
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.metric-small-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--ctl-red);
}

.metric-small-label {
    font-size: 12px;
    color: var(--gray-medium);
    margin-top: 4px;
}

/* Responder Section */
.responder-section {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--charcoal);
}

.section-filters {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 6px 12px;
    border-radius: 16px;
    background: var(--gray-lightest);
    border: none;
    color: var(--gray-medium);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--ctl-red-lighter);
    color: var(--ctl-red);
}

.filter-btn.active {
    background: var(--ctl-red);
    color: white;
}

/* Responder Grid */
.responder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
    position: relative;
    min-height: 100px;
}

.empty-state-message {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gray-medium);
    font-style: italic;
    padding: 40px 20px;
    font-size: 14px;
}

.responder-card {
    background: var(--white);
    border: 2px solid var(--gray-lighter);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.responder-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.responder-card.available {
    background: var(--gray-lightest);
    border-color: var(--gray-light);
}

.responder-card.queued {
    background: linear-gradient(135deg, var(--info) 0%, #64B5F6 100%);
    border-color: var(--info);
    color: white;
}

.responder-card.busy {
    background: linear-gradient(135deg, var(--success) 0%, #81C784 100%);
    border-color: var(--success);
    color: white;
}

.responder-card.full {
    background: linear-gradient(135deg, var(--ctl-red) 0%, var(--ctl-coral) 100%);
    border-color: var(--ctl-red);
    color: white;
}

.responder-id {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.responder-status {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.responder-capacity {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
}

.capacity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid currentColor;
}

.capacity-dot.filled {
    background: currentColor;
}

/* Capacity Meter */
.capacity-meter {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

.capacity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.capacity-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-dark);
}

.capacity-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--ctl-red);
}

.capacity-bar {
    height: 24px;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}

.capacity-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--warning) 50%, var(--ctl-red) 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.capacity-stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--gray-medium);
}

/* Visualization Container */
.visualization {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.visualization .section-title {
    padding: 16px 24px;
    background: transparent;
    border-bottom: none;
    margin: 0;
}

.lifecycle-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    padding: 24px;
}

.lifecycle-top,
.lifecycle-bottom {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    min-height: 120px;
}

.lifecycle-middle {
    background: linear-gradient(135deg, var(--ctl-red-lighter) 0%, var(--gray-lightest) 100%);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    min-height: 200px;
    border: 2px solid var(--ctl-pink-light);
    text-align: center; /* Center the In Service label */
}

.state-column {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: var(--gray-lightest);
    border-radius: 12px;
    border: 2px solid var(--gray-lighter);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.state-column:hover {
    transform: scale(1.02);
    border-color: var(--ctl-pink);
    background: var(--white);
}

.state-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-dark);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.conversations-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, 45px);
    gap: 8px;
    overflow-y: visible;
    padding: 5px;
    align-content: start;
}

/* Add scrollbars to exit survey and closed containers */
#exit-conversations,
#closed-conversations {
    max-height: 200px;
    overflow-y: auto;
}

.conversation-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.conversation-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Mobile long-press hint */
@media (hover: none) and (pointer: coarse) {
    .conversation-item::after {
        content: '';
        position: absolute;
        bottom: -2px;
        right: -2px;
        width: 8px;
        height: 8px;
        background: rgba(255,255,255,0.8);
        border-radius: 50%;
        box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    }
}

.conversation-item.welcome {
    background: var(--ctl-peach);
}

.conversation-item.queued {
    background: var(--ctl-red);
}

.conversation-item.transfer {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.6);
    animation: transferPulse 1.5s infinite;
}

@keyframes transferPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.conversation-item.in-service {
    background: var(--success);
}

.conversation-item.exit-survey {
    background: var(--info);
}

.conversation-item.closed {
    background: var(--gray-medium);
    opacity: 0.6;
}

.conversation-item.abandoned {
    background: var(--ctl-red);
    opacity: 0.7;
}

.conversation-item.disconnected {
    background: var(--ctl-red);
    box-shadow: 0 0 8px rgba(255, 62, 65, 0.6);
    animation: disconnectedPulse 1.5s infinite;
}

@keyframes disconnectedPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

/* Transfer Queue Specific */
.transfer-queue-container {
    border-color: var(--warning) !important;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, var(--white) 100%) !important;
}

.transfer-queue-container .state-label {
    color: var(--warning);
}

/* Disconnected Queue Specific */
.disconnected-queue-container {
    border-color: var(--ctl-red) !important;
    background: linear-gradient(135deg, rgba(255, 62, 65, 0.15) 0%, var(--white) 100%) !important;
}

.disconnected-queue-container .state-label {
    color: var(--ctl-red);
    font-weight: 600;
}

/* Welcome Survey Column */
#welcome-survey-column {
    background: linear-gradient(135deg, rgba(255, 179, 186, 0.2) 0%, var(--white) 100%);
}

/* Inbox Column */
#inbox-column {
    background: linear-gradient(135deg, rgba(255, 62, 65, 0.1) 0%, var(--white) 100%);
}

/* Exit Survey Column */
#exit-survey-column {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1) 0%, var(--white) 100%);
}

/* Closed Column */
#closed-column {
    background: linear-gradient(135deg, rgba(117, 117, 117, 0.1) 0%, var(--white) 100%);
}

/* In Service Container */
.in-service-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, 45px);
    gap: 8px;
    align-content: flex-start;
    padding: 5px;
}

/* Counselor Visualization */
.counselors-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    align-content: flex-start;
    overflow-y: visible;
}

.counselor {
    background: var(--gray-medium);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-size: 0.8em;
    color: white;
    position: relative;
    transition: all 0.3s ease;
    min-height: 80px;
    border: 3px solid transparent;
    text-align: center;
}

.counselor:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.counselor-id {
    font-weight: bold;
}

.counselor-load {
    font-size: 0.9em;
    margin-top: 2px;
}

.counselor-conversations {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.mini-conversation {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 0.7em;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.counselor.queued {
    border: 3px solid var(--info);
    box-shadow: 0 0 12px rgba(33, 150, 243, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 12px rgba(33, 150, 243, 0.4); }
    50% { box-shadow: 0 0 20px rgba(33, 150, 243, 0.6); }
    100% { box-shadow: 0 0 12px rgba(33, 150, 243, 0.4); }
}

/* Legend */
.legend-container {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    overflow: hidden;
}

.legend-container h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--charcoal);
    padding: 16px 24px;
    background: transparent;
    border-bottom: none;
    margin: 0 0 16px 0;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 0 24px 24px 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.legend-item:hover {
    background: var(--gray-lightest);
}

.legend-color {
    flex-shrink: 0;
}

.legend-text {
    font-size: 14px;
    color: var(--gray-dark);
}

/* Chart Container */
.chart-container {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    position: relative;
}

.chart-container h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 20px;
    background: transparent;
    border-bottom: none;
}

#counselor-chart {
    border-radius: 12px;
    background: linear-gradient(180deg, var(--ctl-red-lighter) 0%, transparent 100%);
}

#current-time-indicator {
    background: var(--gray-lightest);
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--gray-dark);
    display: inline-block;
    margin-top: 12px;
}

/* Control Buttons */
.controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--ctl-red);
    color: white;
}

.btn-primary:hover {
    background: var(--ctl-red-light);
    box-shadow: var(--shadow-pink);
}

.btn-secondary {
    background: transparent;
    color: var(--ctl-red);
    border: 2px solid var(--ctl-red);
}

.btn-secondary:hover {
    background: var(--ctl-red-lighter);
}

/* Speed Controls */
.speed-controls {
    display: flex;
    gap: 4px;
    background: var(--gray-lightest);
    padding: 4px;
    border-radius: 16px;
}

.speed-btn {
    padding: 8px 16px;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: var(--gray-medium);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.speed-btn:hover {
    background: var(--white);
    color: var(--ctl-red);
}

.speed-btn.active {
    background: var(--ctl-red);
    color: white;
    box-shadow: var(--shadow-soft);
}

/* Animation for assignment */
.conversation {
    position: absolute;
    width: 100px;
    height: 2px;
    background: var(--ctl-coral);
    animation: conversationFlow 2s ease-in-out;
    pointer-events: none;
}

@keyframes conversationFlow {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(300px);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .container {
        padding: 16px;
    }
    
    .controls {
        grid-template-columns: 1fr;
    }
    
    .metrics {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .counselors-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    
    .playback-group {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 12px;
    }
    
    .playback-buttons {
        order: 1;
        flex: 0 0 auto;
    }
    
    .speed-control {
        order: 2;
        flex: 0 0 auto;
    }
    
    .timestamp {
        order: 3;
        flex: 0 0 auto;
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .stop-control {
        order: 4;
        flex: 1 0 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    .stop-label {
        font-size: 12px;
    }
    
    .stop-options {
        flex: 1;
        max-width: 280px;
        justify-content: space-between;
    }
    
    .stop-btn {
        flex: 1;
        padding: 8px 8px;
        font-size: 12px;
    }
    
    .controls-row {
        flex-direction: column;
    }
    
    .speed-controls {
        width: 100%;
        justify-content: center;
    }
    
    .metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .lifecycle-top,
    .lifecycle-bottom {
        flex-direction: column;
        gap: 10px;
    }
    
    .legend-items {
        grid-template-columns: 1fr;
    }
    
    /* Responder Section Mobile Optimization */
    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .section-filters {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        display: flex;
        gap: 8px;
        /* Hide scrollbar but keep scrolling */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .section-filters::-webkit-scrollbar {
        display: none;
    }
    
    /* Visual scroll indicator - fade edges */
    .section-header-row {
        position: relative;
    }
    
    .section-header-row::after {
        content: '';
        position: absolute;
        right: 0;
        bottom: 0;
        width: 30px;
        height: 40px;
        background: linear-gradient(90deg, transparent, var(--white));
        pointer-events: none;
        z-index: 1;
    }
    
    .filter-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .container {
        padding: 10px;
    }
    
    /* Extra small screen header adjustments */
    .header {
        padding: 8px 10px;
    }
    
    .header-content {
        gap: 6px;
        flex-wrap: nowrap; /* Ensure no wrapping on small screens */
    }
    
    .header-playback {
        gap: 4px;
        flex: 1 1 0;
        min-width: 0;
    }
    
    .playback-compact {
        padding: 2px;
        gap: 1px;
    }
    
    .play-btn-compact {
        width: 26px;
        height: 26px;
        font-size: 10px;
        border-radius: 5px;
    }
    
    .time-display-compact {
        font-size: 12px;
        gap: 5px;
    }
    
    .time-display-compact span:first-child {
        font-weight: 500;
        min-width: 38px; /* Even smaller fixed width on very small screens */
    }
    
    .speed-indicator {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    .settings-btn-compact {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .metrics {
        grid-template-columns: 1fr;
    }
    
    .mode-selector-container {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .mode-selector-container > div {
        width: 100% !important;
    }
    
    /* Extra small screen filter button adjustments */
    .section-title {
        font-size: 16px;
    }
    
    .section-filters {
        gap: 6px;
        padding: 2px 0 6px 0;
        /* Show scroll shadow on small screens */
        box-shadow: inset -10px 0 10px -10px rgba(0,0,0,0.1);
    }
    
    .filter-btn {
        padding: 8px 10px;
        font-size: 12px;
        min-width: fit-content;
    }
    
    /* Make responder grid more compact on mobile */
    .responder-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric,
.control-section,
.visualization,
.legend-container,
.chart-container {
    animation: slideIn 0.5s ease-out;
}

/* Event Streaming Styles */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    margin-top: 0 !important; /* Override the control-group label spacing */
    margin-bottom: 0 !important; /* Keep checkboxes close together */
}

.control-btn {
    background: var(--ctl-red);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
    transition: background 0.2s;
}

.control-btn:hover {
    background: var(--ctl-red-light);
}

#streaming-status {
    padding: 8px;
    border-radius: 4px;
    background: var(--gray-lightest);
    margin-top: 10px;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    min-width: 320px;
    max-width: 400px;
    font-size: 14px;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .context-menu {
        min-width: 280px;
        max-width: 90vw;
        font-size: 13px;
    }
}

.context-menu.active {
    display: block;
}

.context-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--gray-lightest);
    border-bottom: 1px solid var(--gray-light);
    border-radius: 8px 8px 0 0;
    cursor: move;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.context-menu.dragging .context-menu-header {
    cursor: grabbing;
}

.context-menu.dragging {
    opacity: 0.9;
    transition: none;
}

.context-menu-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--gray-dark);
}

.context-menu-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-medium);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.context-menu-close:hover {
    background: var(--gray-light);
    color: var(--gray-dark);
}

.context-menu-stats {
    padding: 16px;
    border-bottom: 1px solid var(--gray-light);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-weight: 600;
    color: var(--gray-medium);
    min-width: 120px;
}

.stat-value {
    color: var(--gray-dark);
    text-align: right;
}

.context-menu-actions {
    padding: 16px;
}

.context-menu-actions h5 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--gray-dark);
    font-weight: 600;
}

.context-action-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--gray-dark);
}

.context-action-btn:last-child {
    margin-bottom: 0;
}

.context-action-btn:hover {
    background: var(--gray-lightest);
    border-color: var(--gray-medium);
}

.context-action-btn.transfer-btn:hover {
    background: rgba(255, 152, 0, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.context-action-btn.priority-btn:hover {
    background: rgba(255, 193, 7, 0.1);
    border-color: #FFC107;
    color: #F57C00;
}

.action-icon {
    margin-right: 10px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Prevent text selection on context menu */
.context-menu {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Responder context menu specific styles */
.context-menu-conversations {
    padding: 16px;
    border-top: 1px solid var(--gray-light);
}

.context-menu-conversations h5 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--gray-dark);
    font-weight: 600;
}

/* Toaster Notifications */
.toaster-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 350px;
}

.toaster {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
    border-left: 4px solid var(--gray-medium);
    position: relative;
    overflow: hidden;
}

.toaster.arrival {
    border-left-color: var(--info);
}

.toaster.assignment {
    border-left-color: var(--success);
}

.toaster.completion {
    border-left-color: var(--gray-dark);
}

.toaster.abandonment {
    border-left-color: var(--ctl-red);
}

.toaster.transfer {
    border-left-color: var(--warning);
}

.toaster.counselor_online {
    border-left-color: var(--success);
}

.toaster.counselor_offline {
    border-left-color: var(--gray-medium);
}

.toaster.counselor_queued {
    border-left-color: var(--info);
}

.toaster-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.toaster-content {
    flex: 1;
    min-width: 0;
}

.toaster-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--charcoal);
    margin-bottom: 2px;
}

.toaster-message {
    font-size: 13px;
    color: var(--gray-medium);
    line-height: 1.4;
}

.toaster-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--gray-medium);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toaster-close:hover {
    background: var(--gray-lighter);
    color: var(--charcoal);
}

.toaster-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--gray-light);
    animation: shrinkWidth 5s linear forwards;
    transform-origin: left;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes shrinkWidth {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

.toaster.removing {
    animation: slideOut 0.3s ease-in forwards;
}

/* Mobile adjustments for toasters */
@media (max-width: 768px) {
    .toaster-container {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toaster {
        font-size: 12px;
    }
    
    .toaster-title {
        font-size: 13px;
    }
    
    .toaster-message {
        font-size: 12px;
    }
}

/* Context Menu Properties */
.context-menu-properties {
    padding: 15px;
    border-top: 1px solid var(--gray-lighter);
}

.context-menu-properties h5 {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-dark);
    margin-bottom: 10px;
}

.property-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
}

.property-label {
    color: var(--gray-medium);
}

.property-value {
    color: var(--charcoal);
    font-weight: 500;
}

/* Conversation Properties Configuration */
#properties-container {
    margin: 15px 0;
}

.property-config {
    background: var(--gray-lightest);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
}

.property-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.property-name {
    font-weight: 600;
    color: var(--charcoal);
}

.property-remove-btn {
    background: var(--ctl-red);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.property-remove-btn:hover {
    background: var(--ctl-red-light);
}

.property-values {
    margin-top: 10px;
}

.property-value-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.property-value-name {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    font-size: 13px;
}

.property-value-percentage {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    font-size: 13px;
    text-align: right;
}

.property-value-remove {
    background: transparent;
    border: none;
    color: var(--ctl-red);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
}

.add-value-btn {
    background: var(--info);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 8px;
}

.add-value-btn:hover {
    background: #1976D2;
}

.add-property-btn {
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
}

.add-property-btn:hover {
    background: #45a049;
}

/* Priority Mode Toggle */
.priority-mode-toggle {
    display: flex;
    margin: 10px 0;
    background: var(--gray-lightest);
    border-radius: 8px;
    padding: 4px;
}

.mode-btn {
    flex: 1;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-dark);
    font-weight: 500;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
    background: white;
    color: var(--ctl-red);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Priority Ordering Configuration */
#priority-order-container {
    margin: 15px 0;
}

/* Hierarchy Builder Styles */
#hierarchy-builder {
    margin: 15px 0;
}

.hierarchy-level {
    background: var(--gray-lightest);
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}

.hierarchy-level.dragging {
    opacity: 0.5;
}

.hierarchy-level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hierarchy-level-title {
    font-weight: 600;
    color: var(--charcoal);
    font-size: 14px;
}

.hierarchy-level-property {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.hierarchy-property-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    font-size: 13px;
}

.hierarchy-level-values {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.hierarchy-value-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: var(--gray-lightest);
    border: 1px solid var(--gray-lighter);
    border-radius: 4px;
    cursor: move;
}

.hierarchy-value-item.dragging {
    opacity: 0.5;
}

.hierarchy-value-order {
    font-weight: 600;
    color: var(--gray-medium);
    min-width: 20px;
}

.hierarchy-value-name {
    flex: 1;
    font-size: 13px;
}

.hierarchy-level-remove {
    background: var(--ctl-red);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.add-hierarchy-level-btn {
    background: var(--info);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
}

.add-hierarchy-level-btn:hover {
    background: #1976D2;
}

.priority-group {
    background: var(--gray-lightest);
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
    cursor: move;
}

.priority-group.dragging {
    opacity: 0.5;
}

.priority-group.drag-over {
    border-color: var(--info);
    background: var(--ctl-pink-light);
}

.priority-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.priority-group-title {
    font-weight: 600;
    color: var(--charcoal);
    font-size: 14px;
}

.priority-group-remove {
    background: var(--ctl-red);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.priority-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 30px;
}

.priority-item {
    background: white;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: move;
    display: flex;
    align-items: center;
    gap: 6px;
}

.priority-item:hover {
    background: var(--ctl-pink-light);
}

.priority-item-remove {
    background: transparent;
    border: none;
    color: var(--ctl-red);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.add-priority-group-btn {
    background: var(--info);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
}

.add-priority-group-btn:hover {
    background: #1976D2;
}

.priority-help-text {
    font-size: 12px;
    color: var(--gray-medium);
    margin-bottom: 10px;
    font-style: italic;
}

#transfer-conv-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.conv-option {
    padding: 8px 12px;
    background: var(--gray-lightest);
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.conv-option:hover {
    background: var(--info);
    color: white;
    border-color: var(--info);
}