* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #111b21;
    color: #e9edef;
    height: 100vh;
    overflow: hidden;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #00a884 0%, #128c7e 100%);
    padding: 20px;
}

.login-box {
    background: #2a3942;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #00a884;
    margin-bottom: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #3b4a54;
    border-radius: 5px;
    background: #111b21;
    color: #e9edef;
    font-size: 16px;
}

.input-group input:focus {
    outline: none;
    border-color: #00a884;
}

button {
    width: 100%;
    padding: 12px;
    background: #00a884;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background: #128c7e;
}

.error-message {
    color: #f87171;
    text-align: center;
    margin-top: 15px;
    display: none;
}

.chat-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 400px;
    background: #2a3942;
    border-right: 1px solid #3b4a54;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    background: #202c33;
    border-bottom: 1px solid #3b4a54;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-btn {
    background: #dc2626;
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
}

.logout-btn:hover {
    background: #b91c1c;
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
}

.session-item {
    padding: 16px 20px;
    border-bottom: 1px solid #3b4a54;
    cursor: pointer;
    transition: background-color 0.2s;
}

.session-item:hover {
    background: #202c33;
}

.session-item.active {
    background: #2a3942;
    border-left: 4px solid #00a884;
}

.session-number {
    font-weight: 600;
    margin-bottom: 4px;
}

.session-info {
    font-size: 14px;
    color: #8696a0;
}

.session-item.recent-activity {
    background: #1a4a44;
    border-left: 3px solid #00a884;
}

.session-item.recent-activity:hover {
    background: #1e5049;
}

.activity-indicator {
    color: #00a884;
    font-size: 16px;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0b141a;
    min-width: 0;
}

.chat-header {
    padding: 16px 20px;
    background: #202c33;
    border-bottom: 1px solid #3b4a54;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-header h3 {
    font-size: 18px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-controls {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.bot-status-container {
    margin-left: 20px;
}

.bot-status-label {
    display: flex;
    align-items: center;
    color: #e9edef;
    font-size: 14px;
    gap: 10px;
}

.label-text {
    font-weight: 500;
    color: #8696a0;
}

.bot-status-select {
    background: #2a3942;
    color: #e9edef;
    border: 1px solid #3b4a54;
    border-radius: 5px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.bot-status-select:focus {
    border-color: #00a884;
}

.bot-status-select option {
    background: #2a3942;
    color: #e9edef;
}

.message-input-area {
    padding: 16px 20px;
    background: #202c33;
    border-top: 1px solid #3b4a54;
    display: none;
}

.message-input-area.active {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid #3b4a54;
    border-radius: 22px;
    background: #2a3942;
    color: #e9edef;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    outline: none;
}

.message-input:focus {
    border-color: #00a884;
}

.send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #00a884;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.send-button:hover {
    background: #128c7e;
}

.send-button:disabled {
    background: #3b4a54;
    cursor: not-allowed;
}

.error-toast, .success-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 1000;
    display: none;
    animation: slideIn 0.3s ease;
    max-width: calc(100vw - 40px);
    word-wrap: break-word;
}

.error-toast {
    background: #dc2626;
    color: white;
}

.success-toast {
    background: #00a884;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="pattern" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="%23ffffff" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23pattern)"/></svg>');
    display: flex;
    flex-direction: column;
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #8696a0;
    font-size: 14px;
    display: none;
}

.no-chat-selected {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #8696a0;
    font-size: 18px;
    text-align: center;
    padding: 20px;
}

.message {
    margin-bottom: 16px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.agent {
    margin-left: auto;
    background: #005c4b;
    padding: 12px 16px;
    border-radius: 18px 18px 6px 18px;
    position: relative;
}

.message.user {
    margin-right: auto;
    background: #202c33;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 6px;
    position: relative;
}

.message-content {
    margin-bottom: 4px;
    line-height: 1.4;
}

.message-time {
    font-size: 12px;
    color: #8696a0;
    text-align: right;
}

.show-sidebar-btn {
    display: none;
    background: #00a884;
    border: none;
    color: white;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 10px;
    width: auto;
}

.show-sidebar-btn:hover {
    background: #128c7e;
}

.mobile-header-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.mobile-header-left h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #2a3942;
}

::-webkit-scrollbar-thumb {
    background: #3b4a54;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a5862;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .chat-container {
        position: relative;
    }
    
    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 350px;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .chat-area {
        width: 100%;
        height: 100vh;
    }

    .show-sidebar-btn {
        display: block;
    }
    
    .chat-header {
        padding: 12px 15px;
        position: relative;
    }
    
    .chat-header h3 {
        font-size: 16px;
    }
    
    .bot-status-container {
        margin-left: 10px;
    }
    
    .bot-status-label {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .label-text {
        font-size: 12px;
    }
    
    .bot-status-select {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .messages-container {
        padding: 15px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .message-input-area {
        padding: 12px 15px;
    }
    
    .message-input {
        font-size: 16px;
        padding: 10px 14px;
    }
    
    .send-button {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .login-box {
        padding: 30px 20px;
        margin: 0 10px;
    }
    
    .session-item {
        padding: 16px 15px;
    }
    
    .session-number {
        font-size: 14px;
    }
    
    .session-info {
        font-size: 12px;
    }
    
    .error-toast, .success-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
    
    .chat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 12px;
    }
    
    .chat-controls {
        width: 100%;
        justify-content: flex-start;
    }
    
    .bot-status-container {
        margin-left: 0;
    }
    
    .messages-container {
        padding: 10px;
    }
    
    .message {
        max-width: 90%;
        padding: 10px 12px;
    }
    
    .message-input-area {
        padding: 10px;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-header h2 {
        font-size: 18px;
    }
    
    .logout-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Touch interactions for mobile */
@media (hover: none) and (pointer: coarse) {
    .session-item:hover {
        background: initial;
    }
    
    .session-item:active {
        background: #202c33;
    }
    
    button:hover {
        background: initial;
    }
    
    .send-button:active {
        background: #128c7e;
    }
    
    .logout-btn:active {
        background: #b91c1c;
    }
}