/* Simple AI Chat - ai-chat.css */

.sac-app {
	--sac-bg: #ffffff;
	--sac-soft: #f7f8fa;
	--sac-border: #e6e8ec;
	--sac-text: #111827;
	--sac-muted: #6b7280;
	--sac-primary: #1d4ed8;
	--sac-primary-dark: #1e40af;
	--sac-primary-soft: #eef2ff;
	--sac-radius: 18px;
	--sac-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 12px 32px rgba(16, 24, 40, .08);

	position: relative;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 920px;
	height: 74vh;
	min-height: 540px;
	margin: 24px auto;
	background: var(--sac-bg);
	border: 1px solid var(--sac-border);
	border-radius: var(--sac-radius);
	box-shadow: var(--sac-shadow);
	overflow: hidden;
	color: var(--sac-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.6;
	text-align: left;
}

.sac-app *,
.sac-app *::before,
.sac-app *::after {
	box-sizing: border-box;
}

/* ---------------- HEADER ---------------- */

.sac-header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px;
	background: #ffffff;
	border-bottom: 1px solid var(--sac-border);
}

.sac-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.sac-logo {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 11px;
	background: linear-gradient(135deg, #1d4ed8, #3b82f6);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 17px;
	font-weight: 700;
}

.sac-brand-text {
	min-width: 0;
}

.sac-title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--sac-text);
}

.sac-subtitle {
	font-size: 12.5px;
	color: var(--sac-muted);
	line-height: 1.3;
	margin-top: 2px;
}

.sac-new {
	flex: 0 0 auto;
	border: 1px solid var(--sac-border);
	background: #ffffff;
	color: var(--sac-text);
	font-size: 13.5px;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 10px;
	cursor: pointer;
	transition: background .15s, border-color .15s, color .15s;
	font-family: inherit;
	line-height: 1.2;
}

.sac-new:hover {
	background: var(--sac-primary-soft);
	border-color: #c7d2fe;
	color: var(--sac-primary);
}

/* ---------------- AREA PESAN ---------------- */

.sac-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 22px 18px;
	background: #ffffff;
	scroll-behavior: smooth;
}

.sac-msg {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 18px;
}

.sac-msg:last-child {
	margin-bottom: 0;
}

.sac-msg-user {
	flex-direction: row-reverse;
}

.sac-avatar {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .02em;
	background: var(--sac-primary-soft);
	color: var(--sac-primary);
	user-select: none;
}

.sac-msg-user .sac-avatar {
	background: var(--sac-primary);
	color: #ffffff;
}

.sac-bubble {
	max-width: min(78%, 640px);
	padding: 11px 15px;
	border-radius: 16px;
	border-bottom-left-radius: 6px;
	background: var(--sac-soft);
	border: 1px solid var(--sac-border);
	overflow-wrap: anywhere;
	word-wrap: break-word;
}

.sac-msg-user .sac-bubble {
	background: var(--sac-primary);
	border-color: var(--sac-primary);
	color: #ffffff;
	border-bottom-left-radius: 16px;
	border-bottom-right-radius: 6px;
}

.sac-msg-img {
	display: block;
	max-width: 260px;
	width: 100%;
	height: auto;
	border-radius: 10px;
	margin-bottom: 8px;
	cursor: zoom-in;
	border: 1px solid rgba(0, 0, 0, .08);
}

.sac-content-user {
	white-space: pre-wrap;
}

/* ---------------- MARKDOWN ---------------- */

.sac-content > *:first-child { margin-top: 0; }
.sac-content > *:last-child  { margin-bottom: 0; }

.sac-content p { margin: 0 0 10px; }

.sac-content h1,
.sac-content h2,
.sac-content h3,
.sac-content h4,
.sac-content h5,
.sac-content h6 {
	margin: 14px 0 8px;
	line-height: 1.3;
	font-weight: 700;
	color: inherit;
}

.sac-content h1 { font-size: 1.35em; }
.sac-content h2 { font-size: 1.22em; }
.sac-content h3 { font-size: 1.12em; }
.sac-content h4 { font-size: 1.04em; }

.sac-content ul,
.sac-content ol {
	margin: 0 0 10px;
	padding-left: 22px;
}

.sac-content li { margin: 3px 0; }

.sac-content blockquote {
	margin: 10px 0;
	padding: 6px 12px;
	border-left: 3px solid #c7d2fe;
	background: rgba(29, 78, 216, .05);
	border-radius: 0 8px 8px 0;
	color: #374151;
}

.sac-content hr {
	border: 0;
	border-top: 1px solid var(--sac-border);
	margin: 14px 0;
}

.sac-content a {
	color: var(--sac-primary);
	text-decoration: underline;
}

.sac-msg-user .sac-content a {
	color: #ffffff;
}

.sac-content code {
	background: rgba(17, 24, 39, .07);
	padding: 2px 6px;
	border-radius: 6px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	font-size: .9em;
}

.sac-content code.sac-inline-code {
	background: rgba(17, 24, 39, .07);
	padding: 2px 6px;
	border-radius: 6px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .9em;
}

.sac-content pre {
	background: #0f172a;
	color: #e2e8f0;
	padding: 12px 14px;
	border-radius: 12px;
	overflow-x: auto;
	margin: 10px 0;
	font-size: 13px;
	line-height: 1.55;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.sac-content pre code {
	background: none;
	padding: 0;
	color: inherit;
	font-size: inherit;
	border-radius: 0;
}

.sac-tok-kw  { color: #c792ea; }
.sac-tok-str { color: #a5e075; }
.sac-tok-com { color: #7c8ba1; font-style: italic; }
.sac-tok-num { color: #f78c6c; }

/* ---------------- WELCOME ---------------- */

.sac-welcome {
	text-align: center;
	padding: 26px 10px 10px;
	color: var(--sac-muted);
}

.sac-welcome-icon {
	width: 48px;
	height: 48px;
	margin: 0 auto 12px;
	border-radius: 14px;
	background: linear-gradient(135deg, #1d4ed8, #3b82f6);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
}

.sac-welcome h2 {
	margin: 0 0 6px;
	font-size: 19px;
	font-weight: 700;
	color: var(--sac-text);
}

.sac-welcome p {
	margin: 0 0 18px;
	font-size: 14px;
}

.sac-welcome code {
	background: rgba(17, 24, 39, .07);
	padding: 2px 6px;
	border-radius: 6px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .88em;
	color: var(--sac-primary);
}

.sac-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.sac-chip {
	border: 1px solid var(--sac-border);
	background: #ffffff;
	color: var(--sac-text);
	font-size: 13px;
	padding: 8px 14px;
	border-radius: 999px;
	cursor: pointer;
	transition: background .15s, border-color .15s;
	font-family: inherit;
	line-height: 1.3;
	text-align: left;
}

.sac-chip:hover {
	background: var(--sac-primary-soft);
	border-color: #c7d2fe;
}

/* ---------------- TYPING ---------------- */

.sac-dots {
	display: inline-flex;
	gap: 5px;
	align-items: center;
	padding: 3px 0 6px;
}

.sac-dots span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9ca3af;
	animation: sac-bounce 1.2s infinite ease-in-out;
}

.sac-dots span:nth-child(2) { animation-delay: .15s; }
.sac-dots span:nth-child(3) { animation-delay: .30s; }

@keyframes sac-bounce {
	0%, 80%, 100% { transform: translateY(0);    opacity: .5; }
	40%           { transform: translateY(-4px); opacity: 1; }
}

.sac-thinking {
	font-size: 12.5px;
	color: var(--sac-muted);
}

/* ---------------- COMPOSER ---------------- */

.sac-composer {
	flex: 0 0 auto;
	border-top: 1px solid var(--sac-border);
	padding: 12px 14px 14px;
	background: #ffffff;
}

.sac-preview {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 2px 10px;
}

.sac-preview[hidden] {
	display: none;
}

.sac-thumb {
	position: relative;
	width: 72px;
	height: 72px;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid var(--sac-border);
	background: var(--sac-soft);
}

.sac-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.sac-thumb button {
	position: absolute;
	top: 3px;
	right: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 0;
	background: rgba(17, 24, 39, .78);
	color: #ffffff;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.sac-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	border: 1px solid var(--sac-border);
	border-radius: 16px;
	padding: 6px 6px 6px 8px;
	background: #ffffff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
	transition: border-color .15s, box-shadow .15s;
}

.sac-input-row:focus-within {
	border-color: #c7d2fe;
	box-shadow: 0 0 0 3px rgba(29, 78, 216, .10);
}

.sac-attach {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--sac-muted);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
}

.sac-attach:hover {
	background: var(--sac-soft);
}

.sac-attach:disabled {
	cursor: not-allowed;
}

.sac-textarea {
	flex: 1 1 auto;
	border: 0;
	outline: 0;
	resize: none;
	background: transparent;
	padding: 8px 4px;
	min-height: 38px;
	max-height: 180px;
	overflow-y: auto;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: inherit;
	box-shadow: none;
}

.sac-textarea:focus {
	outline: 0;
	box-shadow: none;
}

.sac-send {
	flex: 0 0 auto;
	border: 0;
	border-radius: 12px;
	background: var(--sac-primary);
	color: #ffffff;
	font-size: 14px;
	font-weight: 600;
	padding: 10px 18px;
	cursor: pointer;
	transition: background .15s, opacity .15s;
	font-family: inherit;
	line-height: 1.2;
}

.sac-send:hover:not(:disabled) {
	background: var(--sac-primary-dark);
}

.sac-send:disabled {
	opacity: .55;
	cursor: not-allowed;
}

/* ---------------- DRAG & DROP OVERLAY ---------------- */

.sac-drop-hint {
	position: absolute;
	inset: 8px;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px dashed var(--sac-primary);
	border-radius: 14px;
	background: rgba(238, 242, 255, .94);
	color: var(--sac-primary);
	font-weight: 600;
	font-size: 15px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s;
}

.sac-app.sac-dragover .sac-drop-hint {
	opacity: 1;
}

/* ---------------- SCROLLBAR ---------------- */

.sac-messages::-webkit-scrollbar {
	width: 8px;
}

.sac-messages::-webkit-scrollbar-track {
	background: transparent;
}

.sac-messages::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 999px;
}

.sac-messages::-webkit-scrollbar-thumb:hover {
	background: #9ca3af;
}

/* ---------------- AI GENERATED IMAGE ---------------- */

.sac-ai-image {
	display: block;
	max-width: 100%;
	width: auto;
	height: auto;
	border-radius: 12px;
	margin: 4px 0 8px;
	cursor: zoom-in;
	border: 1px solid rgba(0, 0, 0, .08);
	box-shadow: 0 4px 14px rgba(16, 24, 40, .10);
}

.sac-image-caption {
	font-size: 12.5px;
	color: var(--sac-muted);
	font-style: italic;
	margin-top: 2px;
	line-height: 1.4;
}

/* ---------------- MULTIPLE UPLOADED IMAGES ---------------- */

.sac-msg-images {
	display: grid;
	gap: 6px;
	margin: 2px 0 8px;
}

.sac-msg-images-1 {
	display: grid;
	grid-template-columns: 1fr;
	max-width: 260px;
}

.sac-msg-images-1 img {
	width: 100%;
	height: auto;
	border-radius: 10px;
	cursor: zoom-in;
	border: 1px solid rgba(0, 0, 0, .08);
	display: block;
}

.sac-msg-images-2 {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	max-width: 320px;
}

.sac-msg-images-3 {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	max-width: 400px;
}

.sac-msg-images-2 img,
.sac-msg-images-3 img {
	width: 100%;
	height: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 10px;
	cursor: zoom-in;
	border: 1px solid rgba(0, 0, 0, .08);
	display: block;
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 782px) {
	.sac-app {
		height: calc(100vh - 90px);
		height: calc(100dvh - 90px);
		min-height: 420px;
		margin: 10px auto;
		border-radius: 14px;
		font-size: 15px;
	}

	.sac-header {
		padding: 12px 14px;
	}

	.sac-title {
		font-size: 15px;
	}

	.sac-subtitle {
		display: none;
	}

	.sac-new {
		padding: 8px 12px;
		font-size: 13px;
	}

	.sac-messages {
		padding: 16px 12px;
	}

	.sac-bubble {
		max-width: 88%;
		padding: 10px 13px;
	}

	.sac-avatar {
		width: 28px;
		height: 28px;
		font-size: 10px;
	}

	.sac-composer {
		padding: 10px 10px 12px;
	}

	.sac-send {
		padding: 10px 14px;
	}

	.sac-msg-img {
		max-width: 200px;
	}

	.sac-welcome {
		padding: 16px 4px 6px;
	}

	.sac-welcome h2 {
		font-size: 17px;
	}

	.sac-ai-image {
		max-width: 100%;
	}

	.sac-msg-images-1 {
		max-width: 220px;
	}

	.sac-msg-images-3 {
		max-width: 100%;
	}
}

@media (max-width: 420px) {
	.sac-subtitle { display: none; }

	.sac-chip {
		font-size: 12.5px;
		padding: 7px 12px;
	}
}
/* ====== EFEK 3D untuk Kotak AI ====== */
.sac-app {
    /* Bayangan berlapis untuk kesan timbul 3D */
    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.05),
        0 8px 24px rgba(16, 24, 40, 0.15),
        0 20px 48px rgba(16, 24, 40, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -2px 6px rgba(0, 0, 0, 0.06) !important;

    /* Garis tepi tipis biar makin tegas */
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: 18px;

    /* Efek transform biar kelihatan melayang */
    transform: perspective(1200px) translateZ(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Saat di-hover, kotak naik sedikit (efek 3D hidup) */
.sac-app:hover {
    transform: perspective(1200px) translateY(-4px) translateZ(0);
    box-shadow:
        0 4px 8px rgba(16, 24, 40, 0.08),
        0 16px 32px rgba(16, 24, 40, 0.18),
        0 28px 60px rgba(16, 24, 40, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -2px 8px rgba(0, 0, 0, 0.08) !important;
}