* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-main: #212121;
    --bg-sidebar: #171717;
    --bg-input: #2f2f2f;
    --text-primary: #ECECEC;
    --text-secondary: #aaaaaa;
    --border-color: #383838;
    --btn-primary: #10a37f;
    --btn-hover: #1a7f64;
    --bot-msg-bg: transparent;
    --user-msg-bg: #2f2f2f;
}

html {
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    height: 100%;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    overscroll-behavior-y: none;
}

#app {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 10px;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.new-chat-btn {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.new-chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    margin-top: 20px;
}

.history-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 10px;
    text-transform: uppercase;
}

.history-item {
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.history-item.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 15px 10px 5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.user-info img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-main);
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    cursor: pointer;
}

.model-selector select {
    background: transparent;
    color: var(--text-primary);
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    font-family: inherit;
}

.model-selector select option {
    background: var(--bg-input);
    color: #fff;
}

/* Premium Toggle */
.premium-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.premium-label {
    color: #f1c40f;
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--btn-primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Chat Content */
.chat-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

.welcome-screen {
    margin: auto;
    text-align: center;
    max-width: 600px;
}

.robot-icon-wrap {
    background: rgba(255, 255, 255, 0.1);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.welcome-screen h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.suggestions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.suggestion-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    width: 180px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.suggestion-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.card-title {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Messages */
.message {
    display: flex;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto 30px;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message.bot .avatar {
    background-color: #10a37f;
}

.message.user .avatar {
    background-color: transparent;
}

.message.user .avatar img {
    border-radius: 50%;
    width: 30px;
    height: 30px;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    line-height: 1.6;
    font-size: 1rem;
    padding: 15px 20px;
    border-radius: 12px;
    max-width: 85%;
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.message.user .message-content {
    background-color: var(--user-msg-bg);
}

.message.bot .message-content {
    background-color: var(--bot-msg-bg);
}

/* User inputs / texts styling */
.message-content p {
    margin-bottom: 10px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre {
    background-color: #0d0d0d;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 10px;
}

.message-content code {
    font-family: monospace;
}

/* Input Area */
.input-area {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.file-preview-container {
    background: var(--bg-input);
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-preview-container.hidden {
    display: none;
}

#removeFileBtn {
    cursor: pointer;
    color: #ff5e5e;
}

.input-wrapper {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    align-items: flex-end;
    padding: 10px 15px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.input-wrapper:focus-within {
    border-color: #555;
}

.file-btn {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 5px;
    margin-right: 10px;
    margin-bottom: 2px;
}

.file-btn:hover {
    color: var(--text-primary);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    outline: none;
    max-height: 200px;
    padding: 5px 0;
    line-height: 1.4;
}

.send-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    margin-left: 10px;
    margin-bottom: 2px;
    background-color: #fff;
    color: #000;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.send-btn:hover:not(:disabled) {
    background-color: #dcdcdc;
}

.send-btn:disabled {
    background-color: #555;
    color: #888;
    cursor: not-allowed;
}

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-flex;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
    z-index: 10;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* License area */
.license-area {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.license-area input {
    width: 100%;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.license-area button {
    width: 100%;
    padding: 8px;
    background: var(--btn-primary);
    border: none;
    color: white;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.license-area button:hover {
    background: var(--btn-hover);
}

.mode-toggles {
    display: flex;
    gap: 20px;
    align-items: center;
}

.mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    margin-left: 5px;
    margin-bottom: 2px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.voice-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.voice-btn.recording {
    color: #ff4757;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
        box-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
    }
}

.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 2px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Mobile Optimization */
.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    margin-right: 15px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.header-left {
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .hamburger-btn {
        display: block;
    }

    .premium-text-mobile {
        display: none;
    }

    .chat-header {
        padding: 10px 15px;
    }

    .model-selector select {
        font-size: 1rem;
    }

    .mode-toggles {
        gap: 10px;
    }

    .chat-header .desktop-text {
        display: none !important;
    }

    .chat-header .mobile-text {
        display: inline-block !important;
        font-weight: 600;
        color: var(--text-primary);
    }

    .message {
        gap: 10px;
        margin: 0 auto 20px;
    }

    .message-content {
        max-width: calc(100% - 40px);
        padding: 12px 15px;
        font-size: 0.95rem;
    }

    .suggestion-card {
        width: 100%;
        flex: 1 1 100%;
    }

    .input-wrapper {
        padding: 8px 10px;
        border-radius: 12px;
    }

    .chat-content {
        padding: 15px 10px;
    }

    .input-area {
        padding: 10px;
    }
}