/* =================================
   theme 1 - green forest (default)
================================= */
:root,
[data-theme="green"] {
    --primary: #198754;
    --primary-dark: #146c43;
    --primary-soft: #e8f5ee;
    --sidebar-bg: #172c24;
    --sidebar-text: #dce9e1;
    --body-bg: #f5f7f8;
    --chat-bg: #ffffff;
    --text-color: #343a40;
    --border-color: #e5e9ec;
    --ai-bg: #f0f3f5;
    --user-bg: #198754;
}

/* =================================
   theme 2 - ocean blue
================================= */
[data-theme="blue"] {
    --primary: #0d6efd;
    --primary-dark: #084298;
    --primary-soft: #e8f1ff;
    --sidebar-bg: #172a45;
    --sidebar-text: #dce7f5;
    --body-bg: #f4f7fb;
    --chat-bg: #ffffff;
    --text-color: #343a40;
    --border-color: #e1e8f0;
    --ai-bg: #edf2f8;
    --user-bg: #0d6efd;
}

/* =================================
   theme 3 - modern gray
================================= */
[data-theme="gray"] {
    --primary: #6c757d;
    --primary-dark: #495057;
    --primary-soft: #eceff1;
    --sidebar-bg: #343a40;
    --sidebar-text: #e2e3e5;
    --body-bg: #f5f5f5;
    --chat-bg: #ffffff;
    --text-color: #343a40;
    --border-color: #e5e5e5;
    --ai-bg: #eeeeee;
    --user-bg: #6c757d;
}

/* =================================
   theme 4 - teal fresh
================================= */
[data-theme="teal"] {
    --primary: #0f9d91;
    --primary-dark: #08766e;
    --primary-soft: #e0f5f2;
    --sidebar-bg: #123b3b;
    --sidebar-text: #d7eeeb;
    --body-bg: #f2f8f7;
    --chat-bg: #ffffff;
    --text-color: #344444;
    --border-color: #dcebe8;
    --ai-bg: #edf6f4;
    --user-bg: #0f9d91;
}

/* =================================
   theme 5 - royal purple
================================= */
[data-theme="purple"] {
    --primary: #7952b3;
    --primary-dark: #59358c;
    --primary-soft: #f0eafa;
    --sidebar-bg: #302342;
    --sidebar-text: #e8def5;
    --body-bg: #f8f6fb;
    --chat-bg: #ffffff;
    --text-color: #40394a;
    --border-color: #e9e2f1;
    --ai-bg: #f2eef7;
    --user-bg: #7952b3;
}

/* =================================
   theme 6 - midnight navy
================================= */
[data-theme="navy"] {
    --primary: #345995;
    --primary-dark: #233e6c;
    --primary-soft: #e9eff8;
    --sidebar-bg: #18263d;
    --sidebar-text: #dce6f4;
    --body-bg: #f3f6fa;
    --chat-bg: #ffffff;
    --text-color: #303b4c;
    --border-color: #dfe6ef;
    --ai-bg: #edf1f7;
    --user-bg: #345995;
}

/* =================================
   theme 7 - emerald
================================= */
[data-theme="emerald"] {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-soft: #e1f5ed;
    --sidebar-bg: #12382e;
    --sidebar-text: #d5eee4;
    --body-bg: #f2f8f5;
    --chat-bg: #ffffff;
    --text-color: #34483e;
    --border-color: #dcebe3;
    --ai-bg: #edf5f0;
    --user-bg: #059669;
}

/* =================================
   theme 8 - burgundy
================================= */
[data-theme="burgundy"] {
    --primary: #922b52;
    --primary-dark: #701d3d;
    --primary-soft: #f8e9ef;
    --sidebar-bg: #381c2a;
    --sidebar-text: #f0dce5;
    --body-bg: #faf5f7;
    --chat-bg: #ffffff;
    --text-color: #46343c;
    --border-color: #ecdee4;
    --ai-bg: #f5edf0;
    --user-bg: #922b52;
}

/* =================================
   theme 9 - soft blue
================================= */
[data-theme="softblue"] {
    --primary: #4b83c3;
    --primary-dark: #32669f;
    --primary-soft: #edf4fc;
    --sidebar-bg: #263d57;
    --sidebar-text: #dce8f5;
    --body-bg: #f5f8fc;
    --chat-bg: #ffffff;
    --text-color: #344456;
    --border-color: #e1e9f2;
    --ai-bg: #f0f5fa;
    --user-bg: #4b83c3;
}

/* =================================
   theme 10 - amber gold
================================= */
[data-theme="amber"] {
    --primary: #b7791f;
    --primary-dark: #925d13;
    --primary-soft: #fff5df;
    --sidebar-bg: #3d3020;
    --sidebar-text: #f3e6cf;
    --body-bg: #fbf8f1;
    --chat-bg: #ffffff;
    --text-color: #493f30;
    --border-color: #eee5d5;
    --ai-bg: #f7f2e8;
    --user-bg: #b7791f;
}
* {
	box-sizing: border-box;
}

html, body {
	height: 100%;
	margin: 0;
}

body {
	background: var(--body-bg);
	color: var(--text-color);
	overflow: hidden;
	font-family: Arial, sans-serif;
}

.app-container {
	display: flex;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
}

/* sidebar */

.sidebar {
	width: 265px;
	min-width: 265px;
	background: var(--sidebar-bg);
	color: var(--sidebar-text);
	display: flex;
	flex-direction: column;
	padding: 20px 15px;
	
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 65px;
    padding: 10px 14px;
    margin-bottom: 20px;

    background: #ffffff;
    color: #212529;

    border-radius: 12px;
    font-size: 20px;
    font-weight: 700;
}

/* Logo gambar */
.brand img {
    max-width: 100%;
    max-height: 45px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Icon brand */
.brand i {
    color: var(--primary);
    margin-right: 5px;
}

/* Teks brand */
.brand span {
    color: #212529;
}

/* Brand pada sidebar mobile */
.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;

    background: #ffffff;
    color: #212529 !important;

    border-radius: 12px;
    font-weight: 700;
}

.mobile-brand img {
    max-width: 100%;
    max-height: 45px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.btn-new-chat {
	border: 1px solid rgba(255,255,255,.35);
	color: white;
	border-radius: 10px;
	padding: 11px 15px;
	text-align: left;
	background: transparent;
}

.btn-new-chat:hover {
	background: rgba(255,255,255,.12);
	color: white;
}

.sidebar-label {
	font-size: 11px;
	font-weight: 700;
	color: #9aafa3;
	text-transform: uppercase;
	margin: 25px 10px 10px;
}

.sidebar .nav-link {
	color: var(--sidebar-text);
	border-radius: 8px;
	padding: 11px 12px;
	font-size: 14px;
	margin-bottom: 4px;
}

.sidebar .nav-link i {
	margin-right: 9px;
	font-size: 16px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
	background: var(--primary);
	color: white;
}

.sidebar-footer {
	margin-top: auto;
	padding: 12px;
	font-size: 12px;
	color: #9aafa3;
	border-top: 1px solid rgba(255,255,255,.15);
}

/* main */

.main-content {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	background: var(--chat-bg);
}

/* topbar */

.topbar {
	min-height: 65px;
	padding: 10px 20px;
	border-bottom: 1px solid var(--border-color);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: var(--chat-bg);
}

.topbar-title {
	font-weight: 700;
	font-size: 15px;
}

.topbar-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.token-badge {
	background: var(--primary-soft);
	color: var(--primary-dark);
	border-radius: 20px;
	padding: 7px 12px;
	font-size: 12px;
	white-space: nowrap;
}

/* theme */

.theme-select,
.language-select {
	border: 1px solid var(--border-color);
	border-radius: 8px;
	padding: 7px 10px;
	font-size: 13px;
	background: var(--chat-bg);
	color: var(--text-color);
}

/* chat */

.chat-scroll {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 25px;
	background: var(--chat-bg);
}

.chat-inner {
	max-width: 900px;
	margin: 0 auto;
}

.message {
	display: flex;
	margin-bottom: 23px;
	gap: 12px;
	align-items: flex-start;
}

.message.user {
	justify-content: flex-end;
}

.avatar {
	width: 35px;
	height: 35px;
	min-width: 35px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--primary-soft);
	color: var(--primary);
}

.message-content {
	max-width: 78%;
}

.message-name {
	font-size: 12px;
	color: #000000;
	margin-bottom: 5px;
}

.bubble {
	padding: 13px 16px;
	font-size: 14px;
	line-height: 1.7;
	overflow-wrap: anywhere;
}

.bubble-ai {
	background: var(--ai-bg);
	color: var(--text-color);
	border-radius: 3px 15px 15px 15px;
}

.bubble-user {
	background: var(--user-bg);
	color: white;
	border-radius: 15px 3px 15px 15px;
}

.message.user .avatar {
	order: 2;
	background: var(--primary);
	color: white;
}

/* input */

.input-area {
	padding: 15px 20px;
	border-top: 1px solid var(--border-color);
	background: var(--chat-bg);
}

.input-inner {
	max-width: 900px;
	margin: auto;
}

.chat-input-group {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 5px;
	border: 1px solid var(--border-color);
	border-radius: 13px;
	background: var(--chat-bg);
}

.chat-input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: none;
	padding: 9px;
	background: transparent;
	color: var(--text-color);
	font-size: 14px;
}

.chat-input:focus {
	outline: none;
	box-shadow: none;
}

.btn-send {
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 10px;
	background: var(--primary);
	color: white;
}

.btn-send:hover {
	background: var(--primary-dark);
	color: white;
}

.input-note {
	font-size: 11px;
	color: #92999e;
	text-align: center;
	margin-top: 9px;
}

/* offcanvas */

.offcanvas {
	background: var(--sidebar-bg);
	color: white;
}

.offcanvas .btn-close {
	filter: invert(1);
}



/* typing animation */
.msg.typing {
	display: inline-flex;
	align-items: center;
	padding: 10px 15px;
}

.msg.typing .dot {
	height: 8px;
	width: 8px;
	margin: 0 2px;
	background-color: #555;
	border-radius: 50%;
	display: inline-block;
	animation: blink 1.4s infinite both;
}

.msg.typing .dot:nth-child(1) {
	animation-delay: 0s;
}

.msg.typing .dot:nth-child(2) {
	animation-delay: 0.2s;
}

.msg.typing .dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes blink {
	0%, 80%, 100% {
		opacity: 0.2;
	}
	40% {
		opacity: 1;
	}
}

/* scroll menu daftar judul sidebar */
.menu-scroll {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

/* scrollbar */
.menu-scroll::-webkit-scrollbar {
    width: 5px;
}

.menu-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.menu-scroll::-webkit-scrollbar-thumb {
    background: #89968e;
    border-radius: 10px;
}

.menu-scroll::-webkit-scrollbar-thumb:hover {
    background: #198754;
}

/* responsive */

.btn-login {
    background: var(--primary);
    border: none;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.btn-login:hover {
    background: var(--primary-dark);
}

@media(max-width:575.98px) {
    .btn-login {
        padding: 7px 9px;
        font-size: 11px;
    }

    .btn-login i {
        margin-right: 0 !important;
    }
}

.login-icon {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: auto;
}

#loginModal .form-control,
#loginModal .input-group-text {
    font-size: 13px;
    padding: 10px;
}

#loginModal .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(25,135,84,.15);
}

#loginModal .modal-dialog {
    margin-left: auto;
    margin-right: auto;
}



/* shortcut pertanyaan */
.shortcut-question {
    margin-bottom: 12px;
}


.shortcut-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin;
}

.shortcut-item {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: rgba(255,255,255,.92);
    color: #495057;
    font-size: 12px;
    cursor: pointer;
    transition: all .2s ease;
}

.shortcut-item i {
    color: var(--primary);
    font-size: 14px;
}

.shortcut-item:hover {
    background: #fff5dc;
    border-color: var(--border-color);
    color: #795817;
}

.shortcut-item:active {
    transform: scale(.97);
}


/* AREA MENU HORIZONTAL */
.chat-menu {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    padding: 0 15px 8px 15px;
    background: transparent;
	backdrop-filter: none;
	border-bottom: none;
    overflow: hidden;
}

/* LIST MENU */
.menu-list {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

/* SCROLLBAR CHROME */
.menu-list::-webkit-scrollbar {
    height: 5px;
}

.menu-list::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 10px;
}

.menu-list::-webkit-scrollbar-track {
    background: transparent;
}

/* ITEM MENU */
.menu-item {
    flex: 0 0 105px;
    min-width: 105px;
    padding: 10px 5px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;

    text-decoration: none;
    color: var(--primary);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.menu-item i {
    font-size: 23px;
    color: var(--primary);
}

.menu-item span {
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.menu-item:hover {
    background: #eaf5ef;
    color: #146c43;
}

.menu-item:hover i {
    color: #146c43;
}

/* MOBILE */
@media (max-width: 576px) {
    .chat-menu {
        padding: 8px 5px;
    }

    .menu-list {
        gap: 5px;
        justify-content: flex-start;
    }

    .menu-item {
        flex: 0 0 85px;
        min-width: 110px;
        padding: 8px 3px;
    }

    .menu-item i {
        font-size: 21px;
    }

    .menu-item span {
        font-size: 8px;
    }
}



/* scrollbar */
.shortcut-list::-webkit-scrollbar {
    height: 4px;
}

.shortcut-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* mobile */
@media (max-width: 576px) {
    .shortcut-item {
        padding: 8px 11px;
        font-size: 11px;
    }

}

@media(max-width: 991.98px) {
	.sidebar {
		display: none;
	}

	.topbar {
		padding: 10px 12px;
	}

	.chat-scroll {
		padding: 18px 12px;
	}

	.input-area {
		padding: 10px;
	}

	.message-content {
		max-width: 85%;
	}
}

@media(max-width: 575.98px) {
	.topbar-title {
		font-size: 13px;
		max-width: 125px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.topbar-right {
		gap: 6px;
	}

	.token-badge {
		display: none;
	}

	.theme-select,
	.language-select {
		font-size: 11px;
		padding: 6px;
		max-width: 95px;
	}

	.chat-scroll {
		padding: 15px 10px;
	}

	.message-content {
		max-width: 88%;
	}

	.bubble {
		font-size: 13px;
		padding: 11px 13px;
	}

	.avatar {
		width: 30px;
		height: 30px;
		min-width: 30px;
	}

	.input-note {
		font-size: 10px;
	}
}