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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    background: #1a1a1a;
    color: #e8e8e8;
    height: 100vh;
    overflow: hidden;
}

/* Welcome Screen Styles */
.welcome-screen {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    position: relative;
    overflow: hidden;
}

.welcome-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    z-index: 1000;
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(42, 42, 42, 0.5);
}

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

.welcome-header-link {
    color: #e8e8e8;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(58, 58, 58, 0.5);
    background: rgba(42, 42, 42, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.welcome-header-link:hover {
    background: rgba(35, 35, 35, 0.8);
    border-color: rgba(74, 74, 74, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.welcome-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveGrid 20s linear infinite;
}

@keyframes moveGrid {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

.welcome-content {
    max-width: 680px;
    width: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease-out;
}

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

.welcome-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.welcome-icon::before {
    content: '';
    position: absolute;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(0,0,0,0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.3;
    }
}

.spinning-asterisk {
    width: 100%;
    height: 100%;
    animation: spin 3s linear infinite;
    filter: brightness(0);
    position: relative;
    z-index: 2;
}

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

.welcome-title {
    font-size: 36px;
    font-weight: 400;
    color: #e8e8e8;
    text-align: center;
    letter-spacing: -0.5px;
    animation: fadeIn 1s ease-out 0.2s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.input-container-welcome {
    width: 100%;
    animation: fadeIn 1s ease-out 0.4s both;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    animation: fadeIn 1s ease-out 0.6s both;
}

.action-btn {
    background: rgba(26, 26, 26, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(58, 58, 58, 0.5);
    border-radius: 12px;
    padding: 20px 12px;
    color: #e8e8e8;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-btn:hover::before {
    width: 300px;
    height: 300px;
}

.action-btn:hover {
    background: rgba(35, 35, 35, 0.8);
    border-color: rgba(74, 74, 74, 0.8);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.action-btn:active {
    transform: translateY(-2px);
    transition: transform 0.1s;
}

.action-btn svg {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s;
}

.action-btn:hover svg {
    transform: scale(1.1);
}

/* Chat Interface Styles */
.chat-interface {
    width: 100%;
    height: 100vh;
    display: flex;
    position: relative;
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #171717 0%, #1a1a1a 100%);
    border-right: 1px solid rgba(42, 42, 42, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.2);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.8);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.new-chat-btn,
.clear-all-btn {
    width: 100%;
    background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
    border: 1px solid rgba(58, 58, 58, 0.5);
    border-radius: 10px;
    padding: 12px;
    color: #e8e8e8;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.clear-all-btn {
    background: linear-gradient(135deg, #2a0000 0%, #1a0000 100%);
    border-color: rgba(88, 28, 28, 0.5);
    font-size: 13px;
}

.new-chat-btn::before,
.clear-all-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.new-chat-btn:hover::before,
.clear-all-btn:hover::before {
    width: 300px;
    height: 300px;
}

.new-chat-btn:hover,
.clear-all-btn:hover {
    border-color: rgba(74, 74, 74, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.clear-all-btn:hover {
    border-color: rgba(138, 48, 48, 0.8);
    box-shadow: 0 4px 16px rgba(139, 0, 0, 0.3);
}

.new-chat-btn svg,
.clear-all-btn svg {
    width: 16px;
    height: 16px;
    position: relative;
    z-index: 1;
}

/* Utility Section */
.utility-section {
    border-bottom: 1px solid rgba(42, 42, 42, 0.8);
    background: rgba(0, 0, 0, 0.2);
}

.utility-header {
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 16px;
    color: #e8e8e8;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.3s;
}

.utility-header:hover {
    background: rgba(42, 42, 42, 0.4);
}

.utility-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
}

.utility-arrow.collapsed {
    transform: rotate(-90deg);
}

.utility-content {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.utility-content.collapsed {
    max-height: 0;
    padding: 0 16px;
}

.utility-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.utility-label {
    color: #999;
}

.utility-value {
    color: #e8e8e8;
    font-weight: 500;
}

.utility-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(42, 42, 42, 0.5);
}

.utility-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(42, 42, 42, 0.6);
    border: 1px solid rgba(58, 58, 58, 0.5);
    color: #e8e8e8;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s;
}

.utility-link:hover {
    background: rgba(35, 35, 35, 0.8);
    border-color: rgba(74, 74, 74, 0.8);
    transform: translateX(4px);
}

.utility-link svg {
    width: 14px;
    height: 14px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-history-item {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.chat-history-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: #fff;
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-history-item:hover {
    background: rgba(42, 42, 42, 0.6);
    padding-left: 16px;
}

.chat-history-item:hover::before {
    transform: scaleY(1);
}

.chat-history-item.active {
    background: rgba(42, 42, 42, 0.8);
    padding-left: 16px;
}

.chat-history-item.active::before {
    transform: scaleY(1);
}

.chat-title {
    font-size: 13px;
    color: #e8e8e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-date {
    font-size: 11px;
    color: #666;
}

.delete-chat-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    display: none;
    transition: color 0.2s;
}

.chat-history-item:hover .delete-chat-btn {
    display: block;
}

.delete-chat-btn:hover {
    color: #ff4444;
}

.delete-chat-btn svg {
    width: 14px;
    height: 14px;
}

/* Sidebar toggle button (mobile) */
.sidebar-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: #000;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 10px;
    color: #e8e8e8;
    cursor: pointer;
    display: none;
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* Main chat area */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    padding: 16px 24px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    background: #1a1a1a;
    z-index: 100;
}

.logo {
    width: 32px;
    height: 32px;
    background: #000;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.logo-icon {
    width: 20px;
    height: 20px;
}

.title {
    font-size: 15px;
    font-weight: 500;
    color: #e8e8e8;
}

.header-links {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-link {
    color: #e8e8e8;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(58, 58, 58, 0.5);
    background: rgba(42, 42, 42, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-link:hover {
    background: rgba(35, 35, 35, 0.8);
    border-color: rgba(74, 74, 74, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 16px;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.message-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-icon svg {
    width: 16px;
    height: 16px;
}

.user-icon {
    background: #2a2a2a;
    color: #e8e8e8;
}

.assistant-icon {
    background: #000;
    color: #fff;
}

.message-content {
    flex: 1;
    padding-top: 4px;
}

.message-text {
    font-size: 15px;
    line-height: 1.6;
    color: #e8e8e8;
    white-space: pre-wrap;
}

.code-block {
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.input-container {
    padding: 16px 24px 24px;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
}

.input-wrapper {
    position: relative;
    background: rgba(42, 42, 42, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(58, 58, 58, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.input-wrapper:focus-within {
    border-color: rgba(74, 74, 74, 0.8);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

#messageInput {
    width: 100%;
    background: transparent;
    border: none;
    padding: 16px 56px 16px 16px;
    font-size: 15px;
    color: #e8e8e8;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
}

#messageInput:focus {
    outline: none;
}

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

.send-button {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 36px;
    height: 36px;
    background: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.send-button:hover {
    background: #1a1a1a;
    transform: scale(1.05) rotate(-5deg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

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

.send-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.send-button:disabled:hover {
    transform: none;
    background: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.send-icon {
    width: 16px;
    height: 16px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #666;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Responsive Design */
@media (max-width: 768px) {
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .welcome-title {
        font-size: 24px;
    }
    
    .welcome-icon {
        width: 60px;
        height: 60px;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
}
