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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 400;
    height: 100vh;
    background-color: #f8fafc;
    color: #1e293b;
}

.waiting-message {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    justify-content: center;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: #64748b;
    z-index: 1000;
}

.waiting-message.active {
    display: flex;
}

.chat-container.waiting {
    display: none;
}

.chat-container {
    display: flex;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #ffffff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.chat-container.single-conversation .sidebar {
    display: none;
}

.chat-container.single-conversation .main-chat {
    width: 100%;
    margin-left: 0;
}

.chat-container.phone-only .conversation-details {
    display: none;
}

.chat-container.phone-only .chat-header h2 {
    margin-bottom: 0;
}

.sidebar {
    width: 320px;
    background-color: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    padding: 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
}

.conversation-item.active {
    background-color: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.conversation-item h3 {
    margin-bottom: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

.conversation-item p {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #64748b;
    margin-bottom: 8px;
    line-height: 1.4;
}

.conversation-item .timestamp-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 12px;
    color: #94a3b8;
}

.conversation-item .timestamp-container .date {
    font-weight: 500;
}

.conversation-item .timestamp-container .time {
    font-weight: 400;
    color: #94a3b8;
}

.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

.chat-header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #ffffff;
}

.chat-header h2 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
    line-height: 1.4;
}

.conversation-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 16px;
    background-color: #f8fafc;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 13px;
}

.conversation-details h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conversation-details p {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 400;
    color: #1e293b;
    margin-bottom: 4px;
    line-height: 1.4;
}

.client-info, .booking-info, .guest-info {
    padding: 12px;
    background-color: #ffffff;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.booking-info {
    text-align: center;
}

.client-info p, .booking-info p, .guest-info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: #ffffff;
}

.message {
    margin-bottom: 16px;
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.message.sent {
    margin-left: auto;
    margin-right: 0;
    align-items: flex-end;
    text-align: right;
}

.message.received {
    align-items: flex-start;
}

.message-content {
    padding: 16px 20px;
    text-align: left;
    border-radius: 16px;
    max-width: 100%;
    word-break: break-word;
    position: relative;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 15px;
    font-weight: 400;
}

.message.sent .message-content {
    background-color: #E90A4D;
    color: #ffffff;
}

.message.received .message-content {
    background-color: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.message-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 12px;
    display: block;
}

.message.sent .message-image {
    margin-left: auto;
}

.message-sender {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 4px;
}

.message-timestamp {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    margin-top: 6px;
    width: 100%;
}

.control-status {
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}



.take-control-button, .release-control-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.take-control-button {
    background: linear-gradient(135deg, #E90A4D, #c8094a);
    color: #ffffff;
}

.take-control-button:hover {
    background: linear-gradient(135deg, #c8094a, #b00842);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 10, 77, 0.25);
}

.take-control-button:active {
    transform: translateY(0);
}

.release-control-button {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
}

.release-control-button:hover {
    background: linear-gradient(135deg, #047857, #065f46);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.release-control-button:active {
    transform: translateY(0);
}

.message-input-container {
    padding: 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #ffffff;
}

.message-mode-selector {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.message-mode-selector::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 2px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #E90A4D, #c8094a);
    border-radius: 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    box-shadow: 0 2px 8px rgba(233, 10, 77, 0.2);
}

.message-mode-selector.receptionist-active::before {
    transform: translateX(100%);
}

.mode-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    position: relative;
    z-index: 2;
    justify-content: center;
    min-height: 44px;
}

.mode-toggle .mode-icon {
    width: 18px;
    height: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-width: 2.5;
}

.mode-toggle .mode-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-toggle:hover:not(.active) {
    color: #475569;
    transform: translateY(-1px);
}

.mode-toggle:hover:not(.active) .mode-icon {
    transform: scale(1.05);
}

.mode-toggle.active {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mode-toggle.active .mode-icon {
    stroke: #ffffff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.mode-toggle:active {
    transform: scale(0.98);
}

.mode-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(233, 10, 77, 0.2);
}

.mode-toggle:focus:not(.active) {
    background: rgba(233, 10, 77, 0.05);
}

/* Subtle animation for mode switching */
@keyframes modeSwitch {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

.mode-toggle.switching {
    animation: modeSwitch 0.2s ease-out;
}

.message-input-send-container {
    display: flex;
    gap: 12px;
}

#message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    font-weight: 400;
    outline: none;
    transition: all 0.2s ease;
    background-color: #ffffff;
    color: #1e293b;
}

#message-input.receptionist-mode {
    border-color: #059669;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.1);
}

#message-input:focus {
    border-color: #E90A4D;
    box-shadow: 0 0 0 2px rgba(233, 10, 77, 0.1);
}

#send-button {
    padding: 12px 24px;
    background-color: #E90A4D;
    color: #ffffff;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(233, 10, 77, 0.2);
}

#send-button:hover {
    background-color: #c8094a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(233, 10, 77, 0.3);
}

#send-button:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.date-separator {
    text-align: center;
    margin: 16px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.close-lightbox {
    position: absolute;
    top: -40px;
    right: -40px;
    background: none;
    border: none;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 36px;
    font-weight: 400;
    cursor: pointer;
    padding: 10px;
    line-height: 24px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close-lightbox:hover {
    opacity: 1;
}

.back-button {
    display: none;
    background: none;
    border: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 24px;
    font-weight: 400;
    cursor: pointer;
    padding: 10px;
    margin-right: 10px;
    color: #E90A4D;
}

.back-button:hover {
    color: #c8094a;
}

/* Status Bar */
.chat-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 12px;
    min-height: 40px;
}

/* Conversation Timer */
.conversation-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

.conversation-timer .timer-icon {
    width: 14px;
    height: 14px;
    color: #64748b;
    animation: tickTock 2s infinite ease-in-out;
}

.timer-text {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #475569;
    min-width: 35px;
}

@keyframes tickTock {
    0%, 50%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(6deg);
    }
    75% {
        transform: rotate(-6deg);
    }
}

/* Timer visual states for 24h response window */
.timer-text.warning {
    color: #f59e0b !important;
    font-weight: bold !important;
}

.timer-text.expired {
    color: #dc2626 !important;
    font-weight: bold !important;
    animation: pulse 2s infinite;
}

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

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #64748b;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-dot.online::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 1px solid #10b981;
    animation: ping 2s infinite;
}

@keyframes ping {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Enhanced Input Container */
.message-input-send-container {
    position: relative;
}

.input-counter {
    position: absolute;
    bottom: 8px;
    right: 80px;
    font-size: 10px;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 10;
}

.input-counter.warning {
    color: #f59e0b;
}

.input-counter.danger {
    color: #ef4444;
}

/* Enhanced Send Button */
#send-button.sending {
    pointer-events: none;
    position: relative;
    overflow: hidden;
}

#send-button.sending::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Message Enhancement */
.message.ai-generated .message-content {
    position: relative;
}

.message.ai-generated::before {
    content: '🤖';
    position: absolute;
    top: -8px;
    left: -8px;
    width: 20px;
    height: 20px;
    background: #f8fafc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid #e2e8f0;
}

/* Receptionist Loading States */
.receptionist-loading {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin: 0 20px 16px 20px;
    animation: slideInUp 0.3s ease-out;
}

.receptionist-loading.success {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border-color: #bbf7d0;
}

.receptionist-loading.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fef5f5 100%);
    border-color: #fecaca;
}

.loading-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #E90A4D;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.success-icon {
    width: 24px;
    height: 24px;
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d1fae5;
    border-radius: 50%;
    animation: scaleIn 0.4s ease-out;
}

.error-icon {
    width: 24px;
    height: 24px;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    border-radius: 50%;
    animation: scaleIn 0.4s ease-out;
}

.loading-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.loading-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.receptionist-loading.success .loading-title {
    color: #059669;
}

.receptionist-loading.error .loading-title {
    color: #dc2626;
}

.loading-subtitle {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

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

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Pulse animation for loading state */
.receptionist-loading:not(.success):not(.error) .loading-text {
    animation: pulse 2s infinite;
}

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

@media (max-width: 768px) {
    body {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    /* Force main chat to be visible when in single conversation mode */
    .chat-container.single-conversation .main-chat {
        transform: translateX(0) !important;
        visibility: visible !important;
        z-index: 2;
    }

    /* Hide back button in single conversation mode */
    .chat-container.single-conversation .back-button {
        display: none !important;
    }

    .chat-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        margin: 0;
        box-shadow: none;
        overflow: hidden;
        background: #ffffff;
        border-radius: 0;
    }

    .sidebar,
    .main-chat {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        visibility: visible;
        transition: transform 0.3s ease-in-out, visibility 0s linear;
        will-change: transform;
        background: #ffffff;
        backface-visibility: hidden;
    }

    .sidebar {
        transform: translateX(0);
        z-index: 2;
        border-right: none;
    }

    .main-chat {
        transform: translateX(100%);
        z-index: 1;
        visibility: hidden;
        transition-delay: 0s, 0.3s;
    }

    .chat-container.show-chat .sidebar {
        transform: translateX(-100%);
        visibility: hidden;
        transition-delay: 0s, 0.3s;
    }

    .chat-container.show-chat .main-chat {
        transform: translateX(0);
        visibility: visible;
        z-index: 2;
        transition-delay: 0s, 0s;
    }

    .back-button {
        display: none;
        font-size: 20px;
        font-weight: 400;
        padding: 8px;
        margin-right: 8px;
        color: #E90A4D;
        background: none;
        border: none;
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.2s ease-in-out;
    }

    .chat-container.show-chat .back-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        opacity: 1;
    }

    .conversation-details {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 12px;
    }

    .chat-header {
        padding: 0;
        position: relative;
        z-index: 3;
        background: #ffffff;
    }

    .chat-header > div:first-child {
        display: flex;
        align-items: center;
        padding: 16px;
        border-bottom: 1px solid #e2e8f0;
    }

    .chat-header h2 {
        margin: 0;
        flex: 1;
        font-size: 18px;
        font-weight: 600;
    }

    .conversation-details {
        padding: 12px 16px;
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0;
    }

    .messages-container {
        padding: 16px;
        -webkit-overflow-scrolling: touch;
        position: relative;
        z-index: 1;
    }

    .message-input-container {
        padding: 16px;
        position: relative;
        z-index: 3;
        background: #ffffff;
        gap: 12px;
    }

    .message-mode-selector {
        padding: 3px;
        gap: 3px;
        border-radius: 10px;
    }

    .message-mode-selector::before {
        top: 3px;
        left: 3px;
        width: calc(50% - 1.5px);
        height: calc(100% - 6px);
        border-radius: 7px;
    }

    .mode-toggle {
        padding: 10px 16px;
        font-size: 12px;
        font-weight: 500;
        gap: 6px;
        min-height: 40px;
        border-radius: 7px;
    }

    .mode-toggle .mode-icon {
        width: 16px;
        height: 16px;
        stroke-width: 2.5;
    }

    .mode-toggle .mode-label {
        font-weight: 600;
    }

    .control-status {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
        position: relative;
        z-index: 3;
        background: #ffffff;
        border-bottom: 1px solid #e2e8f0;
    }



    .take-control-button, .release-control-button {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
        font-weight: 500;
        min-width: auto;
    }

    .chat-status-bar {
        padding: 6px 16px;
        font-size: 11px;
        min-height: 36px;
    }
    
    .input-counter {
        right: 70px;
        bottom: 6px;
        font-size: 9px;
    }

    .receptionist-loading {
        margin: 0 16px 12px 16px;
        padding: 12px 16px;
    }

    .loading-content {
        gap: 10px;
    }

    .loading-spinner,
    .success-icon,
    .error-icon {
        width: 20px;
        height: 20px;
    }

    .loading-title {
        font-size: 13px;
    }

    .loading-subtitle {
        font-size: 11px;
    }

    .conversation-timer {
        font-size: 10px;
    }

    .conversation-timer .timer-icon {
        width: 12px;
        height: 12px;
    }

    .timer-text {
        font-size: 10px;
        min-width: 30px;
    }

    .close-lightbox {
        top: -50px;
        right: 0;
    }
}

/* Message content formatting - preserves line breaks but handles spacing properly */
.message-content {
    word-wrap: break-word;
    line-height: 1.5;
    text-align: left;
    overflow-wrap: break-word;
}

/* Ensure proper text rendering */
.message-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

/* Style paragraph tags within messages */
.message-content p,
.message-text p {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

/* Message Templates Container */
.message-templates-container {
    display: none; /* Hidden by default, shown when templates are loaded */
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-templates-container.show {
    opacity: 1;
    transform: translateY(0);
}

.templates-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.templates-icon {
    width: 14px;
    height: 14px;
    color: #64748b;
}

.message-templates-list {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 14px;
    color: #374151;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.message-templates-list:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.message-templates-list:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.message-templates-list:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-templates-list option {
    padding: 12px 16px;
    color: #374151;
    background: white;
    font-weight: 500;
    line-height: 1.4;
}

.message-templates-list option:first-child {
    color: #9ca3af;
    font-style: italic;
    font-weight: 400;
    background: #f9fafb;
}

/* Selected template styling */
.message-templates-list:not([value=""]) {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.message-templates-list:not([value=""]):focus {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1), 0 4px 6px rgba(0, 0, 0, 0.1);
}

.message-templates-list option:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* Loading state for templates */
.templates-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #64748b;
    font-size: 14px;
    gap: 8px;
}

.templates-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Template selection animation */
.message-templates-list.selecting {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.message-templates-list.selecting::after {
    content: "✓";
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: #10b981;
    font-weight: bold;
    font-size: 16px;
    opacity: 0;
    animation: checkmark 0.3s ease forwards;
}

@keyframes checkmark {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .message-templates-container {
        padding: 10px 12px;
    }
    
    .templates-label {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .message-templates-list {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 14px;
        padding-right: 38px;
    }
    
    .message-templates-list option {
        padding: 10px 14px;
    }
    
    .templates-loading {
        padding: 12px;
        font-size: 13px;
    }
}

/* Disabled input state for timeout */
#message-input:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

#message-input:disabled::placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* Disabled send button state */
#send-button:disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Visual indicator for timeout state */
.message-input-container.timeout {
    position: relative;
}

.message-input-container.timeout::before {
    content: "⏰ Tiempo agotado - Solo plantillas disponibles";
    position: absolute;
    top: -25px;
    left: 0;
    font-size: 12px;
    color: #dc2626;
    font-weight: 500;
    background: #fef2f2;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #fecaca;
    white-space: nowrap;
}


