/* Global Styles */
:root {
    --header-height: 90px;
    --sidebar-width: 280px;
    --logo-height: 85px;
    --logo-offset: 15px;
    --button-gap: 30px;
    --button-top-offset: 37px;
    
    /* n8n Chat Widget Customization - Spruce Green Theme */
    /* User message bubble - spruce green background with white text */
    --chat--message--user--background: #004B45 !important;
    --chat--message--user--color: #ffffff !important;
    --chat--message--user--border: none !important;
    
    /* Chat toggle button - spruce green */
    --chat--toggle--background: #004B45 !important;
    --chat--toggle--hover--background: #003830 !important;
    --chat--toggle--active--background: #002825 !important;
    --chat--toggle--color: #ffffff !important;
    
    /* Chat header - spruce green background */
    --chat--header--background: #004B45 !important;
    
    /* Message bubbles - oval/rounded appearance */
    --chat--message--border-radius: 18px !important;
    
    /* Chat window - more rounded corners */
    --chat--border-radius: 16px !important;
    
    /* Chat background - faded darker gray */
    --chat--color-light: #e8e8e8 !important;
    --chat--color-light-shade-50: #d8d8d8 !important;
    
    /* Input field styling - matching design scheme */
    --chat--input--background: #ffffff !important;
    --chat--input--text-color: #000000 !important;
    --chat--input--border: 1px solid #d8d8d8 !important;
    --chat--input--border-radius: 24px !important;
    --chat--input--padding: 12px 16px !important;
    
    /* Send button styling - spruce green circular button with white arrow */
    --chat--button--background: #004B45 !important;
    --chat--button--color: #ffffff !important;
    --chat--button--hover--background: #003830 !important;
    --chat--button--border-radius: 50% !important;
    
    /* Input container styling - fix bottom corners and add gap */
    /* Note: gap variable defined for potential future n8n updates, currently applied via direct CSS rules */
    --chat--input--container--border-radius: 24px !important;
    --chat--input--container--gap: 8px !important;
    --chat--input--container--padding-bottom: 12px !important;
    --chat--input--container--margin-bottom: 16px !important;
    --chat--window--padding-bottom: 20px !important;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
    padding-top: var(--header-height); /* Account for fixed header */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 75, 69, 0.1);
    padding: 3rem;
    max-width: 450px;
    width: 90%;
}

.logo-section {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 3px solid #004B45;
    padding-bottom: 1.5rem;
}

.logo-section h1 {
    color: #004B45;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.logo-section h2 {
    color: #555;
    font-size: 1.2rem;
    font-weight: 400;
}

.login-content {
    text-align: center;
}

.login-content p {
    margin-bottom: 1.5rem;
    color: #666;
    font-size: 1rem;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background-color: white;
    border: 2px solid #004B45;
    border-radius: 8px;
    color: #004B45;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.google-btn:hover {
    background-color: #004B45;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 75, 69, 0.2);
}

.google-btn svg {
    width: 20px;
    height: 20px;
}

/* Dashboard Header */
.dashboard-header {
    background-color: #004B45;
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    gap: 2rem;
}

.header-content #main-page-btn {
    position: fixed;
    left: calc(var(--logo-height) + var(--logo-offset) + var(--button-gap)); /* Dynamic calculation based on logo dimensions */
    top: var(--button-top-offset);
    z-index: 1001;
    padding: 0.6rem 1.25rem;
    font-size: 1.05rem;
    height: 44px;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    flex-grow: 1;
}

.header-logo {
    position: fixed;
    top: var(--logo-offset);
    left: var(--logo-offset);
    height: var(--logo-height);
    width: auto;
    z-index: 1001;
    flex-shrink: 0;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-divider {
    width: 2px;
    height: 30px;
    background-color: white;
    opacity: 0.6;
}

.admin-btn {
    display: none; /* Hidden by default, shown only for admin users */
}

.signout-btn, .admin-btn, .refresh-btn, .back-btn, .nav-btn {
    padding: 0.5rem 1rem;
    background-color: white;
    color: #004B45;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px; /* Fixed height for consistency */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.coming-soon-btn {
    padding: 0.5rem; /* Reduced padding for more compact appearance */
    opacity: 0.6;
    cursor: not-allowed;
}

.signout-btn:hover, .admin-btn:hover, .refresh-btn:hover, .back-btn:hover, .nav-btn:hover:not(.coming-soon-btn) {
    background-color: #f0f0f0;
    transform: translateY(-1px);
}

/* Left Sidebar with Leaderboard */
.left-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height); /* Below the fixed header */
    bottom: 0;
    width: var(--sidebar-width);
    background-color: #ffffff;
    padding: 3rem 1rem 1.5rem 1rem; /* Increased top padding from 2rem to 3rem */
    overflow-y: auto;
    border-right: 2px solid #e0e0e0;
    z-index: 100;
}

.leaderboard-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    padding: 0.75rem;
    border: 2px solid #004B45;
}

.leaderboard-title {
    color: #004B45;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.4rem 0;
    text-align: center;
    padding-bottom: 0;
}

.leaderboard-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.2rem 0 0.6rem 0;
    flex-wrap: wrap;
}

.leaderboard-filter-label {
    color: #004B45;
    font-size: 1rem;
    font-weight: 700;
}

.leaderboard-filter-select {
    flex: 1;
    min-width: 140px;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    border: 2px solid #004B45;
    border-radius: 6px;
    background-color: #ffffff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaderboard-filter-select:hover {
    background-color: #f9f9f9;
}

.leaderboard-filter-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 75, 69, 0.2);
}

.leaderboard-filter-select option.leaderboard-filter-group {
    color: #004B45;
    font-weight: 700;
}

.leaderboard-divider {
    height: 2px;
    background-color: #004B45;
    border-radius: 2px;
    margin-bottom: 0.6rem;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background-color: #f0f0f0;
    border-color: #004B45;
    transform: translateX(2px);
}

.leaderboard-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: #004B45;
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background-color: #FFD700; /* Gold for #1 */
    color: #004B45;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
    background-color: #C0C0C0; /* Silver for #2 */
    color: #004B45;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
    background-color: #CD7F32; /* Bronze for #3 */
    color: white;
}

.leaderboard-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.leaderboard-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.leaderboard-arrow-up {
    color: #28a745; /* Green for moving up */
}

.leaderboard-arrow-down {
    color: #dc3545; /* Red for moving down */
}

.leaderboard-loading {
    text-align: center;
    color: #666;
    padding: 2rem 0;
    font-style: italic;
}

.leaderboard-error {
    text-align: center;
    color: #dc3545;
    padding: 1rem;
    font-size: 0.85rem;
}

/* Dashboard Main */
.dashboard-main {
    margin: 0 var(--sidebar-width) 0 var(--sidebar-width); /* Add left margin for sidebar, right margin equal to sidebar width */
    padding: 2rem;
    flex: 1;
}

.welcome-section {
    margin-bottom: 2rem;
    text-align: center;
}

.welcome-section h2 {
    color: #004B45;
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
}

.voice-selection-subtitle {
    color: #004B45;
    font-size: 1rem;
    margin: 0.5rem 0 0 0;
    text-align: center;
    font-weight: normal;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
    display: none; /* Hide "Team Performance Overview" */
}

/* Agents Container */
.agents-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.agents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #004B45;
    padding-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.agents-header h3 {
    color: #004B45;
    font-size: 1.5rem;
}

.agents-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sort-label {
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
}

.sort-select {
    padding: 0.4rem 0.75rem;
    font-size: 0.95rem;
    border: 2px solid #004B45;
    border-radius: 6px;
    background-color: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-select:hover {
    background-color: #f9f9f9;
}

.sort-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 75, 69, 0.2);
}

.agents-table-container {
    overflow-x: auto;
}

.agents-table {
    width: 100%;
    border-collapse: collapse;
}

.agents-table thead {
    background-color: #004B45;
    color: white;
}

.agents-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.agents-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.agents-table tbody tr:hover {
    background-color: #f9f9f9;
}

.agents-table td {
    padding: 1rem;
    color: #333;
}

.agent-name {
    font-weight: 600;
    color: #004B45;
}

.agent-actions {
    text-align: center;
    width: 80px;
}

.email-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background-color: white;
    border: 2px solid #004B45;
    border-radius: 6px;
    color: #004B45;
    cursor: pointer;
    transition: all 0.2s ease;
}

.email-btn:hover {
    background-color: #004B45;
    color: white;
    transform: translateY(-1px);
}

.email-btn svg {
    width: 18px;
    height: 18px;
}

/* Agent Detail Page */
.agent-detail-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.back-btn {
    margin-bottom: 1.5rem;
}

.agent-profile {
    max-width: 1000px;
}

.agent-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #004B45;
}

.agent-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #004B45;
    display: none; /* Temporarily hidden - will be re-enabled later */
}

.agent-info h2 {
    color: #004B45;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.agent-info p {
    color: #666;
    font-size: 1rem;
}

.agent-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border: 2px solid #004B45;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.stat-card h3 {
    color: #004B45;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stat-value {
    color: #333;
    font-size: 1.8rem;
    font-weight: 700;
}

.notes-section {
    padding: 1.5rem;
    background-color: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #004B45;
}

.notes-section h3 {
    color: #004B45;
    margin-bottom: 1rem;
}

.info-note {
    color: #666;
    font-style: italic;
}

/* Add Note Form Styles */
.add-note-container {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.note-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
}

.note-textarea:focus {
    outline: none;
    border-color: #004B45;
    box-shadow: 0 0 0 2px rgba(0, 75, 69, 0.1);
}

.add-note-btn {
    background-color: #004B45;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.add-note-btn:hover {
    background-color: #003830;
}

.add-note-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Notes List Styles */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.note-item {
    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 1rem;
    position: relative;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.note-type {
    font-weight: 600;
    color: #004B45;
    font-size: 0.9rem;
}

.note-type.manager-note {
    color: #004B45;
}

.note-type.agent-note {
    color: #0066cc;
}

.note-timestamp {
    font-size: 0.85rem;
    color: #666;
}

.note-content {
    color: #333;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.note-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.delete-note-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.delete-note-btn:hover {
    background-color: #c82333;
}

.no-notes-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Heat Map Styles */
.heatmap-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative; /* Enable absolute positioning for help text */
}

.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid #004B45;
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.heatmap-header h3 {
    color: #004B45;
    font-size: 1.5rem;
    margin: 0;
}

.heatmap-subtitle {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

.heatmap-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.heatmap-control-label {
    color: #004B45;
    font-size: 1.2rem;
    font-weight: bold;
}

.heatmap-select {
    padding: 0.4rem 0.75rem;
    font-size: 0.95rem;
    border: 2px solid #004B45;
    border-radius: 6px;
    background-color: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.heatmap-select:hover {
    background-color: #f9f9f9;
}

.heatmap-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 75, 69, 0.2);
}

.heatmap-help-text {
    position: fixed;
    right: 20px;
    bottom: 100px; /* Position above the n8n chat button which is typically at bottom */
    color: #004B45;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: right;
    max-width: 200px;
    line-height: 1.4;
    z-index: 999; /* Below chat button (which is usually 1000+) */
}

.heatmap-help-text .arrow-down {
    display: block;
    font-size: 2rem;
    margin-top: 0.5rem;
    text-align: right; /* Right-justify arrow to point to center of n8n button */
    margin-right: 20px; /* Double the space from right edge (20px container + 20px margin = 40px total) */
}

/* Feedback button */
.feedback-button {
    position: fixed;
    right: 20px;
    bottom: 280px; /* Position above feedback help text */
    width: 60px;
    height: 60px;
    background-color: #005d7d; /* Cobalt color (R0:G93:B125) */
    border-radius: 50%; /* Make it a perfect circle */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 93, 125, 0.3);
    transition: all 0.3s ease;
}

.feedback-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 93, 125, 0.4);
}

.feedback-button svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Feedback help text */
.feedback-help-text {
    position: fixed;
    right: 20px;
    bottom: 350px; /* Position above feedback button */
    color: #005d7d; /* Cobalt color */
    font-size: 1.5rem;
    font-weight: 700;
    text-align: right;
    max-width: 300px;
    line-height: 1.4;
    z-index: 999;
}

.feedback-help-text .arrow-down {
    display: block;
    font-size: 2rem;
    margin-top: 0.5rem;
    text-align: right;
    margin-right: 20px; /* Point to center of button */
}

/* Wrapper for heatmap and loading overlay */
.heatmap-wrapper {
    position: relative; /* Enable absolute positioning for loading overlay */
    width: 100%;
}

.heatmap-map {
    width: 100%;
    height: 450px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    background-color: #f5f5f5;
}

/* Tighten Google Maps info window close button spacing */
.heatmap-map .gm-style .gm-ui-hover-effect {
    top: 0;
    right: 6px;
    transform: translate(18px, -5px);
}

/* DOM-only close button offset */
.heatmap-map.dom-info-open .gm-style .gm-ui-hover-effect {
    transform: translate(18px, 0px);
}

.heatmap-map .gm-style .gm-ui-hover-effect > span {
    margin: 0;
}

/* Reduce extra top whitespace inside the Google Maps info window bubble */
.heatmap-map .gm-style .gm-style-iw {
    padding-top: 0;
}

.heatmap-map .gm-style .gm-style-iw-d {
    overflow: hidden;
    margin-top: -20px;
}

/* Narrow DOM info windows only */
.heatmap-map .gm-style .dom-info-window {
    width: 140px;
    box-sizing: border-box;
}

.heatmap-data-source {
    color: #666;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.75rem;
    margin-bottom: 0;
    text-align: center;
}

.heatmap-info {
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border: 2px solid #004B45;
    border-radius: 8px;
}

.heatmap-info.hidden {
    display: none;
}

.heatmap-info h4 {
    color: #004B45;
    font-size: 1.2rem;
    margin: 0 0 0.75rem 0;
}

.heatmap-info-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.heatmap-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.heatmap-stat-label {
    color: #666;
    font-size: 0.85rem;
}

.heatmap-stat-value {
    color: #333;
    font-size: 1.25rem;
    font-weight: 700;
}

.heatmap-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #666;
    font-size: 1rem;
}

.heatmap-error {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #004B45;
    font-size: 1rem;
    text-align: center;
    padding: 1rem;
}

/* Heat Map Loading Overlay */
.heatmap-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85); /* Onionskin white layer */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.heatmap-loading-overlay.hidden {
    display: none;
}

.heatmap-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 75, 69, 0.2); /* Light spruce green */
    border-top: 4px solid #004B45; /* Spruce green */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.heatmap-loading-text {
    color: #004B45; /* Spruce green */
    font-size: 1.1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding-top: 80px; /* Reduced padding for mobile */
        display: flex;
        flex-direction: column;
    }

    .dashboard-header {
        order: 1;
    }

    .header-logo {
        position: static;
        height: 60px;
    }

    .header-content #main-page-btn {
        position: static;
        left: auto;
        top: auto;
        z-index: auto;
    }

    .dashboard-main {
        order: 2;
        margin-left: 0; /* Remove left margin on mobile */
        margin-right: 0; /* Remove right margin on mobile */
        padding: 1rem;
    }

    .left-sidebar {
        position: static;
        width: 100%;
        border-right: none;
        border-top: 2px solid #e0e0e0;
        padding: 1rem;
        margin-top: 1rem;
        order: 3; /* Move to bottom */
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .agents-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .agents-controls {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .sort-controls {
        width: 100%;
    }

    .agent-header {
        flex-direction: column;
        text-align: center;
    }

    .agents-table th,
    .agents-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .agent-actions {
        width: 60px;
    }

    .email-btn {
        width: 32px;
        height: 32px;
    }

    .email-btn svg {
        width: 16px;
        height: 16px;
    }

    .heatmap-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .heatmap-controls {
        margin-bottom: 0.75rem;
    }

    .heatmap-help-text {
        position: fixed;
        right: 20px;
        bottom: 80px; /* Adjusted for mobile */
        max-width: 150px;
        font-size: 1.2rem;
    }

    .feedback-button {
        bottom: 220px; /* Adjusted for mobile, above feedback help text */
        width: 50px;
        height: 50px;
    }

    .feedback-button svg {
        width: 25px;
        height: 25px;
    }

    .feedback-help-text {
        bottom: 280px; /* Adjusted for mobile */
        max-width: 230px;
        font-size: 1.2rem;
    }

    .heatmap-map {
        height: 300px;
    }

    .heatmap-data-source {
        font-size: 0.75rem;
    }

    .heatmap-info-stats {
        flex-direction: column;
        gap: 1rem;
    }
}

/* n8n Chat Widget Customization */
/* Note: Chat widget styling is now handled via CSS variables in the global :root selector above */

/* Additional specific overrides for n8n chat widget elements */
/* Make send button circular with spruce green background and white arrow */
.chat-input-send-button,
[class*="chat"] button[class*="send"],
[class*="ChatInput"] button[type="submit"],
[class*="ChatInput"] button:last-child,
button[data-key="sendButton"],
button[aria-label*="Send"],
[class*="SendButton"] {
    border-radius: 50% !important;
    background-color: #004B45 !important;
    color: #ffffff !important;
    min-width: 40px !important;
    min-height: 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Send button icon (arrow) should be white */
.chat-input-send-button svg,
[class*="chat"] button[class*="send"] svg,
[class*="ChatInput"] button[type="submit"] svg,
[class*="ChatInput"] button:last-child svg,
button[data-key="sendButton"] svg,
button[aria-label*="Send"] svg,
[class*="SendButton"] svg {
    fill: #ffffff !important;
    color: #ffffff !important;
}

.chat-input-send-button:hover,
[class*="chat"] button[class*="send"]:hover,
[class*="ChatInput"] button[type="submit"]:hover,
[class*="ChatInput"] button:last-child:hover,
button[data-key="sendButton"]:hover,
button[aria-label*="Send"]:hover,
[class*="SendButton"]:hover {
    background-color: #003830 !important;
}

/* Fix input container border-radius to prevent cut-off corners and add gap */
/* Lift input area higher to prevent border cut-off at bottom corners of rounded widget */
.chat-inputs,
[class*="ChatInputs"],
[class*="chat-input-container"],
[class*="ChatInput-module"],
[class*="InputWrapper"],
div[class*="chat"] > form,
div[class*="Chat"] > form {
    border-radius: 24px !important;
    overflow: visible !important;
    gap: 8px !important;
    display: flex !important;
    align-items: center !important;
    padding-bottom: var(--chat--input--container--padding-bottom) !important;
    margin-bottom: var(--chat--input--container--margin-bottom) !important;
}

/* Add bottom padding to chat window to prevent rounded corners from cutting off input area border */
/* Scoped to n8n chat widget container only to avoid affecting other elements */
/* Target the main chat window container, not child elements */
/* Use :not() to exclude form elements and common child elements */
[class*="n8n"][class*="chat"]:not(form):not(button):not(input):not(textarea),
[class*="n8n"][class*="Chat"]:not(form):not(button):not(input):not(textarea),
[id^="n8n-chat"],
[id^="n8nChat"] {
    padding-bottom: var(--chat--window--padding-bottom) !important;
}

/* Make n8n chat input textarea wider (80% wider than default) and ensure proper oval styling */
/* Target the textarea/input element for user text input */
[class*="ChatInput"] textarea,
[class*="ChatInput"] input[type="text"],
[class*="chat"] textarea,
[class*="chat"] input[type="text"],
textarea[placeholder*="Type"],
textarea[placeholder*="question"],
input[placeholder*="Type"],
input[placeholder*="question"],
.chat-message-input,
[data-key="input"],
[class*="MessageInput"] {
    flex: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    border-radius: var(--chat--input--border-radius) !important;
    background: var(--chat--input--background) !important;
    border: var(--chat--input--border) !important;
    padding: var(--chat--input--padding) !important;
}

/* YouTube Profile Planner Styles */
.planner-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
    position: relative;
}

/* Help Tooltip */
.help-tooltip {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 10001;
}

.help-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(128, 128, 128, 0.3);
    color: rgba(128, 128, 128, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: help;
    transition: all 0.2s ease;
}

.help-icon:hover {
    background-color: rgba(128, 128, 128, 0.4);
}

.help-text {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    background-color: #333;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    width: 300px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10000;
}

.help-tooltip:hover .help-text {
    display: block;
}

/* URL Input Section */
.url-input-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 2rem;
}

.url-input-label {
    color: #004B45;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    text-align: center;
}

.url-input-container {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
    max-width: 700px;
}

.youtube-url-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #004B45;
    border-radius: 6px;
    outline: none;
    transition: all 0.2s ease;
}

.youtube-url-input:focus {
    border-color: #004B45;
    box-shadow: 0 0 0 3px rgba(0, 75, 69, 0.2);
}

.submit-url-btn {
    padding: 0.75rem 2rem;
    background-color: #004B45;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.submit-url-btn:hover {
    background-color: #003830;
    transform: translateY(-1px);
}

.error-message {
    color: #dc3545;
    font-size: 1rem;
    margin-top: 1rem;
    text-align: center;
    min-height: 24px;
}

/* Chat Interface */
.chat-interface {
    display: flex;
    flex-direction: column;
    height: 600px;
    border: 2px solid #004B45;
    border-radius: 8px;
    background-color: white;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 70%;
    word-wrap: break-word;
}

.chat-message.user {
    background-color: #004B45;
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.chat-message.system {
    background-color: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e0e0e0;
}

/* Markdown formatting within chat messages */
.chat-message.system h1,
.chat-message.system h2,
.chat-message.system h3 {
    color: #004B45;
    margin: 0.5rem 0;
    font-weight: 600;
}

.chat-message.system h1 {
    font-size: 1.5rem;
}

.chat-message.system h2 {
    font-size: 1.3rem;
}

.chat-message.system h3 {
    font-size: 1.1rem;
}

.chat-message.system strong {
    font-weight: 600;
    color: #000;
}

.chat-message.system em {
    font-style: italic;
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background-color: white;
    border-top: 2px solid #e0e0e0;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit; /* Use same font as rest of page */
    line-height: 1.5;
    border: 2px solid #004B45;
    border-radius: 6px;
    outline: none;
    resize: none; /* Disable manual resize */
    overflow-y: auto; /* Enable scrolling for long content */
    min-height: 2.5rem; /* Minimum height for one line */
    max-height: 10rem; /* Maximum height before scrolling */
    transition: all 0.2s ease;
}

.chat-input:focus {
    border-color: #004B45;
    box-shadow: 0 0 0 3px rgba(0, 75, 69, 0.2);
}

.chat-submit-btn {
    padding: 0.75rem 2rem;
    background-color: #004B45;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chat-submit-btn:hover {
    background-color: #003830;
    transform: translateY(-1px);
}

/* Typing indicator animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.typing-text {
    margin-right: 2px;
    color: #004B45;
    font-weight: 500;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #004B45;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing-pulse 1.4s infinite;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes typing-pulse {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Footer Styles */
.page-footer {
    background-color: #f5f5f5;
    color: #666;
    text-align: center;
    padding: 1rem 2rem;
    font-size: 0.85rem;
    border-top: 1px solid #e0e0e0;
    margin-top: 2rem;
}

.page-footer p {
    margin: 0;
}

/* Customer Voice Chat Page Styles */
.voice-chat-main {
    max-width: 1400px;
    margin: 0 auto; /* No left margin - no sidebar on this page */
    padding: 2rem;
    flex: 1;
}

.voice-chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 4rem 2rem;
    margin: 2rem auto;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.connect-voice-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: #004B45;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 75, 69, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.connect-voice-btn:hover {
    background-color: #003830;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 75, 69, 0.4);
}

.connect-voice-btn:active {
    transform: scale(0.98);
}

.phone-icon {
    width: 48px;
    height: 48px;
    fill: white;
}

.disconnect-voice-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: #dc3545;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-top: 2rem;
}

.disconnect-voice-btn:hover {
    background-color: #c82333;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.disconnect-voice-btn:active {
    transform: scale(0.98);
}

/* Pulsing animation for active connection */
.connect-voice-btn.active {
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 4px 15px rgba(0, 75, 69, 0.3);
    }
    50% {
        box-shadow: 0 4px 15px rgba(0, 75, 69, 0.3), 0 0 0 15px rgba(96, 125, 122, 0.3);
    }
    100% {
        box-shadow: 0 4px 15px rgba(0, 75, 69, 0.3);
    }
}

/* Connection Status Indicator */
.connection-status {
    margin-top: 2rem;
    font-size: 1.25rem;
    font-weight: bold;
    color: #004B45;
    text-align: center;
}

/* Connecting Status Indicator with pulsing animation */
.connecting-status {
    margin-top: 2rem;
    font-size: 1.25rem;
    font-weight: bold;
    color: #004B45;
    text-align: center;
    animation: text-pulse 1.5s ease-in-out infinite;
}

@keyframes text-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/* Agent Selection Page Styles */
.agent-selection-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 3rem 2rem;
    margin: 2rem auto;
    max-width: 600px;
}

.agent-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.agent-option {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agent-option:hover {
    border-color: #004B45;
    background-color: #f9f9f9;
}

.agent-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    cursor: pointer;
    accent-color: #004B45;
}

.agent-option-label {
    font-size: 1.1rem;
    color: #333;
    font-weight: 500;
}

.agent-option:has(input[type="radio"]:checked) .agent-option-label {
    color: #004B45;
    font-weight: 600;
}

.submit-btn {
    width: 100%;
    padding: 1rem 2rem;
    background-color: #004B45;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background-color: #003830;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 75, 69, 0.2);
}

.submit-btn:active {
    transform: translateY(0);
}

/* Agent name subtitle on voice chat page */
.agent-name-subtitle {
    color: #004B45;
    font-size: 2rem;
    margin-top: 0.5rem;
    font-weight: 700;
    text-align: center;
}

/* Explanatory text under voice chat buttons */
.voice-chat-instructions {
    margin-top: 0.5rem;
    text-align: center;
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
}

