/* ==========================================================================
   PhibiChubi-AI Custom Character Color Palette CSS Design System
   Palette Specifications:
   - #000000: Hitam Pekat (Garis Tepi)
   - #FFFFFF: Putih (Pakaian & Pupil)
   - #ECE6BB: Kuning Pucat/Krem (Rambut)
   - #9C85BF: Ungu Pastel (Mata)
   - #3D3A63: Biru Tua keunguan (Aksen)
   - #0097DA: Biru Cerah (Aksen Pakaian)
   - #3A5C9C: Biru Steel (Aksen Rambut)
   ========================================================================== */

:root {
    --color-black: #000000;
    --color-white: #FFFFFF;
    --color-cream: #ECE6BB;
    --color-purple: #9C85BF;
    --color-dark-violet: #3D3A63;
    --color-bright-blue: #0097DA;
    --color-steel-blue: #3A5C9C;

    --bg-dark-main: #0a0912;
    --bg-dark-sidebar: #131120;
    --bg-dark-card: #1c1a2e;
    --bg-dark-input: #232039;
    --bg-dark-hover: #2b2746;
    
    --border-subtle: #2b2746;
    --border-light: #3A5C9C;
    
    --accent-emerald: var(--color-bright-blue);
    --accent-indigo: var(--color-purple);
    --accent-cyan: var(--color-cream);
    --accent-pink: #ef4444;
    
    --text-primary: #FFFFFF;
    --text-secondary: #e2ddf2;
    --text-muted: #9590b3;
    
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-code: 'Fira Code', monospace;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
    
    --transition: all 0.18s ease;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* App Layout */
.chatgpt-app {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Buttons Common */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

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

.new-chat-btn {
    background: var(--color-dark-violet);
    border: 1px solid var(--color-steel-blue);
    color: var(--text-primary);
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.new-chat-btn:hover {
    background: var(--color-bright-blue);
    border-color: var(--color-bright-blue);
    color: #ffffff;
}

/* Left Sidebar Styles (Model Inspector Panel) */
.chat-sidebar {
    width: 300px;
    background-color: var(--bg-dark-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 20;
    transition: transform 0.25s ease, margin-left 0.25s ease;
    flex-shrink: 0;
}

.chat-sidebar.collapsed {
    margin-left: -300px;
}

.sidebar-top {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.sidebar-header-title {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
}

.sidebar-icon {
    color: var(--color-purple);
    display: flex;
    align-items: center;
}

.sidebar-scroll-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-scroll-body::-webkit-scrollbar {
    width: 5px;
}

.sidebar-scroll-body::-webkit-scrollbar-thumb {
    background: var(--color-dark-violet);
    border-radius: 3px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-cream);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(156, 133, 191, 0.2);
    color: var(--color-purple);
    border: 1px solid rgba(156, 133, 191, 0.4);
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
}

.setting-val {
    font-family: var(--font-code);
    color: var(--color-bright-blue);
}

.setting-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Global Custom Dark Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark-sidebar);
}

::-webkit-scrollbar-thumb {
    background: var(--color-dark-violet);
    border-radius: 4px;
    border: 1px solid var(--bg-dark-sidebar);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-steel-blue);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-dark-violet) var(--bg-dark-sidebar);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--color-dark-violet);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-bright-blue);
    border: 2px solid var(--color-white);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 151, 218, 0.5);
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--color-purple);
}

.chatgpt-select {
    width: 100%;
    background-color: var(--bg-dark-card);
    border: 1px solid var(--color-steel-blue);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    outline: none;
    font-family: var(--font-body);
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239C85BF' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    transition: var(--transition);
}

.chatgpt-select:hover, .chatgpt-select:focus {
    border-color: var(--color-bright-blue);
    background-color: var(--bg-dark-hover);
}

.chatgpt-select option {
    background-color: var(--bg-dark-card);
    color: var(--text-primary);
    padding: 8px;
}

/* Inspector Drawer Empty & Content */
.inspector-drawer-empty {
    background: rgba(61, 58, 99, 0.2);
    border: 1px dashed var(--color-steel-blue);
    border-radius: var(--radius-sm);
    padding: 20px 14px;
    text-align: center;
}

.empty-state-box {
    color: var(--text-muted);
    font-size: 12px;
}

.empty-icon {
    display: block;
    margin-bottom: 6px;
    color: var(--color-purple);
}

.prob-steps-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.prob-steps-wrapper::-webkit-scrollbar {
    width: 5px;
}

.prob-steps-wrapper::-webkit-scrollbar-thumb {
    background: var(--color-steel-blue);
    border-radius: 3px;
}

.step-card {
    background: var(--bg-dark-card);
    border: 1px solid var(--color-steel-blue);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.step-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.prob-bars-column {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.prob-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.p-tok {
    width: 44px;
    font-family: var(--font-code);
    color: var(--color-cream);
}

.p-track {
    flex: 1;
    height: 6px;
    background: var(--color-dark-violet);
    border-radius: 3px;
    overflow: hidden;
}

.p-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-bright-blue), var(--color-purple));
    border-radius: 3px;
}

.p-pct {
    width: 36px;
    text-align: right;
    font-family: var(--font-code);
    color: var(--text-muted);
}

/* Spec Grid */
.spec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.spec-card {
    background: var(--bg-dark-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.spec-lbl {
    font-size: 10.5px;
    color: var(--text-muted);
    display: block;
}

.spec-val {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.spec-val.highlight {
    color: var(--color-cream);
    font-size: 11.5px;
}

.vocab-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.layer-breakdown-box {
    background: var(--bg-dark-card);
    border: 1px solid var(--color-steel-blue);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 6px;
}

.breakdown-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-cream);
    display: block;
    margin-bottom: 6px;
}

.layer-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.layer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.layer-row span {
    color: var(--text-secondary);
    font-family: var(--font-code);
}

.layer-row small {
    color: var(--text-muted);
    font-family: var(--font-body);
}

.layer-row code {
    font-family: var(--font-code);
    color: var(--color-bright-blue);
    font-size: 10.5px;
}

.v-pill {
    font-family: var(--font-code);
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--color-dark-violet);
    color: var(--text-secondary);
}

.v-pill.green {
    background: rgba(0, 151, 218, 0.2);
    color: var(--color-bright-blue);
    border: 1px solid var(--color-steel-blue);
}

/* Main Workspace */
.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-dark-main);
    position: relative;
    overflow: hidden;
}

/* Top Header Bar */
.chat-header {
    height: 54px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-dark-sidebar);
    z-index: 10;
}

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

#sidebar-open-btn {
    display: none;
}

.chat-sidebar.collapsed ~ .main-workspace #sidebar-open-btn {
    display: flex;
}

.model-selector-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.model-selector-dropdown:hover {
    background: var(--bg-dark-hover);
}

.model-name {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.model-tech-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(0, 151, 218, 0.18);
    color: var(--color-bright-blue);
    border: 1px solid var(--color-steel-blue);
}

.chevron-icon {
    color: var(--text-muted);
}

/* Chat Viewport */
.chat-viewport {
    flex: 1;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 140px;
}

.chat-viewport::-webkit-scrollbar {
    width: 6px;
}

.chat-viewport::-webkit-scrollbar-thumb {
    background: var(--color-dark-violet);
    border-radius: 3px;
}

/* Welcome Hero Section */
.welcome-hero {
    max-width: 800px;
    width: 100%;
    margin: auto 0;
    padding: 30px 24px 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hero-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-logo-glowing {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    position: relative;
}

.hero-pfp-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-purple);
    box-shadow: 0 0 24px rgba(156, 133, 191, 0.45);
}

.assistant-pfp-img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--color-steel-blue);
    box-shadow: 0 0 10px rgba(58, 92, 156, 0.3);
    transition: var(--transition);
}

.thinking-pulse {
    animation: pfpPulse 1.2s infinite ease-in-out;
}

@keyframes pfpPulse {
    0% { box-shadow: 0 0 4px var(--color-purple); transform: scale(0.96); }
    50% { box-shadow: 0 0 16px var(--color-bright-blue); transform: scale(1.05); }
    100% { box-shadow: 0 0 4px var(--color-purple); transform: scale(0.96); }
}

.thinking-loader {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    vertical-align: middle;
}

.thinking-loader .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--color-bright-blue);
    animation: dotBounce 1.2s infinite ease-in-out;
}

.thinking-loader .dot:nth-child(2) {
    animation-delay: 0.2s;
    background-color: var(--color-purple);
}

.thinking-loader .dot:nth-child(3) {
    animation-delay: 0.4s;
    background-color: var(--color-cream);
}

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.2); opacity: 1; }
}

.thinking-label {
    font-size: 13.5px;
    color: var(--text-muted);
    font-style: italic;
}

.typewriter-cursor {
    display: inline-block;
    color: var(--color-bright-blue);
    font-weight: 700;
    margin-left: 2px;
    animation: cursorBlink 0.6s infinite alternate;
}

@keyframes cursorBlink {
    from { opacity: 1; }
    to { opacity: 0; }
}

.fade-in {
    animation: fadeInFast 0.3s ease-out forwards;
}

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

.hero-brand h2 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 600;
    color: var(--color-white);
    letter-spacing: -0.4px;
}

.hero-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 6px;
    margin-bottom: 28px;
    max-width: 540px;
    line-height: 1.5;
}

.hero-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.prompt-card {
    background: var(--bg-dark-card);
    border: 1px solid var(--color-dark-violet);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.prompt-card:hover {
    background: var(--bg-dark-hover);
    border-color: var(--color-steel-blue);
    transform: translateY(-2px);
}

.card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--color-dark-violet);
    border: 1px solid var(--color-steel-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-purple);
    transition: var(--transition);
}

.prompt-card:hover .card-icon {
    background: var(--color-steel-blue);
    color: var(--color-white);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.card-desc code {
    font-family: var(--font-code);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(236, 230, 187, 0.15);
    color: var(--color-cream);
    border: 1px solid rgba(236, 230, 187, 0.3);
}

/* Messages List */
.messages-list {
    width: 100%;
    max-width: 768px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.chatgpt-row {
    display: flex;
    gap: 14px;
}

.chatgpt-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatgpt-row.user .chatgpt-avatar {
    background: var(--color-dark-violet);
    color: var(--color-cream);
    border: 1px solid var(--color-steel-blue);
}

.chatgpt-row.assistant .chatgpt-avatar {
    background: transparent;
}

.chatgpt-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatgpt-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.chatgpt-text {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
}

.chatgpt-text.thinking {
    color: var(--text-muted);
    font-style: italic;
}

.tokens-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.t-badge {
    font-family: var(--font-code);
    font-size: 11.5px;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(0, 151, 218, 0.18);
    color: var(--color-bright-blue);
    border: 1px solid var(--color-steel-blue);
}

.t-badge.eos {
    background: rgba(239, 68, 68, 0.18);
    color: var(--accent-pink);
    border-color: rgba(239, 68, 68, 0.3);
}

.chatgpt-meta {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.meta-item svg {
    color: var(--color-purple);
}

.error-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Floating Input Dock */
.chat-input-dock {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0 20px 18px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(to top, var(--bg-dark-main) 75%, transparent);
    z-index: 10;
}

.input-container-pill {
    max-width: 768px;
    width: 100%;
    background: var(--bg-dark-input);
    border: 1px solid var(--color-steel-blue);
    border-radius: var(--radius-lg);
    padding: 10px 14px 10px 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.input-container-pill:focus-within {
    border-color: var(--color-bright-blue);
    box-shadow: 0 4px 24px rgba(0, 151, 218, 0.25);
}

.chat-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

#prompt-textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14.5px;
    resize: none;
    max-height: 140px;
    min-height: 24px;
    line-height: 1.5;
}

#prompt-textarea::-webkit-scrollbar {
    width: 4px;
}

#prompt-textarea::-webkit-scrollbar-thumb {
    background: var(--color-steel-blue);
    border-radius: 2px;
}

#prompt-textarea::placeholder {
    color: var(--text-muted);
}

.send-circle-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-bright-blue);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-circle-btn:hover {
    background: var(--color-purple);
}

.send-circle-btn:disabled {
    background: var(--color-dark-violet);
    color: var(--text-muted);
    cursor: not-allowed;
}

.disclaimer-text {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

.disclaimer-text code {
    font-family: var(--font-code);
    color: var(--color-cream);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    .chat-sidebar.active-mobile {
        transform: translateX(0);
    }
    #sidebar-open-btn {
        display: flex !important;
    }
    .hero-cards-grid {
        grid-template-columns: 1fr;
    }
}
