:root {
    --bg-color: #0f172a;
    --card-color: #1e293b;
    --text-color: #f1f5f9;
    --highlight-color: #94a3b8;
    --primary-color: #38bdf8;
    --user-msg-color: #0369a1;
    --ai-msg-color: #334155;
    --border-radius: 2px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    --border-style: 1px solid rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    margin: 0;
    background: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#app-container {
    width: 100%;
    max-width: 1000px;
    background: var(--card-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 90vh;
    border: var(--border-style);
}

header {
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: var(--border-style);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h2 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#status-area {
    padding: 8px 25px;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: var(--border-style);
}

#status {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 10px;
    background: #0f172a;
    padding: 2px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

progress {
    flex-grow: 1;
    height: 4px;
    border: none;
    background-color: transparent;
    appearance: none;
}

progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: var(--primary-color); }
progress::-moz-progress-bar { background: var(--primary-color); }

#progress-text {
    font-size: 0.7rem;
    color: var(--highlight-color);
    min-width: 35px;
}

#chat {
    flex-grow: 1;
    overflow-y: auto;
    padding: 25px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
    background-size: 24px 24px;
}

.msg {
    margin-bottom: 24px;
    max-width: 100%;
}

.msg-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    opacity: 0.6;
}

.user .msg-header { color: var(--primary-color); text-align: right; }
.ai .msg-header { color: #cbd5e1; }

.msg-content {
    padding: 12px 18px;
    border-radius: var(--border-radius);
    line-height: 1.7;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
}

.user { align-items: flex-end; }
.user .msg-content {
    background: var(--user-msg-color);
    color: white;
    border-left-color: #7dd3fc;
}

.ai { align-items: flex-start; }
.ai .msg-content {
    background: var(--ai-msg-color);
    color: var(--text-color);
    border-left-color: var(--highlight-color);
}

pre {
    background: #000000 !important;
    padding: 15px;
    border-radius: 0;
    border-left: 3px solid var(--primary-color);
    margin: 15px 0;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 0;
    text-transform: uppercase;
    font-size: 0.7rem;
    cursor: pointer;
}

.copy-btn:hover {
    background: var(--primary-color);
    color: #000;
}

#controls-container {
    padding: 24px;
    background: rgba(0, 0, 0, 0.25);
    border-top: var(--border-style);
    display: flex;
    justify-content: center;
}

#controls {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    width: 100%;
    max-width: 850px;
}

#pause-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    background: #334155;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#pause-btn:hover {
    background: #475569;
    border-color: var(--primary-color);
}

#input {
    flex: 1;
    border-radius: var(--border-radius);
    background: #0f172a;
    border: 1px solid #334155;
    padding: 14px 18px;
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.5;
    outline: none;
    box-shadow: none;
    resize: none;
    min-height: 20px;
    max-height: 200px;
    transition: all 0.2s ease;
    caret-color: var(--primary-color);
}

#input:focus {
    border-color: var(--primary-color);
    background: #151f35;
}

#input::placeholder {
    color: #4b5563;
}

#send {
    height: 48px;
    padding: 0 28px;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: #0f172a;
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

#send:hover {
    background: #7dd3fc;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

#send:disabled {
    background: #1e293b;
    color: #475569;
    cursor: not-allowed;
}

#chat::-webkit-scrollbar {
    width: 6px;
}
#chat::-webkit-scrollbar-track {
    background: transparent;
}
#chat::-webkit-scrollbar-thumb {
    background: #334155;
}
#chat::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

@media (max-width: 600px) {
    #app-container { height: 100vh; border: none; }
    #controls { flex-wrap: wrap; justify-content: center; }
    #input { min-width: 100%; order: 1; }
    #pause-btn { order: 2; }
    #send { order: 3; flex: 1; }
}


#input::-webkit-scrollbar {
    width: 4px; 
}

#input::-webkit-scrollbar-track {
    background: #0f172a; 
    border-radius: 0;
}

#input::-webkit-scrollbar-thumb {
    background: #334155; 
    border-radius: 0;
}

#input::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color); 
}

#input {
    scrollbar-width: thin;
    scrollbar-color: #334155 #0f172a;
}

#input {
    padding-right: 8px; 
}
