/* Root Variables untuk mudahkan tukar tema */
:root {
    --primary-color: #1a73e8;
    --sidebar-bg: #ffffff;
    --sidebar-text: #444746;
    --main-bg: #f8f9fa;
    --card-bg: #ffffff;
    --user-msg: #e7f0fe;
    --ai-msg: #f1f3f4;
    --border-color: #dee2e6;
}

* { box-sizing: border-box; }

body {
    font-family: 'Muli', sans-serif;
    margin: 0;
    display: flex;
    height: 100vh;
    background-color: var(--main-bg);
    color: #1f1f1f;
}

h1 {
	font-size: 1.5rem; color: #1a73e8;
}

/* Tombol Menu Mobile */
.mobile-nav {
    display: none;
    background: #ffffff;
    color: #444;
    padding: 10px 20px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.menu-btn {
    cursor: pointer;
    font-size: 18px;
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
}

/* Sidebar (Kiri) - Wajah Baru */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    border-right: 1px solid var(--border-color);
}

.sidebar h2 { 
    font-size: 1rem; 
    margin-top: 0px; 
    margin-bottom: 10px; 
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 25px;
    background-color: transparent;
    transition: 0.2s;
    font-size: 14px;
    border: 1px solid transparent;
	margin-bottom: 2px;
}

.sidebar a:hover { 
    background-color: #f0f2f5; 
    color: var(--primary-color);
}

/* Highlight untuk sesi aktif */
.sidebar a.active {
    background-color: #e8f0fe;
    color: var(--primary-color);
    font-weight: bold;
}

.center {
	text-align:center;
}

.sidebar img {
	max-width:100px;
	max-height:100px;
}

.session-badge {
	position: absolute;
	top: 20px;
	right: 30px;
	background: #e8f0fe;
	color: #1a73e8;
	padding: 5px 15px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	border: 1px solid #c2d7ff;
}
.project-list {
	list-style: none;
	padding: 0;
	margin: 10px 0;
}
.project-item {
	display: block;
	padding: 10px 15px;
	margin-bottom: 2px;
	border-radius: 8px;
	background: #f1f3f4;
	color: #444;
	text-decoration: none;
	font-size: 13px;
	transition: 0.3s;
	border: 1px solid transparent;
}
.project-item:hover {
	background: #e8f0fe;
	border-color: #1a73e8;
}
.project-item.active {
	background: #1a73e8;
	color: white;
}
		
/* Ruang Kerja (Kanan) */
.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center; /* Supaya content duduk tengah macam AI */
	height: 100vh;
}

.container { 
    width: 100%;
    max-width: 850px; /* Lebar optimum untuk membaca */
	flex: 1; 
	overflow-y: auto; 
	background: transparent; 
    scrollbar-width: none; /* Untuk Firefox */
    -ms-overflow-style: none; /* Untuk Internet Explorer/Edge */
	
	height: 70vh; /* Hadkan tinggi kawasan chat */
    display: flex;
    flex-direction: column;
    padding: 20px;
    scroll-behavior: smooth; /* Tambahan untuk kelancaran scroll */
}

/* Gaya Mesej/Result (Gaya Bubble) */
.result { 
    margin-top: 20px; 
    padding: 20px; 
    line-height: 1.6;
    font-size: 15px;
    color: #3c4043;
    position: relative;
	max-width: 80%; 
	padding-bottom: 40px;
}

.result-user { 
	background: #e7f0fe; 
	align-self: flex-end; 
	margin-left: auto; 
	border-radius: 15px 15px 2px 15px;
}

.result-assistant { 
	background: #ffffff; 
	border: 1px solid #dee2e6; 
	border-radius: 15px 15px 15px 2px;
}

/* Form Styling */
textarea { 
	width: 100%; 
    min-height: 50px; 
    max-height: 400px; 
    padding: 12px 45px 12px 15px; /* Ruang kanan dilebihkan supaya teks tak berlapis dengan butang ➤ */
    margin-bottom: 0; 
    border: none; /* Kita buang border sebab form dah ada border */
    outline: none;
    font-size: 15px;
    line-height: 1.5;
    resize: none; 
    
    /* INI KUNCI UNTUK BUANG SCROLLER */
    overflow-y: hidden; 
    scrollbar-width: none; /* Untuk Firefox */
    -ms-overflow-style: none; /* Untuk Internet Explorer/Edge */
}

textarea::-webkit-scrollbar {
    display: none;
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

input, select { 
    padding: 10px; 
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
}

button { 
    background: var(--primary-color); 
    color: white; 
    border: none; 
    padding: 12px 25px; 
    cursor: pointer;
    font-weight: 600;
    border-radius: 25px;
    transition: 0.3s;
}

button:hover {
    background: #1557b0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.button-msg {
	position: absolute; 
	right: 10px; 
	bottom: 18px; 
	border-radius: 50%; 
	width: 40px; 
	height: 40px; 
	padding: 0;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent; 
    border: none;             
    cursor: pointer;
    font-size: 18px;          
    color: #bdc3c7;           
    padding: 5px;
    line-height: 1;
    transition: all 0.2s ease;
    outline: none;
}

/* Bila mouse over pada butang */
.copy-btn:hover {
    color: #FFFFFF;           
    transform: scale(1.2);    
}

.copy-text {
    display: block;
    padding-right: 30px;      
}

.footer {
	text-align: center; 
	font-size: 11px; 
	color: #999; 
	margin-top: 5px;
}

.ai-generated-img {
    width: 100%;
    max-width: 512px; /* Saiz standard imej AI */
    border-radius: 12px;
    display: block;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
	cursor: zoom-in;
    transition: transform 0.3s ease;
}

.ai-generated-img:active {
    transform: scale(1.5); /* Gambar jadi besar bila Puan tekan lama sikit */
    z-index: 9999;
    position: relative;
}

.img-bubble {
    background: #ffffff !important;
    border: 1px solid #eee !important;
}

.image-wrapper {
    position: relative;
    display: inline-block;
}

.img-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.action-btn {
    text-decoration: none;
    font-size: 12px;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 20px;
    color: #555;
    transition: 0.3s;
}

.action-btn:hover {
    background: #e8f0fe;
    color: #1a73e8;
    border-color: #1a73e8;
}

.result-user span {
    font-style: italic;
    color: #666;
}

.size-option {
    cursor: pointer;
    font-size: 12px;
}
.size-option input {
    display: none; /* Sembunyikan radio asal */
}
.size-option span {
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 15px;
    background: #f8f9fa;
    color: #555;
    transition: 0.3s;
}
.size-option input:checked + span {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

/* Spinner bulat */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sembunyikan loading secara default */
#loading-area {
    display: none;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 15px;
    margin-top: 10px;
    font-size: 13px;
    color: #666;
    border: 1px dashed #ddd;
}

/* Responsive Breakpoint */
@media (max-width: 768px) {
    .mobile-nav { display: flex; justify-content: space-between; align-items: center; }
    
    .sidebar {
        position: fixed;
        left: -280px; 
        top: 55px;
        bottom: 0;
        z-index: 999;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    }

    .sidebar.active { left: 0; }

    .main-content {
        margin-top: 55px;
        padding: 15px;
    }
    
    .container { padding: 20px; }
}