:root {
    --sidebar-bg: #111111;
    --main-bg: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --input-bg: rgba(45, 45, 45, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent-color: #ed1c24; /* IKMI Red */
    --accent-hover: #c4161d;
    --btn-hover: rgba(255, 255, 255, 0.05);
    --user-bubble: #ed1c24;
    --ai-bubble: #2d2d2d;
    --font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--main-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-right: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    position: relative;
}

/* Sidebar Overlay Mode for narrow screens/widgets */
@media (max-width: 800px) {
    .sidebar {
        position: absolute;
        height: 100%;
        left: 0;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }
    
    .sidebar.hidden {
        left: -280px;
        opacity: 0;
        pointer-events: none;
    }
}

/* Fallback for when not using media query logic */
.sidebar.hidden {
    margin-left: -280px;
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    margin-bottom: 24px;
}

.lang-switcher {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.mt-4 { margin-top: 1.5rem !important; }

.lang-btn {
    background: var(--btn-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(237, 28, 36, 0.3);
}

.new-chat-btn {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(237, 28, 36, 0.2);
}

.new-chat-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(237, 28, 36, 0.3);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
}

.group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: 10px 0;
    font-weight: 700;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.history-item:hover, .history-item.active {
    background: var(--btn-hover);
    color: var(--text-primary);
}

.history-item i {
    font-size: 14px;
    opacity: 0.7;
}

.user-menu {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-item:hover {
    background: var(--btn-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #5436da, #8a36da);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
}

/* Main Area Styles */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at 50% 50%, #1e1e1e 0%, #151515 100%);
}

.chat-header {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    background: rgba(26, 26, 26, 0.8);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-wrapper {
    position: relative;
}

.lang-dropdown {
    position: absolute;
    top: 50px;
    left: 0;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 240px;
    padding: 15px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    z-index: 2000;
    animation: slideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.lang-dropdown.active {
    display: flex;
}

.dropdown-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 1px;
    font-weight: 700;
}

.lang-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lang-opt-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.lang-opt-btn:hover {
    background: var(--accent-color);
    transform: translateX(5px);
}

.lang-opt-btn img {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
}

.model-badge {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 10px #4ade80;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0 140px 0;
    scroll-behavior: smooth;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    text-align: center;
    padding: 40px 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.avatar-large {
    width: 100px;
    height: 100px;
    margin-bottom: 24px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-color);
    background: white;
    box-shadow: 0 10px 30px rgba(237, 28, 36, 0.2);
    position: relative;
}

.avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.welcome-screen h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(to right, #fff, #a0a0a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-screen p {
    color: var(--text-secondary);
    margin-bottom: 48px;
    max-width: 500px;
    font-size: 16px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    width: 100%;
    padding: 0 10px;
}

.suggestion-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.suggestion-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.suggestion-card p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.suggestion-card i {
    color: var(--accent-color);
    font-size: 14px;
    opacity: 0.6;
    flex-shrink: 0;
    margin-left: 10px;
}

/* Chat Footer Styles */
.chat-footer {
    padding: 15px 20px 25px;
    position: relative;
    width: 100%;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.input-wrapper {
    max-width: 800px;
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-end;
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    transition: border-color 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--accent-color);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    resize: none;
    outline: none;
    padding: 8px 12px;
    font-size: 16px;
    max-height: 150px;
    line-height: 1.5;
    font-family: inherit;
}

.input-wrapper button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: var(--accent-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.input-wrapper button:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.input-wrapper button:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: default;
}

.disclaimer {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 12px;
    opacity: 0.6;
}

/* Elegant Message Bubble Styles */
.message {
    padding: 10px 30px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-msg { align-items: flex-end; }
.ai-msg { align-items: flex-start; }

.message-inner {
    max-width: 80%;
    display: flex;
    gap: 16px;
}

.user-msg .message-inner { flex-direction: row-reverse; }

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    overflow: hidden;
    background: white;
}

.user-msg .msg-avatar {
    background: linear-gradient(135deg, #5436da, #8a36da);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.msg-content {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.user-msg .msg-content {
    background: var(--accent-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-msg .msg-content {
    background: var(--ai-bubble);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.msg-content p { margin-bottom: 8px; }
.msg-content p:last-child { margin-bottom: 0; }

/* Typing Animation */
.typing-dots {
    display: flex;
    gap: 5px;
    padding: 5px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

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

.header-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: var(--btn-hover);
    color: white;
    border-color: var(--text-primary);
}

/* WIDGET MODE (Kaidah Desain Chatbot) */
.widget-mode .sidebar {
    display: none;
}

.widget-mode .chat-area {
    border-radius: 0;
}

.widget-mode .sidebar-toggle {
    display: none;
}

/* Floating Toggle Button */
.floating-chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 22px;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(237, 28, 36, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1001;
    border: none;
}

.floating-chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--accent-hover);
}

.floating-chat-toggle i {
    transition: transform 0.4s;
}

.floating-chat-toggle.active i {
    transform: rotate(90deg);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: -280px;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .suggestions {
        grid-template-columns: 1fr;
    }
    
    .message-inner {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .widget-mode {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}

