* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0E353F 0%, #174d5b 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-container {
    width: 90%;
    max-width: 800px;
    height: 90vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(14, 53, 63, 0.3);
    border: 2px solid #abd7e1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #0E353F 0%, #0E353F 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 100px;
    width: auto;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.user-info {
    display: flex;
    gap: 10px;
    align-items: center;
}

#username-input {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: rgba(255, 255, 255, 0.9);
}

#join-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

#join-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.welcome-message {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    margin-bottom: 20px;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message.user-message {
    align-items: flex-end;
}

.message.agent-message {
    align-items: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.user-message .message-content {
    background: linear-gradient(135deg, #2D9AB5 0%, #174d5b 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.agent-message .message-content {
    background: white;
    color: #071b20;
    border: 1px solid #abd7e1;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-header {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
    font-weight: 600;
}

.user-message .message-header {
    text-align: right;
}

.agent-message .message-header {
    text-align: left;
}

.message-time {
    font-size: 10px;
    color: #adb5bd;
    margin-top: 4px;
}

.user-message .message-time {
    text-align: right;
}

.agent-message .message-time {
    text-align: left;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #abd7e1;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 70%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

#logout-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

#logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

#message-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #abd7e1;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
    color: #071b20;
}

#message-input:focus {
    border-color: #2D9AB5;
}

#message-input:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

#send-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #2D9AB5 0%, #174d5b 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(45, 154, 181, 0.3);
}

#send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#stop-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #174d5b 0%, #6c757d 100%);
    color: #071b20;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#stop-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(109, 109, 109, 0.3);
}

#stop-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.system-message {
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    margin: 10px 0;
    font-style: italic;
}

/* Markdown Styles */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 8px 0 4px 0;
    font-weight: 600;
    line-height: 1.3;
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.2em; }
.message-content h4 { font-size: 1.1em; }
.message-content h5 { font-size: 1.0em; }
.message-content h6 { font-size: 0.9em; }

.message-content p {
    margin: 4px 0;
    line-height: 1.4;
}

.message-content ul,
.message-content ol {
    margin: 4px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 2px 0;
    line-height: 1.4;
}

.message-content blockquote {
    margin: 8px 0;
    padding: 8px 12px;
    border-left: 4px solid #2D9AB5;
    background: rgba(45, 154, 181, 0.1);
    border-radius: 4px;
    font-style: italic;
}

.message-content pre {
    margin: 8px 0;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.message-content code {
    background: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #e9ecef;
}

.message-content pre code {
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content u {
    text-decoration: underline;
}

.message-content s,
.message-content del {
    text-decoration: line-through;
}

.message-content mark {
    background: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}

.message-content table {
    margin: 8px 0;
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9em;
}

.message-content th,
.message-content td {
    padding: 6px 8px;
    border: 1px solid #e9ecef;
    text-align: left;
}

.message-content th {
    background: #f8f9fa;
    font-weight: 600;
}

.message-content a {
    color: #2D9AB5;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
    .chat-container {
        width: 95%;
        height: 95vh;
    }
    
    .chat-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .header-left {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo {
        height: 35px;
    }
    
    .chat-header h1 {
        font-size: 1.3rem;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message-content pre {
        font-size: 0.8em;
        padding: 8px;
    }
    
    .message-content table {
        font-size: 0.8em;
    }
}

/* Vertical layout for input fields */
.input-vertical-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 30%; /* takes up 30% of chat-input-container */
    justify-content: center;
}

/* Make Start button match other buttons */
#start-btn.primary-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #2D9AB5 0%, #174d5b 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#start-btn.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(45, 154, 181, 0.3);
}

/* Connection status in header */
#connection-status {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    margin-left: 15px;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

.status-connected {
    background-color: #4CAF50;
}

.status-queued {
    background-color: #FF9800;
}

.status-connecting {
    background-color: #2196F3;
}

.status-disconnected {
    background-color: #F44336;
}

/* Queue status card */
.queue-status {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    margin: 15px 0;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
}

.queue-position {
    font-size: 3em;
    font-weight: bold;
    margin: 15px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.queue-details {
    font-size: 0.95em;
    opacity: 0.9;
    line-height: 1.4;
}

/* Pulse animation for queue status */
.pulse {
    animation: queuePulse 3s infinite;
}

@keyframes queuePulse {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.02);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

/* Enhanced system messages */
.system-message {
    background: rgba(0,0,0,0.05);
    border-left: 4px solid #2196F3;
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #666;
}

/* Input states */
.chat-input-container input:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.chat-input-container button:disabled {
    background-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

/* Responsive queue status */
@media (max-width: 768px) {
    .queue-status {
        margin: 10px 5px;
        padding: 15px;
    }
    
    .queue-position {
        font-size: 2.5em;
        margin: 10px 0;
    }
    
    #connection-status {
        font-size: 0.8em;
        margin-left: 10px;
    }
}

/* Simple popup styling */
#inactivity-popup {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
#inactivity-popup .popup-content {
  background: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  max-width: 300px;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.3);
}
#inactivity-popup button {
  margin-top: 15px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #007bff;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

/*
.embedded .chat-header {
    display: none;
}*/

.embedded body {
    margin: 0;
    background: linear-gradient(135deg, #0E353F 0%, #0E353F 100%);
}

.embedded .chat-container {
    height: 100vh;
}