/**
 * Concierge AI Suite - Frontend Styles
 * Comprehensive styling for the public-facing chat interface
 */

/* =============================================================================
   Container & Layout
   ============================================================================= */

/* Property Title (shown when auto-selected from URL) */
.cas-fe-property-title {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px auto;
    padding: 20px;
    background: #ffffff !important;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    border: 1px solid #e5e5e5;
    box-sizing: border-box;
}

.cas-fe-property-title h2 {
    margin: 0;
    color: #1a1a1a !important;
    font-size: 24px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* Remove margin from any nested elements in property title */
.cas-fe-property-title p {
    margin: 0;
    padding: 0;
    display: none; /* Hide empty p tags */
}

.cas-fe-property-title > * {
    margin-top: 0;
    margin-bottom: 0;
}

.cas-frontend-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    box-sizing: border-box;
}

/* Elementor container fix - remove bottom padding */
.e-con.e-flex > .e-con-inner {
    padding-bottom: 0px !important;
}

/* Mixed mode wrapper: fill viewport height */
.cas-mixed-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center children horizontally */
    justify-content: center; /* Center vertically when chat not started */
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden; /* Prevent page scroll */
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* When chat is active, align to top */
.cas-mixed-wrapper.cas-chat-active {
    justify-content: flex-start;
}

.cas-mixed-wrapper .cas-fe-property-title {
    flex: 0 0 auto; /* Fixed size */
    width: 100%;
    max-width: none; /* Override the max-width since wrapper handles it */
    margin-bottom: 0; /* Remove margin, use gap instead */
}

/* Add gap between title and button only when chat not started */
.cas-mixed-wrapper:not(.cas-chat-active) .cas-fe-property-title {
    margin-bottom: 24px;
}

.cas-mixed-wrapper .cas-frontend-mixed {
    flex: 1 1 auto;
    min-height: 0; /* Allow shrinking */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    max-width: none; /* Override the max-width since wrapper handles it */
}

/* When chat not active, don't let container take all space */
.cas-mixed-wrapper:not(.cas-chat-active) .cas-frontend-mixed {
    flex: 0 0 auto;
}

/* Hide empty <p> tags that WordPress might add */
.cas-frontend-container > p:empty,
.cas-fe-chat-container > p:empty,
.cas-fe-voice-status > p:empty {
    display: none;
    margin: 0;
    padding: 0;
}

/* Force button text to have no extra spacing */
.cas-fe-button,
.cas-fe-button-primary,
.cas-fe-button-secondary {
    font-style: normal !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    vertical-align: middle;
}

/* Remove any inherited spacing from button text */
button.cas-fe-button,
button.cas-fe-button-primary,
button.cas-fe-button-secondary {
    box-sizing: border-box !important;
}

.cas-frontend-disabled {
    padding: 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    text-align: center;
}

/* =============================================================================
   Property Selector
   ============================================================================= */

.cas-fe-property-selector {
    margin-bottom: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: opacity 0.3s ease, height 0.3s ease;
}

/* Hide property selector when auto-selected from URL */
.cas-fe-property-selector.cas-fe-auto-selected {
    display: none;
}

.cas-fe-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.cas-fe-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cas-fe-select:hover {
    border-color: #0084FF;
}

.cas-fe-select:focus {
    outline: none;
    border-color: #0084FF;
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.1);
}

/* =============================================================================
   Session Type Buttons
   ============================================================================= */

.cas-fe-session-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.cas-fe-button {
    flex: 1;
    min-width: 200px;
    padding: 14px 24px;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    white-space: normal;
    word-wrap: break-word;
}

.cas-fe-button-primary {
    background: #0084FF !important;
    color: #fff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    line-height: 1;
    white-space: normal;
    word-wrap: break-word;
    padding-top: 14px;
    padding-bottom: 14px;
}

.cas-fe-button-primary:hover {
    background: #0073E6 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
}

/* Start button icons */
.cas-fe-start-icon {
    flex-shrink: 0;
    stroke: #fff;
}

.cas-fe-start-text {
    margin-left: 4px;
}

.cas-fe-button-secondary {
    background: #2196F3;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    white-space: normal;
    word-wrap: break-word;
}

.cas-fe-button-secondary:hover {
    background: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.cas-fe-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* =============================================================================
   Chat Container
   ============================================================================= */

.cas-fe-chat-container {
    background: #fff !important;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Mixed chat container - full height layout */
#cas-fe-mixed-chat-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.cas-fe-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #ffffff !important;
    border-bottom: 1px solid #e5e5e5;
    color: #1a1a1a !important;
}

.cas-fe-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a !important;
}

.cas-fe-button-close {
    background: #f0f0f0 !important;
    border: none;
    color: #666 !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.cas-fe-button-close:hover {
    background: #e0e0e0 !important;
    color: #333 !important;
}

/* =============================================================================
   Transcript Area
   ============================================================================= */

.cas-fe-transcript {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px; /* Extra space for sticky status bar */
    background: #ffffff !important;
}

.cas-fe-message {
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cas-fe-message-user {
    background: #0084FF !important;
    color: #ffffff !important;
    padding: 10px 16px;
    border-radius: 18px 18px 4px 18px;
    margin-left: auto;
    margin-right: 0;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.cas-fe-message-user strong {
    color: #ffffff !important;
    display: none; /* Hide "Vous:" prefix in modern chat style */
}

.cas-fe-message-assistant {
    background: #f0f0f0 !important;
    color: #1a1a1a !important;
    padding: 10px 16px;
    border-radius: 18px 18px 18px 4px;
    margin-right: auto;
    margin-left: 0;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.cas-fe-message-assistant strong {
    color: #666 !important;
    font-size: 0.85em;
    display: block;
    margin-bottom: 4px;
}

/* Typing Indicator - Bouncing Dots Animation */
.cas-fe-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f0f0 !important;
    border-radius: 18px 18px 18px 4px;
    margin-right: auto;
    margin-left: 0;
    max-width: 80px;
    animation: fadeIn 0.3s ease;
}

.cas-fe-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: cas-fe-typing-bounce 1.4s infinite ease-in-out both;
}

.cas-fe-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.cas-fe-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.cas-fe-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes cas-fe-typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.cas-fe-message-timestamp {
    font-size: 10px;
    color: #999 !important;
    margin-top: 4px;
    padding: 0 8px;
}

/* =============================================================================
   Input Area
   ============================================================================= */

.cas-fe-input-area {
    padding: 12px 16px;
    background: #fff !important;
    border-top: 1px solid #e5e5e5;
}

.cas-fe-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #e5e5e5 !important;
    border-radius: 20px;
    resize: vertical;
    transition: all 0.3s ease;
    background: #f8f8f8 !important;
    color: #1a1a1a !important;
}

.cas-fe-textarea:focus {
    outline: none;
    border-color: #0084FF !important;
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.1);
    background: #fff !important;
}

.cas-fe-chat-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.cas-fe-chat-actions .cas-fe-button {
    flex: 0 0 auto;
    min-width: auto;
    padding: 11px 20px;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    white-space: normal;
    word-wrap: break-word;
}

/* Clear Chat Button - grey style */
#cas-fe-clear-chat {
    background: #e0e0e0 !important;
    color: #666 !important;
    padding: 11px 20px;
    font-size: 15px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}

#cas-fe-clear-chat:hover {
    background: #d0d0d0 !important;
    color: #333 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#cas-fe-clear-chat:disabled {
    background: #f0f0f0 !important;
    color: #bbb !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cas-fe-session-info {
    font-size: 12px;
    color: #666;
    margin-left: auto;
}

/* =============================================================================
   Voice Chat Interface
   ============================================================================= */

.cas-fe-voice-controls {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    background: #fff;
}

.cas-fe-voice-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    margin: 0;
    background: #f8f8f8 !important;
    border-top: 1px solid #e5e5e5;

    /* Make status bar sticky at bottom of viewport */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
    max-width: 100%;
}

/* Close button in footer/status bar */
.cas-fe-voice-status .cas-fe-button-close {
    margin-left: auto;
    flex-shrink: 0;
}

/* Remove margin from any nested elements in voice status */
.cas-fe-voice-status p {
    margin: 0;
    padding: 0;
}

.cas-fe-voice-status > * {
    margin-top: 0;
    margin-bottom: 0;
}

.cas-fe-voice-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.cas-fe-voice-indicator.ready {
    background: #0084FF;
}

.cas-fe-voice-indicator.listening {
    background: #0084FF;
    animation: pulseFast 1s infinite;
}

.cas-fe-voice-indicator.recording {
    background: #FF3B30;
    animation: pulseFast 0.8s infinite;
}

.cas-fe-voice-indicator.speaking {
    background: #0084FF;
}

.cas-fe-voice-indicator.processing {
    background: #FF9500;
    animation: pulseFast 0.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes pulseFast {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

#cas-fe-voice-status-text {
    font-weight: 500;
    color: #1a1a1a !important;
    font-size: 14px;
}

.cas-fe-voice-info {
    padding: 16px 20px;
    background: #f8f8f8 !important;
    border-top: 1px solid #e5e5e5;
}

.cas-fe-voice-info p {
    margin: 0 0 10px 0;
}

.cas-fe-voice-info ol {
    margin: 10px 0;
    padding-left: 25px;
}

.cas-fe-voice-info li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.cas-fe-voice-info .description {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* =============================================================================
   Loading States
   ============================================================================= */

.cas-fe-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f0f0f0;
    border-top: 2px solid #0084FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* =============================================================================
   Responsive Design
   ============================================================================= */

@media (max-width: 768px) {
    /* Remove global padding on mobile for full-width chat interface */
    .has-global-padding {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .cas-fe-property-title {
        padding: 15px;
        margin-bottom: 15px;
    }

    .cas-fe-property-title h2 {
        font-size: 20px;
    }

    .cas-frontend-container {
        padding: 0;
    }

    .cas-fe-session-buttons {
        flex-direction: column;
    }

    .cas-fe-button {
        min-width: auto;
        padding: 10px 20px;
        font-size: 16px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1 !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cas-fe-session-buttons .cas-fe-button {
        min-width: 100%;
    }

    .cas-fe-voice-controls {
        flex-direction: column;
    }

    .cas-fe-voice-controls .cas-fe-button {
        width: 100%;
    }

    /* Reduce input area padding on mobile */
    .cas-fe-input-area,
    .cas-fe-mixed-input-area {
        padding: 10px 12px;
    }

    /* Keep user messages on the right, assistant on the left */
    .cas-fe-message-user {
        margin-left: auto;
        margin-right: 0;
    }

    .cas-fe-message-assistant {
        margin-left: 0;
        margin-right: auto;
    }

    .cas-fe-chat-actions {
        flex-direction: column;
        margin-top: 8px;
        gap: 8px;
    }

    .cas-fe-chat-actions .cas-fe-button {
        width: 100%;
        padding: 10px 18px;
        font-size: 15px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1 !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Ensure button-primary has consistent sizing on mobile */
    .cas-fe-button-primary {
        padding: 10px 20px !important;
        font-size: 16px;
        line-height: 1 !important;
        height: auto;
    }

    /* Fix vertical alignment for send button specifically */
    #cas-fe-send-message,
    #cas-fe-mixed-send {
        line-height: 0.9 !important;
        padding: 12px 20px 11px 20px !important;
        vertical-align: middle;
        height: auto !important;
        min-height: auto !important;
    }

    /* Force text to center vertically */
    .cas-fe-chat-actions .cas-fe-button-primary {
        line-height: 0.9 !important;
        padding-top: 12px !important;
        padding-bottom: 11px !important;
    }

    .cas-fe-session-info {
        margin-left: 0;
        text-align: center;
    }

    /* Ensure voice status bar background is consistent on mobile */
    .cas-fe-voice-status {
        background: #f8f8f8 !important;
        padding: 8px 12px;
        gap: 8px;
    }

    #cas-fe-voice-status-text,
    #cas-fe-mixed-status-text {
        font-size: 13px;
    }

    /* Force light backgrounds on all devices */
    .cas-fe-chat-container,
    #cas-fe-mixed-chat-container,
    .cas-fe-transcript,
    #cas-fe-mixed-transcript {
        background: #ffffff !important;
    }

    .cas-fe-chat-header {
        background: #ffffff !important;
        color: #1a1a1a !important;
    }

    .cas-fe-message-user {
        background: #0084FF !important;
        color: #ffffff !important;
    }

    .cas-fe-message-assistant {
        background: #f0f0f0 !important;
        color: #1a1a1a !important;
    }
}

/* =============================================================================
   Dark Mode Support - DISABLED
   ============================================================================= */

/* Dark mode styles removed to ensure consistent appearance across all devices
   and theme preferences. Interface will use light theme on both desktop and mobile. */

/* =============================================================================
   ConvAI Voice Transcript Styles
   ============================================================================= */

.cas-fe-voice-transcript {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 15px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.cas-fe-transcript-message {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 6px;
    line-height: 1.5;
}

.cas-fe-transcript-user {
    background: #0084FF !important;
    border-left: none;
    color: #ffffff !important;
    border-radius: 18px 18px 4px 18px;
    margin-left: auto;
    margin-right: 0;
    max-width: 70%;
}

.cas-fe-transcript-agent {
    background: #f0f0f0 !important;
    border-left: none;
    color: #1a1a1a !important;
    border-radius: 18px 18px 18px 4px;
    margin-right: auto;
    margin-left: 0;
    max-width: 70%;
}

.cas-fe-transcript-system {
    background: #f8f8f8 !important;
    border-left: 3px solid #e0e0e0;
    color: #666 !important;
    font-style: italic;
    font-size: 0.85em;
}

.cas-fe-transcript-message strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.cas-fe-convai-notice {
    background: #f0f7ff !important;
    border-left: 4px solid #0084FF;
    padding: 12px 16px;
    margin-top: 15px;
    border-radius: 8px;
    font-size: 0.9em;
    color: #1a1a1a !important;
}

/* Voice indicator states */
.cas-fe-voice-indicator.listening {
    background: #0084FF;
    animation: pulse 1.5s ease-in-out infinite;
}

.cas-fe-voice-indicator.speaking {
    background: #0084FF;
    animation: pulse 1s ease-in-out infinite;
}

.cas-fe-voice-indicator.connecting {
    background: #FF9500;
    animation: pulse 0.8s ease-in-out infinite;
}

.cas-fe-voice-indicator.error {
    background: #FF3B30;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* =============================================================================
   Mixed Voice/Text Interface Styles
   ============================================================================= */

/* Mixed mode container */
.cas-frontend-mixed #cas-fe-mixed-chat-container {
    background: #fff !important;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Hide empty <p> tags in mixed mode */
.cas-frontend-mixed > p:empty,
#cas-fe-mixed-chat-container > p:empty {
    display: none;
    margin: 0;
    padding: 0;
}

/* Mixed input area - fixed at bottom */
.cas-fe-mixed-input-area {
    flex: 0 0 auto;
    padding: 12px 16px;
    background: #fff !important;
    border-top: 1px solid #e5e5e5;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Voice controls inline (microphone + speaker toggle) */
.cas-fe-voice-controls-inline {
    margin-bottom: 8px;
    display: flex;
    justify-content: stretch;
    gap: 10px;
    flex-wrap: nowrap;
    width: 100%;
    box-sizing: border-box;
}

/* Microphone toggle button */
.cas-fe-mic-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #0084FF !important;
    color: #fff !important;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 132, 255, 0.2);
    flex: 1 1 0%;
    height: 44px;
    min-width: 0;
    box-sizing: border-box;
}

.cas-fe-mic-button:hover {
    background: #0073E6 !important;
    box-shadow: 0 3px 8px rgba(0, 132, 255, 0.3);
    transform: translateY(-1px);
}

.cas-fe-mic-button:active {
    transform: translateY(0);
}

/* Muted state */
.cas-fe-mic-button.cas-fe-mic-muted {
    background: #FF3B30 !important;
    box-shadow: 0 2px 4px rgba(255, 59, 48, 0.2);
}

.cas-fe-mic-button.cas-fe-mic-muted:hover {
    background: #E6342A !important;
    box-shadow: 0 3px 8px rgba(255, 59, 48, 0.3);
}

/* SVG icons in mic/speaker buttons */
.cas-fe-mic-button svg,
.cas-fe-speaker-button svg {
    stroke: currentColor;
    flex-shrink: 0;
}

/* Countdown badge for inactivity auto-end on end button */
#cas-fe-end-mixed-session {
    position: relative;
}

#cas-fe-end-mixed-session[data-countdown]::after {
    content: attr(data-countdown);
    position: absolute;
    top: -8px;
    right: -8px;
    background: #FF3B30;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: pulse-countdown 1s ease-in-out infinite;
}

@keyframes pulse-countdown {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.cas-fe-mic-button {
    position: relative;
}

/* Speaker toggle button */
.cas-fe-speaker-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #0084FF !important;
    color: #fff !important;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 132, 255, 0.2);
    flex: 1 1 0%;
    height: 44px;
    min-width: 0;
    box-sizing: border-box;
}

.cas-fe-speaker-button:hover {
    background: #0073E6 !important;
    box-shadow: 0 3px 8px rgba(0, 132, 255, 0.3);
    transform: translateY(-1px);
}

.cas-fe-speaker-button:active {
    transform: translateY(0);
}

/* Muted speaker state */
.cas-fe-speaker-button.cas-fe-speaker-muted {
    background: #FF3B30 !important;
    box-shadow: 0 2px 4px rgba(255, 59, 48, 0.2);
}

.cas-fe-speaker-button.cas-fe-speaker-muted:hover {
    background: #E6342A !important;
    box-shadow: 0 3px 8px rgba(255, 59, 48, 0.3);
}

.cas-fe-speaker-icon {
    font-size: 18px;
    line-height: 1;
}

/* Text input row with send button */
.cas-fe-text-input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    padding-top: 30px;
    width: 100%;
    box-sizing: border-box;
}

.cas-fe-text-input-row .cas-fe-textarea {
    flex: 4 1 0%;
    margin: 0;
    min-height: 44px;
    min-width: 0;
    box-sizing: border-box;
}

/* Send button - right of textarea */
.cas-fe-button-send {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0%;
    height: auto;
    min-height: 44px;
    padding: 10px;
    background: #0084FF !important;
    color: #fff !important;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 132, 255, 0.2);
}

.cas-fe-button-send:hover {
    background: #0073E6 !important;
    box-shadow: 0 3px 8px rgba(0, 132, 255, 0.3);
    transform: translateY(-1px);
}

.cas-fe-button-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.cas-fe-button-send svg {
    stroke: currentColor;
}

/* Mixed transcript - stretches to fill available space */
#cas-fe-mixed-transcript {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff !important;
    min-height: 0;
}

/* Mixed info - HIDDEN to save space */
.cas-fe-mixed-info {
    display: none !important;
}

.cas-fe-mixed-info .cas-fe-convai-notice {
    margin: 0;
    background: #f0f7ff !important;
    border-left: 4px solid #0084FF;
}

/* Mixed voice status header - fixed at top of container (override general .cas-fe-voice-status) */
.cas-fe-voice-status-header {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    flex: 0 0 auto;
    z-index: 100;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-bottom: 1px solid #dee2e6;
    border-top: none !important;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    max-width: none !important;
}

/* End session button in mixed mode header - subtle pill with red glow */
.cas-fe-voice-status-header .cas-fe-button-end {
    margin-left: auto;
    /* Override .cas-fe-button-close circle styles */
    width: auto !important;
    height: auto !important;
    /* Clean minimal style - no background, border, radius or shadow */
    background: transparent !important;
    color: #c0392b !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 8px !important;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex !important;
    align-items: center;
}

.cas-fe-voice-status-header .cas-fe-button-end:hover {
    background: transparent !important;
    color: #e74c3c !important;
    border: none !important;
    box-shadow: none !important;
}

.cas-fe-voice-status-header .cas-fe-button-end:active {
    background: transparent !important;
    color: #a93226 !important;
}

.cas-fe-voice-status-header .cas-fe-button-end .cas-fe-end-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Hidden state when session ends */
.cas-fe-voice-status-header .cas-fe-button-end[disabled] {
    display: none;
}

#cas-fe-mixed-voice-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #999;
    flex-shrink: 0;
}

#cas-fe-mixed-status-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a !important;
}

/* Voice indicator states for mixed mode */
#cas-fe-mixed-voice-indicator.ready {
    background: #999;
}

#cas-fe-mixed-voice-indicator.listening {
    background: #0084FF;
    animation: pulse 1.5s ease-in-out infinite;
}

#cas-fe-mixed-voice-indicator.speaking {
    background: #0084FF;
    animation: pulse 1s ease-in-out infinite;
}

#cas-fe-mixed-voice-indicator.processing {
    background: #FF9500;
    animation: pulse 0.8s ease-in-out infinite;
}

#cas-fe-mixed-voice-indicator.connecting {
    background: #FF9500;
    animation: pulse 0.8s ease-in-out infinite;
}

#cas-fe-mixed-voice-indicator.error {
    background: #FF3B30;
}

/* Mixed mode responsive adjustments */
@media (max-width: 768px) {
    /* All containers 100% width on mobile/tablet */
    .cas-mixed-wrapper,
    .cas-mixed-wrapper .cas-fe-property-title,
    .cas-mixed-wrapper .cas-frontend-mixed,
    .cas-fe-property-title,
    .cas-frontend-container,
    .cas-fe-session-buttons,
    #cas-fe-mixed-chat-container {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Wrapper fills viewport on mobile */
    .cas-mixed-wrapper {
        height: 100vh !important;
        height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important; /* Center when chat not started */
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* When chat is active, align to top */
    .cas-mixed-wrapper.cas-chat-active {
        justify-content: flex-start !important;
    }

    .cas-mixed-wrapper .cas-fe-property-title {
        flex: 0 0 auto !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }

    /* Add gap between title and button only when chat not started (mobile) */
    .cas-mixed-wrapper:not(.cas-chat-active) .cas-fe-property-title {
        margin-bottom: 20px !important;
    }

    .cas-mixed-wrapper .cas-frontend-mixed {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* When chat not active, don't let container take all space (mobile) */
    .cas-mixed-wrapper:not(.cas-chat-active) .cas-frontend-mixed {
        flex: 0 0 auto !important;
    }

    /* Only apply flex when visible (not display:none) */
    #cas-fe-mixed-chat-container:not([style*="display: none"]):not([style*="display:none"]) {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
        border-radius: 0 !important;
    }

    /* Mic and Speaker buttons - 50% each on same line */
    .cas-fe-voice-controls-inline {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .cas-fe-mic-button,
    .cas-fe-speaker-button {
        flex: 1 1 50% !important;
        width: auto !important;
        height: 44px !important;
        padding: 10px !important;
        border-radius: 10px !important;
    }

    .cas-fe-mic-button svg,
    .cas-fe-speaker-button svg {
        width: 22px !important;
        height: 22px !important;
    }

    /* Text input row - textarea 80% + send button 20% on same line */
    .cas-fe-text-input-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        padding-top: 20px !important;
    }

    .cas-fe-text-input-row .cas-fe-textarea {
        flex: 4 1 0% !important;
        min-width: 0 !important;
    }

    .cas-fe-button-send {
        flex: 1 0 0% !important;
        min-height: 44px !important;
        border-radius: 10px !important;
    }

    .cas-fe-button-send svg {
        width: 26px !important;
        height: 26px !important;
    }

    #cas-fe-mixed-transcript {
        flex: 1 1 auto !important;
        min-height: 100px;
        max-height: none !important;
    }

    .cas-fe-mixed-input-area {
        padding: 10px !important;
        flex: 0 0 auto !important;
    }
}

/* Write-only mode (hide voice button) */
.cas-frontend-write-only #cas-fe-start-voice-chat {
    display: none !important;
}

/* Support Contact Links (Phone & Email) */
.cas-phone-link,
.cas-email-link {
    display: inline-block;
    padding: 10px 20px;
    margin: 5px 5px 5px 0;
    background: #0084FF !important;
    color: white !important;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.95em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 132, 255, 0.3);
}

.cas-phone-link:hover,
.cas-email-link:hover {
    background: #0073E6 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.4);
    color: white !important;
}

.cas-phone-link:active,
.cas-email-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Mobile-specific styles for phone links */
@media (max-width: 768px) {
    .cas-phone-link,
    .cas-email-link {
        display: block;
        text-align: center;
        margin: 10px 0;
        padding: 12px 20px;
        font-size: 1em;
    }

    /* Mobile: Voice status header */
    .cas-fe-voice-status-header {
        padding: 10px 15px;
        border-radius: 0;
        gap: 10px;
    }

    .cas-fe-voice-status-header .cas-fe-button-end {
        padding: 6px 12px !important;
    }

    #cas-fe-mixed-status-text {
        font-size: 13px;
    }
}

/* =============================================================================
   Universal Style Overrides - Force Consistent Design Across All Devices
   ============================================================================= */

/* Force light theme on ALL devices, tablets, mobiles, and override dark mode */
@media (prefers-color-scheme: dark), (prefers-color-scheme: light), screen {
    /* Core containers - force white backgrounds */
    .cas-frontend-container,
    .cas-fe-property-title,
    .cas-fe-property-selector,
    .cas-fe-chat-container,
    #cas-fe-mixed-chat-container,
    .cas-fe-chat-header,
    .cas-fe-transcript,
    #cas-fe-mixed-transcript,
    .cas-fe-input-area,
    .cas-fe-mixed-input-area,
    .cas-fe-mixed-info {
        background: #ffffff !important;
        color: #1a1a1a !important;
    }

    /* Property title */
    .cas-fe-property-title {
        background: #ffffff !important;
        border: 1px solid #e5e5e5 !important;
    }

    .cas-fe-property-title h2 {
        color: #1a1a1a !important;
    }

    /* Chat header */
    .cas-fe-chat-header {
        background: #ffffff !important;
        border-bottom: 1px solid #e5e5e5 !important;
    }

    .cas-fe-chat-header h3 {
        color: #1a1a1a !important;
    }

    /* Message bubbles - user messages in blue */
    .cas-fe-message-user,
    .cas-fe-transcript-user {
        background: #0084FF !important;
        color: #ffffff !important;
    }

    .cas-fe-message-user strong,
    .cas-fe-transcript-user strong {
        color: #ffffff !important;
    }

    /* Message bubbles - assistant messages in gray */
    .cas-fe-message-assistant,
    .cas-fe-transcript-agent {
        background: #f0f0f0 !important;
        color: #1a1a1a !important;
    }

    .cas-fe-message-assistant strong,
    .cas-fe-transcript-agent strong {
        color: #666 !important;
    }

    /* Buttons - primary blue */
    .cas-fe-button-primary {
        background: #0084FF !important;
        color: #ffffff !important;
    }

    .cas-fe-button-primary:hover {
        background: #0073E6 !important;
    }

    /* Microphone button - light blue when active */
    .cas-fe-mic-button {
        background: #0084FF !important;
        color: #ffffff !important;
    }

    .cas-fe-mic-button:hover {
        background: #0073E6 !important;
    }

    .cas-fe-mic-button.cas-fe-mic-muted {
        background: #FF3B30 !important;
        color: #ffffff !important;
    }

    .cas-fe-mic-button.cas-fe-mic-muted:hover {
        background: #E6342A !important;
    }

    /* Speaker button - light blue when active */
    .cas-fe-speaker-button {
        background: #0084FF !important;
        color: #ffffff !important;
    }

    .cas-fe-speaker-button:hover {
        background: #0073E6 !important;
    }

    .cas-fe-speaker-button.cas-fe-speaker-muted {
        background: #FF3B30 !important;
        color: #ffffff !important;
    }

    .cas-fe-speaker-button.cas-fe-speaker-muted:hover {
        background: #E6342A !important;
    }

    /* Clear chat button */
    #cas-fe-clear-chat {
        background: #e0e0e0 !important;
        color: #666 !important;
    }

    #cas-fe-clear-chat:hover {
        background: #d0d0d0 !important;
        color: #333 !important;
    }

    /* Text inputs */
    .cas-fe-textarea {
        background: #f8f8f8 !important;
        color: #1a1a1a !important;
        border: 1px solid #e5e5e5 !important;
    }

    .cas-fe-textarea:focus {
        background: #ffffff !important;
        border-color: #0084FF !important;
    }

    /* Voice status bar */
    .cas-fe-voice-status,
    .cas-fe-voice-status-header {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    }

    #cas-fe-voice-status-text,
    #cas-fe-mixed-status-text {
        color: #1a1a1a !important;
    }

    /* Info notices */
    .cas-fe-convai-notice,
    .cas-fe-mixed-info .cas-fe-convai-notice {
        background: #f0f7ff !important;
        color: #1a1a1a !important;
        border-left-color: #0084FF !important;
    }

    /* Timestamps */
    .cas-fe-message-timestamp {
        color: #999 !important;
    }

    /* Close button */
    .cas-fe-button-close {
        background: #f0f0f0 !important;
        color: #666 !important;
    }

    .cas-fe-button-close:hover {
        background: #e0e0e0 !important;
        color: #333 !important;
    }

    /* Support links */
    .cas-phone-link,
    .cas-email-link {
        background: #0084FF !important;
        color: #ffffff !important;
    }

    .cas-phone-link:hover,
    .cas-email-link:hover {
        background: #0073E6 !important;
        color: #ffffff !important;
    }
}

