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

:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #6d28d9;
    --secondary: #06b6d4;
    --accent: #f472b6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #fafafa;
    --bg-card: #ffffff;
    --bg-input: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --sidebar-width: 280px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #fdf4ff 50%, #f0fdfa 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow: hidden;
}

/* Floating shapes background */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--secondary), var(--primary-light));
    bottom: -50px;
    left: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    top: 50%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Main Container */
.container {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100vh;
    max-width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    margin-left: calc(var(--sidebar-width) * -1);
}

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

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.new-chat-btn:active {
    transform: scale(0.98);
}

.session-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-list::-webkit-scrollbar {
    width: 4px;
}

.session-list::-webkit-scrollbar-track {
    background: transparent;
}

.session-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.session-item {
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.session-item:hover {
    background: var(--border);
}

.session-item.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid var(--primary-light);
}

.session-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-title-input {
    width: 100%;
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    outline: none;
    background: white;
}

.session-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.session-actions {
    display: none;
    gap: 4px;
}

.session-item:hover .session-actions {
    display: flex;
}

.session-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.session-action-btn:hover {
    background: var(--border);
}

.session-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Main Chat Area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    min-width: 0;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 20px 28px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 20px;
    align-items: center;
    justify-content: center;
}

.avatar-ring {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    border-radius: 50%;
    padding: 3px;
    position: relative;
    flex-shrink: 0;
}

.avatar-ring::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    animation: spin 3s linear infinite;
    z-index: -1;
    opacity: 0.3;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.avatar {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.header-content {
    flex: 1;
    min-width: 0;
}

.header-title {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--success);
    flex-shrink: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

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

/* Chat Container */
.chat-wrapper {
    flex: 1;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-track {
    background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Message */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    animation: slideIn 0.3s ease-out;
}

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

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

.message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.message.ai .message-avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--secondary), var(--accent));
}

.message-content {
    max-width: 75%;
    flex: 1;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.ai .message-bubble {
    background: white;
    border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
    text-align: left;
    padding-left: 4px;
}

.message.user .message-time {
    display: none;
}

/* Markdown Styles */
.markdown {
    color: inherit;
}

.markdown p {
    margin: 0 0 8px 0;
}

.markdown p:last-child {
    margin-bottom: 0;
}

.markdown h1,
.markdown h2,
.markdown h3 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.markdown h1 { font-size: 20px; }
.markdown h2 { font-size: 18px; }
.markdown h3 { font-size: 16px; }

.markdown ul,
.markdown ol {
    margin: 8px 0;
    padding-left: 24px;
}

.markdown li {
    margin: 4px 0;
}

.markdown code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
}

.message.user .markdown code {
    background: rgba(255, 255, 255, 0.2);
}

.markdown pre {
    background: rgba(0, 0, 0, 0.04);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message.user .markdown pre {
    background: rgba(255, 255, 255, 0.15);
}

.markdown pre code {
    background: none;
    padding: 0;
}

.markdown blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown strong {
    font-weight: 600;
}

.markdown em {
    font-style: italic;
}

.markdown a {
    color: var(--primary);
    text-decoration: none;
}

.markdown a:hover {
    text-decoration: underline;
}

.message.user .markdown a {
    color: rgba(255, 255, 255, 0.9);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 24px;
    text-align: center;
    overflow-y: auto;
    min-height: 0;
}

.welcome-avatar {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    animation: bounce-gentle 2s ease-in-out infinite;
}

@keyframes bounce-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.welcome-screen h2 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.welcome-screen p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    max-width: 580px;
    width: 100%;
}

.suggestion-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.suggestion-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.suggestion-card:active {
    transform: scale(0.98);
}

.suggestion-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(6, 182, 212, 0.1));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.suggestion-card-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.suggestion-card-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* Input Area */
.input-area {
    padding: 20px 24px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.5);
}

.quick-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.chip {
    padding: 7px 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.chip:active {
    transform: scale(0.95);
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.input-field {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    resize: none;
    min-height: 52px;
    max-height: 150px;
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    background: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.input-field::placeholder {
    color: var(--text-tertiary);
}

.send-button {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.send-button:active:not(:disabled) {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-button.sending {
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        margin-left: 0;
    }

    .menu-btn {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-area {
        padding: 12px;
    }

    .header {
        padding: 14px 16px;
        margin-bottom: 12px;
    }

    .avatar-ring {
        width: 46px;
        height: 46px;
    }

    .avatar {
        font-size: 22px;
    }

    .header-title {
        font-size: 18px;
    }

    .header-subtitle {
        font-size: 13px;
    }

    .status-badge {
        padding: 6px 10px;
        font-size: 12px;
    }

    .user-info {
        padding: 6px 12px;
        gap: 8px;
    }

    .user-avatar-small {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .user-name {
        font-size: 13px;
        max-width: 60px;
    }

    .logout-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .chat-wrapper {
        border-radius: var(--radius-lg);
    }

    .messages-area {
        padding: 16px;
    }

    .message {
        margin-bottom: 20px;
    }

    .message-avatar {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

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

    .message-bubble {
        padding: 12px 14px;
        font-size: 14px;
    }

    .markdown h1 { font-size: 18px; }
    .markdown h2 { font-size: 16px; }
    .markdown h3 { font-size: 15px; }
    .markdown ul,
    .markdown ol {
        padding-left: 20px;
    }
    .markdown code {
        font-size: 12px;
        padding: 1px 4px;
    }
    .markdown pre {
        padding: 10px;
        font-size: 12px;
    }

    .welcome-screen {
        padding: 16px 12px;
        justify-content: flex-start;
        overflow-y: auto;
        min-height: 0;
    }

    .welcome-avatar {
        width: 56px;
        height: 56px;
        font-size: 30px;
        margin-bottom: 12px;
    }

    .welcome-screen h2 {
        font-size: 20px;
        margin-bottom: 4px;
    }

    .welcome-screen p {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .suggestions {
        grid-template-columns: 1fr;
        gap: 10px;
        width: 100%;
    }

    .suggestion-card {
        padding: 14px;
        display: flex;
        align-items: flex-start;
        gap: 12px;
        text-align: left;
    }

    .suggestion-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .suggestion-card-content {
        flex: 1;
        min-width: 0;
    }

    .suggestion-card h4 {
        font-size: 14px;
        margin: 0 0 2px 0;
        line-height: 1.3;
    }

    .suggestion-card p {
        font-size: 12px;
        margin: 0;
        line-height: 1.4;
    }

    .input-area {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .quick-chips {
        gap: 6px;
        margin-bottom: 12px;
    }

    .chip {
        padding: 6px 12px;
        font-size: 12px;
    }

    .input-field {
        padding: 12px 14px;
        font-size: 14px;
        min-height: 48px;
    }

    .send-button {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .header-subtitle {
        display: none;
    }

    .user-name {
        max-width: 50px;
    }

    .user-info {
        padding: 5px 10px;
        gap: 6px;
    }

    .message-content {
        max-width: 90%;
    }

    .welcome-screen {
        padding: 12px 8px;
    }

    .welcome-avatar {
        width: 48px;
        height: 48px;
        font-size: 26px;
        margin-bottom: 10px;
    }

    .welcome-screen h2 {
        font-size: 18px;
    }

    .welcome-screen p {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .suggestion-card {
        padding: 12px;
        gap: 10px;
    }

    .suggestion-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .suggestion-card-content h4 {
        font-size: 13px;
        margin-bottom: 1px;
        line-height: 1.3;
    }

    .suggestion-card-content p {
        font-size: 11px;
        line-height: 1.4;
    }

    .quick-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .quick-chips::-webkit-scrollbar {
        display: none;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .suggestion-card:hover,
    .chip:hover,
    .send-button:hover:not(:disabled),
    .btn:hover {
        transform: none;
    }

    .suggestion-card:active {
        transform: scale(0.98);
        border-color: var(--primary-light);
    }

    .chip:active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }
}

/* Dark mode support for messages */
@media (prefers-color-scheme: dark) {
    .message.user .message-bubble {
        background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    }
}

/* Safe area inset fallback for browsers that don't support env() */
@supports not (padding-bottom: env(safe-area-inset-bottom)) {
    .input-area {
        padding-bottom: 20px;
    }
}

/* Mobile viewport height fix for browser chrome */
@supports (height: 100dvh) {
    .container {
        height: 100dvh;
    }
}

/* Toast notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
}

.toast.show {
    display: flex;
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.success {
    border-left: 4px solid var(--success);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-state-sub {
    font-size: 14px;
}

/* Auth View (Login/Register) */
.auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 20px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: slideIn 0.3s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-button {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.form-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.form-button:active:not(:disabled) {
    transform: scale(0.98);
}

.form-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 14px;
    color: var(--danger);
    margin-bottom: 16px;
    display: none;
}

.auth-error.show {
    display: block;
}

/* User info in header */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-md);
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.logout-btn:active {
    transform: scale(0.9);
}

/* Hide chat view initially */
.chat-view.hidden {
    display: none;
}

/* Auth view hidden by default */
.auth-view.hidden {
    display: none;
}
