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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1800px;
    margin: 0 auto;
}

/* Header */
.header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.header-content h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.logout-btn {
    padding: 8px 16px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #e0e0e0;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    border-bottom: 1px solid #e0e0e0;
    padding: 20px;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    font-size: 1rem;
    color: #333;
    font-weight: 600;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    color: #667eea;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.items-list {
    max-height: 300px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: #999;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.empty-state small {
    font-size: 0.75rem;
    color: #bbb;
    font-style: italic;
}

/* Task/Event/Entity Items */
.task-item,
.event-item,
.entity-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f9f9f9;
    border-left: 3px solid #667eea;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
}

.task-item:hover,
.event-item:hover,
.entity-item:hover {
    background: #f0f0f0;
    transform: translateX(3px);
}

.task-item.completed {
    border-left-color: #4caf50;
    opacity: 0.7;
}

.task-item.completed .item-title {
    text-decoration: line-through;
}

.event-item {
    border-left-color: #ff9800;
}

.entity-item {
    border-left-color: #9c27b0;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.item-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    flex: 1;
}

.item-status,
.item-type {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    font-weight: 500;
    text-transform: uppercase;
}

.item-meta {
    font-size: 0.75rem;
    color: #999;
    margin-top: 5px;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
}

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

.welcome-message {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 600px;
    margin: 0 auto;
}

.welcome-message h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.welcome-message p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.welcome-message ul {
    margin-left: 20px;
    margin-bottom: 20px;
    color: #666;
}

.welcome-message li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.hint {
    background: rgba(102, 126, 234, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    margin-top: 20px;
}

.hint em {
    color: #667eea;
    font-weight: 500;
}

/* Messages */
.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    max-width: 70%;
    animation: slideIn 0.3s ease-out;
}

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

.message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.message.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.message-bubble {
    padding: 15px 20px;
    border-radius: 20px;
    word-wrap: break-word;
    line-height: 1.6;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.assistant .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.message-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 5px;
    padding: 0 5px;
}

/* Actions Taken */
.actions-taken {
    margin-top: 10px;
    padding: 12px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 10px;
    border-left: 3px solid #4caf50;
}

.actions-taken strong {
    color: #4caf50;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 8px;
}

.action-item {
    padding: 6px 8px;
    margin: 3px 0;
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
}

.action-icon {
    margin-right: 5px;
}

/* Query Results (inline in chat) */
.query-results {
    margin-top: 10px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    border-left: 3px solid #667eea;
}

.query-results strong {
    color: #667eea;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 8px;
}

.results-section {
    margin-top: 8px;
}

.results-header {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 5px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.result-item {
    padding: 6px 8px;
    margin: 3px 0;
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-icon {
    flex-shrink: 0;
}

.result-status,
.result-date,
.result-type {
    margin-left: auto;
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.result-status {
    text-transform: capitalize;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 12px;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: white;
    border-radius: 20px;
    max-width: 150px;
}

.loading-dots {
    display: flex;
    gap: 5px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Input Container */
.input-container {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

#messageInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    resize: none;
    font-family: inherit;
    transition: border-color 0.3s;
    max-height: 120px;
}

#messageInput:focus {
    outline: none;
    border-color: #667eea;
}

.send-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Footer */
.footer {
    padding: 15px 30px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 2s infinite;
}

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

.status-indicator.loading {
    background: #ff9800;
}

.status-indicator.error {
    background: #f44336;
}

.status-text {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.stats {
    font-size: 0.85rem;
    color: #999;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.items-list::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.items-list::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.items-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.items-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .message {
        max-width: 85%;
    }
}
