/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    margin-right: 0.5rem;
}

.anycoder-badge {
    font-size: 0.9rem;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
}

.anycoder-badge:hover {
    color: #667eea;
    transform: translateY(-1px);
}

.device-selector {
    display: flex;
    align-items: center;
}

.device-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#device-toggle:checked + .toggle-switch {
    background: #667eea;
}

#device-toggle:checked + .toggle-switch::after {
    transform: translateX(20px);
}

.toggle-labels {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
    gap: -2px;
}

.toggle-labels span:first-child {
    order: 2;
}

.toggle-labels span:last-child {
    order: 1;
    opacity: 0.6;
}

#device-toggle:checked + .toggle-switch ~ .toggle-labels span:first-child {
    order: 1;
    opacity: 1;
}

#device-toggle:checked + .toggle-switch ~ .toggle-labels span:last-child {
    order: 2;
    opacity: 0.6;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-height: 70vh;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.message-wrapper {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease-out;
}

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

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.user-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.assistant-avatar {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.message-content {
    flex: 1;
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    line-height: 1.6;
    font-size: 0.98rem;
}

.user-message-wrapper {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 20px 20px 5px 20px;
}

.assistant-message .message-content {
    border-radius: 20px 20px 20px 5px;
}

.welcome-message {
    margin-top: 2rem;
}

.input-container {
    padding: 0 2rem 2rem;
    background: rgba(255, 255, 255, 0.7);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    background: white;
    border-radius: 25px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.input-group {
    flex: 1;
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    max-height: 120px;
    background: transparent;
}

#messageInput::placeholder {
    color: #999;
}

.send-button {
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.status-bar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    padding: 1rem 2rem;
    border-radius: 20px;
    margin-top: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
}

.status-dots {
    font-size: 1.2rem;
    line-height: 1;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .chat-container {
        padding: 1.5rem 1rem;
        max-height: 60vh;
    }
    
    .input-container {
        padding: 0 1rem 1.5rem;
    }
    
    .message-wrapper {
        gap: 0.75rem;
    }
    
    .avatar {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .message-content {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .input-wrapper {
        padding: 0.75rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .status-bar,
    .header,
    .main-content {
        border-radius: 16px;
        margin: 0.5rem;
    }
    
    .chat-container {
        max-height: 50vh;
    }
}