:root {
    --bg: #030712;
    --bg-elevated: #111827;
    --bg-elevated-soft: #0b1120;
    --bg-sidebar: #020617;
    --accent: #5865f2;
    --accent-soft: rgba(88, 101, 242, 0.15);
    --accent-strong: #7c83ff;
    --danger: #ef4444;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border-soft: rgba(255, 255, 255, 0.06);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-soft: 0 22px 60px rgba(0, 0, 0, 0.85);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: radial-gradient(circle at top, #111827 0, #020617 55%, #02010a 100%);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

/* UTIL */
.hidden { display: none !important; }

.btn {
    border-radius: 999px;
    border: none;
    padding: 8px 16px;
    background: rgba(31, 41, 55, 0.9);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s;
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    box-shadow: 0 10px 25px rgba(88, 101, 242, 0.45);
}

.btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(88, 101, 242, 0.6);
}

.btn.ghost {
    background: rgba(31, 41, 55, 0.85);
}

.btn.ghost:hover {
    background: rgba(55, 65, 81, 0.95);
}

.btn.accent {
    background: rgba(88, 101, 242, 0.15);
    color: var(--accent-strong);
}

.btn.accent:hover {
    background: rgba(88, 101, 242, 0.26);
}

.btn.danger {
    background: radial-gradient(circle at top, #f97373, #b91c1c);
    color: #fff;
}

.btn.danger:hover {
    box-shadow: 0 9px 22px rgba(185, 28, 28, 0.55);
}

.btn.full {
    width: 100%;
}

.btn.tiny {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(88, 101, 242, 0.2), transparent 60%),
        radial-gradient(circle at bottom right, rgba(236, 72, 153, 0.18), transparent 60%),
        radial-gradient(circle at center, #020617 0, #02010a 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.login-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    max-width: 480px;
    width: 100%;
    padding: 22px 24px 24px;
    border-radius: 22px;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), rgba(0, 0, 0, 0.98));
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.login-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.login-logo {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    background: radial-gradient(circle at top, #a855f7, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.5rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

.login-title h1 {
    margin: 0;
    font-size: 1.4rem;
}

.login-title p {
    margin: 3px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-form {
    margin-top: 10px;
}

.login-form label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    margin-top: 10px;
}

.login-form input {
    width: 100%;
    padding: 9px 11px;
    border-radius: 9px;
    border: 1px solid rgba(31, 41, 55, 0.95);
    background: rgba(15, 23, 42, 0.95);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
}

.login-form input:focus {
    border-color: rgba(88, 101, 242, 0.8);
    box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.45);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 14px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.login-divider span {
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, 0.4);
}

.login-error {
    min-height: 18px;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #fca5a5;
}

/* APP ROOT */
.app-root {
    display: flex;
    height: 100vh;
}

/* SIDEBAR (Discord) */
.sidebar {
    width: 260px;
    background: linear-gradient(160deg, #020617, #020617 40%, #020617 60%, #020617 100%);
    border-right: 1px solid rgba(148, 163, 184, 0.25);
    display: flex;
    flex-direction: column;
    padding: 12px 10px;
    gap: 12px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 64, 175, 0.7));
}

.server-logo {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: radial-gradient(circle at top, #f97316, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
}

.server-info {
    display: flex;
    flex-direction: column;
}

.server-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.server-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 0 6px;
}

.channel-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.channel {
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 7px 9px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.12s, color 0.12s;
}

.channel-hash {
    font-weight: 700;
    font-size: 0.9rem;
    color: #4b5563;
}

.channel:hover {
    background: rgba(31, 41, 55, 0.7);
    color: var(--text);
}

.channel.active {
    background: var(--accent-soft);
    color: #e5e7ff;
}

/* Sidebar user */
.sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.95);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: radial-gradient(circle at top, #38bdf8, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.user-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-mode {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* CHAT LAYOUT */
.chat-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top, rgba(88, 101, 242, 0.25), transparent 55%),
        radial-gradient(circle at bottom right, rgba(8, 47, 73, 0.7), transparent 60%),
        #020617;
}

/* Chat header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.85));
}

.chat-header-main {
    display: flex;
    flex-direction: column;
}

.chat-channel-name {
    font-size: 1rem;
    font-weight: 600;
}

.chat-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.status-dot.online {
    background: #22c55e;
}

/* Messages (ChatGPT-like) */
.messages {
    flex: 1;
    padding: 14px 18px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

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

.messages::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 6px;
}

.msg {
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    animation: fade-in 0.15s ease-out;
}

.msg-bubble {
    max-width: 900px;
    border-radius: 16px;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 1px solid rgba(31, 41, 55, 0.9);
    background: rgba(15, 23, 42, 0.98);
}

.msg.user .msg-bubble {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(59, 130, 246, 0.6);
}

.msg.assistant .msg-bubble {
    background: rgba(15, 23, 42, 0.98);
}

.msg-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.msg-sender {
    font-weight: 600;
}

.msg-role-tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(31, 41, 55, 1);
}

.msg.user .msg-role-tag {
    color: #bfdbfe;
}

.msg.assistant .msg-role-tag {
    color: #f9a8d4;
}

.msg-bubble pre {
    background: #020617;
    padding: 8px;
    border-radius: 12px;
    overflow-x: auto;
    position: relative;
    margin-top: 8px;
}

.copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 4px 7px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.96);
    color: #e5e7eb;
    font-size: 0.7rem;
    cursor: pointer;
}

/* Typing indicator (3 dots) */
.typing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.typing .dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.9);
    animation: bounce 1s infinite ease-in-out;
}

.typing .dot:nth-child(1) { animation-delay: 0s; }
.typing .dot:nth-child(2) { animation-delay: 0.12s; }
.typing .dot:nth-child(3) { animation-delay: 0.24s; }

.typing-text {
    margin-left: 4px;
}

/* Input bar */
.input-bar {
    padding: 10px 18px 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.98);
}

.input-inner {
    background: #020617;
    border-radius: 18px;
    border: 1px solid rgba(31, 41, 55, 1);
    padding: 6px 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#msgBox {
    background: transparent;
    border: none;
    resize: none;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 160px;
    min-height: 22px;
    outline: none;
}

.input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 2px;
}

.file-button {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 41, 55, 0.96);
    cursor: pointer;
    font-size: 0.9rem;
}

.file-button input[type="file"] {
    display: none;
}

/* Animations */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }
}

/* DODATE UTILITY KLASE ZA INPUT */

.left-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}
