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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.app-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.user-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: white;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.app-header h1 {
    font-size: 24px;
    font-weight: 600;
}

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

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

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

.status-text {
    font-size: 14px;
    font-weight: 500;
}

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

.chatkit-component {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
}

/* ChatKit theming and customization */
openai-chatkit {
    --chatkit-primary-color: #667eea;
    --chatkit-background-color: #ffffff;
    --chatkit-text-color: #333333;
    --chatkit-border-color: #e2e8f0;
    --chatkit-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Custom styling for ChatKit messages */
openai-chatkit::part(message) {
    border-radius: 18px;
    margin: 8px 0;
}

openai-chatkit::part(user-message) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

openai-chatkit::part(assistant-message) {
    background: #f1f5f9;
    color: #333333;
}

/* Input styling */
openai-chatkit::part(input) {
    border-radius: 25px;
    border: 2px solid #e2e8f0;
    padding: 12px 16px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

openai-chatkit::part(input):focus {
    border-color: #667eea;
    outline: none;
}

/* Button styling */
openai-chatkit::part(send-button) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease;
}

openai-chatkit::part(send-button):hover {
    transform: scale(1.05);
}

openai-chatkit::part(send-button):active {
    transform: scale(0.95);
}

/* Scrollbar styling for ChatKit */
openai-chatkit::part(messages-container) {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

openai-chatkit::part(messages-container)::-webkit-scrollbar {
    width: 6px;
}

openai-chatkit::part(messages-container)::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

openai-chatkit::part(messages-container)::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

openai-chatkit::part(messages-container)::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Error message styling */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ff4444;
    color: white;
    padding: 20px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Responsive design */
@media (max-width: 900px) {
    .app-container {
        height: 100vh;
        border-radius: 0;
        max-width: none;
        margin: 0;
    }
    
    .app-header {
        padding: 16px;
    }
    
    .app-header h1 {
        font-size: 20px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0;
    }
    
    .app-container {
        border-radius: 0;
        box-shadow: none;
    }
    
    .header-right {
        gap: 12px;
    }
    
    .user-info {
        padding: 6px 10px;
    }
    
    .user-name {
        font-size: 12px;
    }
    
    .logout-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}