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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 2px solid #4a90e2;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
}

.header-left h1 {
    color: #4a90e2;
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 2px;
}

.header-left p {
    color: #a0a0a0;
    font-size: 0.9rem;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.conversation-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.conversation-selector select {
    padding: 8px 15px;
    background: #2a2a40;
    color: #e0e0e0;
    border: 1px solid #4a90e2;
    border-radius: 6px;
    min-width: 200px;
}

.participant-manager {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 25px;
    background: rgba(15, 15, 35, 0.8);
    border-bottom: 1px solid #4a90e2;
}

.participant-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.participant-tag {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
}

.participant-tag.always-active {
    background: linear-gradient(135deg, #27ae60, #229954);
    border: 2px solid #2ecc71;
}

.participant-tag.on-demand {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: 2px solid #f1c40f;
}

.participant-tag .remove-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.participation-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 9px;
    margin-left: 3px;
    transition: all 0.2s ease;
}

.participation-toggle:hover {
    background: rgba(255, 255, 255, 0.4);
}

.voice-controls {
    display: flex;
    gap: 8px;
}

.btn {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn:hover {
    background: linear-gradient(135deg, #357abd, #2968a3);
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.send-controls {
    display: flex;
    gap: 8px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    padding: 12px 18px;
    border-radius: 12px;
    max-width: 85%;
    position: relative;
    animation: messageSlide 0.3s ease-out;
}

.message.own {
    align-self: flex-end;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
}

.message.other {
    align-self: flex-start;
    background: rgba(42, 42, 64, 0.8);
    border: 1px solid #4a90e2;
}

.message.ai-generated {
    border-left: 4px solid #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.message.user-generated {
    border-left: 4px solid #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.8rem;
    opacity: 0.8;
}

.message-content {
    font-size: 0.95rem;
    line-height: 1.5;
}

.message-timestamp {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 5px;
}

.input-area {
    padding: 20px;
    background: rgba(26, 26, 46, 0.95);
    border-top: 1px solid #4a90e2;
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.entity-select {
    padding: 10px;
    background: #2a2a40;
    color: #e0e0e0;
    border: 1px solid #4a90e2;
    border-radius: 6px;
    min-width: 150px;
}

.message-input {
    flex: 1;
    padding: 12px;
    background: #2a2a40;
    color: #e0e0e0;
    border: 1px solid #4a90e2;
    border-radius: 6px;
    resize: vertical;
    min-height: 50px;
    max-height: 120px;
    font-family: inherit;
}

.add-participant {
    display: flex;
    gap: 8px;
    align-items: center;
}

.add-participant input {
    padding: 6px 10px;
    background: #2a2a40;
    color: #e0e0e0;
    border: 1px solid #4a90e2;
    border-radius: 4px;
    width: 150px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-online { background: #27ae60; }
.status-typing { background: #f39c12; }
.status-offline { background: #95a5a6; }

/* Clickable status indicator styling */
.status-indicator[onclick] {
    transition: all 0.2s ease;
    box-shadow: 0 0 0 2px transparent;
}

.status-indicator[onclick]:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
    filter: brightness(1.3);
}

.status-indicator[onclick]:hover::after {
    content: "🔍";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 1000;
}

.status-indicator[onclick]:active {
    transform: scale(1.0);
}

.loading {
    text-align: center;
    color: #4a90e2;
    font-style: italic;
    padding: 20px;
}

.error {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 20px;
}

.success {
    background: rgba(39, 174, 96, 0.2);
    border: 1px solid #27ae60;
    color: #27ae60;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 20px;
}

.command-highlight {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 2px 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

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

.voice-indicator {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(74, 144, 226, 0.9);
    color: white;
    padding: 15px;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: pulse 1s infinite;
}

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

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #1a1a2e;
    border: 2px solid #4a90e2;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80%;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #4a90e2;
    background: rgba(74, 144, 226, 0.1);
}

.modal-header h3 {
    color: #4a90e2;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #4a90e2;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

.config-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(74, 144, 226, 0.05);
    border: 1px solid #4a90e2;
    border-radius: 8px;
}

.config-section h4 {
    color: #4a90e2;
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

.config-item {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(42, 42, 64, 0.6);
    border-radius: 4px;
}

.config-label {
    color: #f39c12;
    font-weight: bold;
}

.config-value {
    color: #e0e0e0;
    margin-left: 10px;
}

/* Command Help Panel Styles */
.config-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.config-content {
    background: #1a1a2e;
    border: 2px solid #4a90e2;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
}

.config-header {
    position: sticky;
    top: 0;
    background: #1a1a2e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 2px solid #4a90e2;
    z-index: 10;
}

.config-header h3 {
    color: #4a90e2;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #4a90e2;
}

.help-section {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
}

.help-section h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.help-section h5 {
    margin: 15px 0 8px 0;
    color: #34495e;
    font-size: 0.95rem;
}

.help-examples {
    margin-top: 15px;
}

.help-category {
    margin-bottom: 20px;
}

.help-example {
    margin: 8px 0;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.user-input {
    display: block;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #2980b9;
    margin-bottom: 4px;
}

.cortex-action {
    display: block;
    font-style: italic;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.advanced-section {
    border-left-color: #e74c3c;
}

.tips-section {
    border-left-color: #f39c12;
}

.samples-section {
    border-left-color: #27ae60;
}

.help-tips {
    margin: 10px 0;
    padding-left: 20px;
}

.help-tips li {
    margin: 8px 0;
    color: #2c3e50;
}

.sample-searches {
    margin-top: 10px;
}

.sample-search {
    margin: 10px 0;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #27ae60;
}

/* Navigation Back Button */
.nav-back {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid #4a90e2;
    color: #4a90e2;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
}

.back-btn:hover {
    background: rgba(74, 144, 226, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    color: #7bb3f2;
}

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

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }

    .participant-manager {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .input-area {
        flex-direction: column;
        gap: 10px;
    }

    .message {
        max-width: 95%;
    }
    
    .nav-back {
        position: relative;
        top: 0;
        left: 0;
        margin-bottom: 10px;
    }
}
