/* ==========================================================================
   MODERN MINIMAL — Clean, airy, purposeful
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg:          #ffffff;
    --bg-subtle:   #f4f9f4; /* Sage Green */
    --bg-hover:    #ecf3ec;
    --surface:     #ffffff;

    --border:      #d0dfd7; /* Pale Sage border */
    --border-mid:  #b3cbbd;

    --text:        #1a2e26; /* Charcoal Green */
    --text-2:      #536c61; /* Muted Sage Green */
    --text-3:      #8ba89a; /* Pale text */

    --accent:      #006644; /* Forest Green / Dark Teal */
    --accent-2:    #004d33; /* Darker Forest Green hover */
    --accent-inv:  #ffffff;

    /* Level colors — beautiful teal/emerald range */
    --l0: #006644;
    --l1: #0e7490; /* Teal-blue */
    --l2: #15803d; /* Emerald */
    --l3: #0369a1; /* Sky-blue */
    --l4: #b45309; /* Amber */

    --radius-sm:  6px;
    --radius:     12px;
    --radius-lg:  16px;

    --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-header: 'Outfit', sans-serif;
    --chat-width: 340px;
    --drawer-width: 780px;

    --shadow-xs: 0 1px 2px rgba(0, 102, 68, 0.04);
    --shadow-sm: 0 1px 4px rgba(0, 102, 68, 0.06), 0 0 0 1px rgba(0, 102, 68, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 102, 68, 0.06), 0 0 0 1px rgba(0, 102, 68, 0.03);
    --shadow-lg: 0 8px 24px rgba(0, 102, 68, 0.08), 0 0 0 1px rgba(0, 102, 68, 0.03);

    --t: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Green Emerald Mobile variables */
    --primary-green: #00a374;
    --primary-green-dark: #0d5240;
    --primary-green-light: #e6f7f3;
    --bg-mobile: #f4f6f5;
}


/* ==========================================================================
   BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    background: var(--bg-subtle);
    color: var(--text);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; font-size: inherit; border: none; outline: none; }
a { color: var(--l1); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 4px; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.chat-sidebar {
    width: var(--chat-width);
    flex-shrink: 0;
    height: 100%;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: margin-left var(--t);
}

.chat-sidebar.collapsed { margin-left: calc(-1 * var(--chat-width)); }

.mindmap-main {
    flex-grow: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: var(--bg-subtle);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
    padding: 0 1rem;
    height: 52px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logo-area { display: flex; align-items: center; gap: 8px; }

.logo-emoji { font-size: 1.25rem; line-height: 1; }

.logo-text h1 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
}

.logo-text p {
    font-size: 0.68rem;
    color: var(--text-3);
    font-weight: 400;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn i { width: 16px; height: 16px; }

/* ==========================================================================
   CHAT MESSAGES
   ========================================================================== */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-bubble {
    max-width: 90%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    line-height: 1.55;
    animation: fade-up 0.2s ease forwards;
}

.bot-message {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 3px;
    color: var(--text);
}

.user-message {
    background: var(--accent);
    color: var(--accent-inv);
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.message-time {
    display: block;
    font-size: 0.65rem;
    margin-top: 4px;
    text-align: right;
    color: var(--text-3);
}

.user-message .message-time { color: rgba(255,255,255,0.5); }

/* Thinking */
.thinking-bubble {
    align-self: flex-start;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-bottom-left-radius: 3px;
    padding: 0.6rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-dots { display: flex; gap: 3px; align-items: center; }

.typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--text-3);
    border-radius: 50%;
    animation: typing-animation 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

/* ==========================================================================
   CHAT INPUT
   ========================================================================== */
.chat-input-wrapper {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.api-warning {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    background: #fefce8;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.api-warning i { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }
.api-warning.hidden { display: none !important; }

.chat-form {
    display: flex;
    gap: 6px;
    align-items: center;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px 3px 3px 10px;
    transition: border-color var(--t), box-shadow var(--t);
}

.chat-form:focus-within {
    border-color: var(--accent);
    background: var(--bg);
    box-shadow: 0 0 0 3px rgba(24,24,27,0.06);
}

.chat-form input {
    flex-grow: 1;
    background: transparent;
    color: var(--text);
    padding: 5px 0;
    font-size: 0.85rem;
}

.chat-form input::placeholder { color: var(--text-3); }

.send-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-inv);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity var(--t);
    flex-shrink: 0;
}

.send-btn:hover { opacity: 0.8; }
.send-btn i { width: 14px; height: 14px; }

/* ==========================================================================
   MINDMAP CANVAS
   ========================================================================== */
.mindmap-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: grab;
}

.mindmap-canvas-container:active { cursor: grabbing; }
.mindmap-svg { width: 100%; height: 100%; }

.mindmap-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-3);
    font-size: 0.83rem;
    text-align: center;
    max-width: 240px;
    pointer-events: none;
    transition: opacity var(--t);
}

.mindmap-hint i { width: 24px; height: 24px; opacity: 0.4; }
.mindmap-hint.hidden { opacity: 0; }

/* ==========================================================================
   D3 NODES
   ========================================================================== */
.link {
    fill: none;
    stroke: var(--border-mid);
    stroke-width: 1.5px;
    stroke-linecap: round;
}

.link.active { stroke: var(--l1); stroke-width: 1.5px; }

.node-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
    position: relative;
    user-select: none;
}

.node-card:hover {
    border-color: var(--border-mid);
    background: var(--bg-hover);
    box-shadow: var(--shadow-sm);
}

.node-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
    letter-spacing: -0.1px;
}

.node-desc {
    font-size: 0.68rem;
    color: var(--text-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    margin-top: 3px;
}

/* Level accent — left border color only */
.node-card.level-0 { border-left: 3px solid var(--l0); }
.node-card.level-0 .node-title { color: var(--l0); }
.node-card.level-1 { border-left: 3px solid var(--l1); }
.node-card.level-1 .node-title { color: var(--l1); }
.node-card.level-2 { border-left: 3px solid var(--l2); }
.node-card.level-2 .node-title { color: var(--l2); }
.node-card.level-3 { border-left: 3px solid var(--l3); }
.node-card.level-3 .node-title { color: var(--l3); }

/* Status dot */
.node-card::after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 6px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border-mid);
}

.node-card.status-doing::after { background: #f59e0b; }
.node-card.status-done::after  { background: #22c55e; }

.node-card.loading {
    animation: pulse 1.5s infinite ease-in-out;
}

/* ==========================================================================
   FLOATING CONTROLS
   ========================================================================== */
.floating-controls {
    position: absolute;
    bottom: 1.25rem;
    left: 1.25rem;
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 5;
    box-shadow: var(--shadow-md);
}

.control-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.control-btn:hover { background: var(--bg-hover); color: var(--text); }
.control-btn i { width: 14px; height: 14px; }

.floating-controls .divider {
    width: 1px;
    background: var(--border);
    margin: 4px 2px;
    align-self: stretch;
}

/* ==========================================================================
   DETAIL DRAWER
   ========================================================================== */
.drawer-resize-handle {
    position: absolute;
    top: 0;
    left: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}

.drawer-resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    width: 2px;
    height: 32px;
    background: var(--border-mid);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.drawer-resize-handle:hover::after,
.detail-drawer.resizing .drawer-resize-handle::after {
    opacity: 1;
}

.detail-drawer.resizing {
    transition: none;
    user-select: none;
}

.detail-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--drawer-width);
    height: 100%;
    background: var(--bg);
    border-left: 1px solid var(--border);
    z-index: 8;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.detail-drawer.open { transform: translateX(0); }

.drawer-header {
    padding: 0 1.25rem;
    height: 52px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 1rem;
}

.drawer-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.node-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.drawer-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem 1.25rem;
}

/* Markdown */
.markdown-body {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text);
}

.markdown-body h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
}

.markdown-body p { margin-bottom: 0.8rem; color: var(--text-2); }
.markdown-body ul, .markdown-body ol { padding-left: 1.5rem; margin-bottom: 0.8rem; }
.markdown-body ul ul, .markdown-body ul ol, .markdown-body ol ul, .markdown-body ol ol { padding-left: 1.25rem; margin-top: 0.25rem; margin-bottom: 0; }
.markdown-body li { margin-bottom: 0.25rem; color: var(--text-2); }

.markdown-body code {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    color: var(--l3);
}

.markdown-body pre {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
    font-size: 0.8rem;
}

.markdown-body blockquote {
    border-left: 3px solid var(--border-mid);
    padding-left: 1rem;
    margin-bottom: 0.8rem;
    color: var(--text-2);
    font-style: italic;
}

/* --- DRAWER NEW TWO-COLUMN LAYOUT & SIDE Q&A --- */
.drawer-main-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.drawer-col-materi {
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.drawer-col-qa {
    width: 440px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    background: var(--bg-subtle);
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
    opacity: 1;
    overflow: hidden;
    flex-shrink: 0;
}

.drawer-col-qa.collapsed {
    width: 0;
    border-left: none;
    opacity: 0;
    pointer-events: none;
}

.qa-header {
    padding: 0 1.25rem;
    height: 52px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    background: var(--bg);
}

.qa-header h3 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qa-header h3 i {
    width: 14px;
    height: 14px;
    color: var(--text-3);
}

.qa-content-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.qa-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.qa-messages-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-right: 2px;
}

.qa-bubble {
    font-size: 0.82rem;
    line-height: 1.55;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    max-width: 85%;
    animation: fade-up 0.15s ease forwards;
}

.qa-bubble.user {
    background: var(--accent);
    color: var(--accent-inv);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.qa-bubble.bot {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.qa-bubble.bot p {
    margin-bottom: 0;
    font-size: 0.82rem;
    color: var(--text);
}

.qa-bubble.bot h4 {
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0.2rem;
}

.qa-bubble.bot ul, .qa-bubble.bot ol {
    padding-left: 1.25rem;
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
}
.qa-bubble.bot li {
    margin-bottom: 0.25rem;
    color: var(--text);
}
.qa-bubble.bot ul ul, .qa-bubble.bot ul ol, .qa-bubble.bot ol ul, .qa-bubble.bot ol ol {
    padding-left: 1rem;
    margin-top: 0.2rem;
    margin-bottom: 0;
}

.drawer-qa-form {
    display: flex;
    gap: 6px;
    align-items: center;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 2px 2px 8px;
    transition: border-color var(--t), box-shadow var(--t);
}

.drawer-qa-form:focus-within {
    border-color: var(--accent);
    background: var(--bg);
    box-shadow: 0 0 0 2px rgba(24,24,27,0.05);
}

.drawer-qa-form input,
.drawer-qa-form textarea {
    flex-grow: 1;
    background: transparent;
    color: var(--text);
    padding: 4px 0;
    font-size: 0.8rem;
    border: none;
    outline: none;
}

.drawer-qa-form textarea {
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    height: 24px;
    max-height: 100px;
    overflow-y: auto;
}

.drawer-qa-form input::placeholder,
.drawer-qa-form textarea::placeholder {
    color: var(--text-3);
}

.qa-send-btn {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: var(--accent);
    color: var(--accent-inv);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity var(--t);
    flex-shrink: 0;
}

.qa-send-btn:hover {
    opacity: 0.85;
}

.qa-send-btn i {
    width: 12px;
    height: 12px;
}

.icon-btn.active {
    color: var(--l1);
    background: var(--bg-hover);
}

.drawer-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.progress-selector { display: flex; flex-direction: column; gap: 6px; }

.progress-selector span {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-options {
    display: flex;
    gap: 4px;
}

.status-btn {
    flex: 1;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--t), color var(--t);
    text-align: center;
    border: 1px solid transparent;
}

.status-btn:hover { background: var(--border); color: var(--text); }

.status-btn.active[data-status="todo"]  { background: var(--bg-hover); border-color: var(--border-mid); color: var(--text); }
.status-btn.active[data-status="doing"] { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.status-btn.active[data-status="done"]  { background: #dcfce7; border-color: #bbf7d0; color: #166534; }

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t);
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-card {
    width: 90%;
    max-width: 420px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.2s ease;
}

.modal-overlay.open .modal-card { transform: translateY(0) scale(1); }

.modal-header {
    padding: 0 1.25rem;
    height: 52px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-primary { color: var(--accent); }

.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-body > p { font-size: 0.83rem; color: var(--text-2); }

.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text);
    font-size: 0.85rem;
    transition: border-color var(--t), box-shadow var(--t);
    outline: none;
    font-family: inherit;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    background: var(--bg);
    box-shadow: 0 0 0 3px rgba(24,24,27,0.06);
}

.info-box {
    display: flex;
    gap: 8px;
    padding: 0.65rem 0.85rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--text-2);
}

.info-box i { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.btn-secondary {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    font-size: 0.83rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--t), color var(--t);
    border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }

.btn-primary {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-inv);
    font-size: 0.83rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--t);
}

.btn-primary:hover { opacity: 0.85; }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes typing-animation {
    0%, 100% { transform: translateY(0); opacity: 0.35; }
    50%       { transform: translateY(-3px); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

.sync-status {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-2);
    border: 1px solid var(--border);
    transition: all var(--t);
    white-space: nowrap;
}

/* ==========================================================================
   SIDEBAR LAYOUT MODES (HISTORY VS CHAT)
   ========================================================================== */
.chat-mode-header {
    display: none;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    align-items: center;
    flex-shrink: 0;
}

.back-to-history-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-2);
    font-weight: 500;
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--t), color var(--t);
}

.back-to-history-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.back-to-history-btn i {
    width: 14px;
    height: 14px;
}

/* History Mode active styles */
.chat-sidebar.mode-history .history-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    border-bottom: none;
}

.chat-sidebar.mode-history .history-content {
    flex-grow: 1;
    max-height: none;
    overflow-y: auto;
}

.chat-sidebar.mode-history .history-toggle-btn {
    cursor: default;
    pointer-events: none;
}

.chat-sidebar.mode-history .chevron-icon {
    display: none !important;
}

.chat-sidebar.mode-history .chat-mode-header,
.chat-sidebar.mode-history .chat-messages,
.chat-sidebar.mode-history .chat-input-wrapper {
    display: none !important;
}

/* Chat Mode active styles */
.chat-sidebar.mode-chat .history-section {
    display: none !important;
}

.chat-sidebar.mode-chat .chat-mode-header {
    display: flex;
}

.chat-sidebar.mode-chat .chat-messages {
    display: flex;
}

.chat-sidebar.mode-chat .chat-input-wrapper {
    display: block;
}

/* ==========================================================================
   HISTORY SECTION (SIDEBAR KIRI)
   ========================================================================== */
.history-section {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.history-toggle-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    cursor: pointer;
    color: var(--text);
    font-weight: 500;
    font-size: 0.8rem;
    transition: background var(--t);
}

.history-toggle-btn:hover {
    background: var(--bg-hover);
}

.history-toggle-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-toggle-title i {
    width: 15px;
    height: 15px;
    color: var(--text-2);
}

.chevron-icon {
    width: 14px;
    height: 14px;
    color: var(--text-3);
    transition: transform var(--t);
}

.history-toggle-btn.open .chevron-icon {
    transform: rotate(180deg);
}

.history-content {
    padding: 0 0.75rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.history-content.hidden {
    display: none;
}

.new-topic-btn {
    width: 100%;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px dashed var(--border-mid);
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
}

.new-topic-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-3);
    color: var(--text);
}

.new-topic-btn i {
    width: 12px;
    height: 12px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background var(--t);
    text-align: left;
}

.history-item:hover {
    background: var(--bg-hover);
}

.history-item.active {
    background: var(--bg-subtle);
    border-left: 3px solid var(--accent);
    padding-left: 7px;
}

.history-item-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex-grow: 1;
}

.history-item-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-date {
    font-size: 0.65rem;
    color: var(--text-3);
    margin-top: 2px;
}

.history-item-delete {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: transparent;
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--t), color var(--t), background var(--t);
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

.history-item-delete i {
    width: 12px;
    height: 12px;
}

/* ==========================================================================
   NODE COLLAPSE/EXPAND STYLES
   ========================================================================== */
.node-card.is-collapsed {
    border-style: dashed !important;
    background: var(--bg-subtle) !important;
}

.node-card.has-children {
    padding-right: 28px !important;
}

.collapse-toggle {
    position: absolute;
    right: 8px; /* Di dalam card agar tidak terpotong oleh foreignObject */
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow-xs);
    transition: background var(--t), border-color var(--t), transform var(--t);
}

.collapse-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--text-2);
    transform: translateY(-50%) scale(1.1);
}

.collapse-toggle i {
    width: 10px;
    height: 10px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   FASE 5: RESPONSIVE & MOBILE VIEW OPTIMIZATIONS
   ========================================================================== */
@media (max-width: 768px) {
    /* 1. Stack Layout & Pane Switching */
    .app-container {
        position: relative;
        overflow: hidden;
    }

    .chat-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100%;
        z-index: 100;
        border-right: none;
        transform: translateX(0);
        margin-left: 0;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .chat-sidebar.collapsed {
        transform: translateX(-100%);
        margin-left: 0;
    }

    /* Mobile Close Chat Button inside Header */
    .mobile-only-close-chat {
        display: flex !important;
    }

    .mindmap-main {
        width: 100vw;
        height: 100%;
    }

    /* 2. Touch & Gesture Canvas Settings */
    .mindmap-canvas-container,
    .mindmap-svg {
        touch-action: none !important; /* Cegah browser scrolling default saat drag canvas */
    }

    /* 3. Floating Controls Mobile Optimization */
    .floating-controls {
        bottom: 1rem;
        left: 1rem;
        padding: 4px;
        border-radius: var(--radius-lg);
        gap: 4px;
        box-shadow: var(--shadow-lg);
    }

    .control-btn {
        width: 42px;
        height: 42px;
        border-radius: var(--radius);
    }

    .control-btn i {
        width: 18px;
        height: 18px;
    }

    /* 4. Detail Drawer (Bottom Sheet) */
    .detail-drawer {
        width: 100% !important;
        height: 85% !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        border-left: none !important;
        border-top: 1px solid var(--border) !important;
        border-radius: 20px 20px 0 0 !important;
        transform: translateY(100%) !important;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 90;
    }

    .detail-drawer.open {
        transform: translateY(0) !important;
    }

    /* Premium visual handle pill at the top of bottom sheet */
    .detail-drawer::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--border-mid);
        border-radius: 2px;
        margin: 8px auto 0 auto;
        flex-shrink: 0;
    }

    .drawer-resize-handle {
        display: none !important;
    }

    .drawer-main-wrapper {
        position: relative;
        overflow: hidden;
    }

    .drawer-col-materi {
        width: 100%;
        min-width: 0;
    }

    /* Q&A Column Overlay below header */
    .drawer-col-qa {
        position: absolute;
        top: 52px; /* Diletakkan di bawah drawer-header agar header tetap terlihat */
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        background: var(--bg);
        z-index: 20;
        border-left: none;
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
    }

    .drawer-col-qa.collapsed {
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
    }

    .drawer-col-qa:not(.collapsed) {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    /* Visual blend for mobile QA header */
    .qa-header {
        border-top: 1px solid var(--border);
    }
}

/* ==========================================================================
   HIGHLIGHT & ANNOTATIONS (STICKY NOTES)
   ========================================================================== */
.highlight-toolbar {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3), 0 8px 10px -6px rgba(0,0,0,0.3);
    z-index: 1000;
    pointer-events: auto;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateY(0);
}

.highlight-toolbar.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
}

.hl-color-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform var(--t);
    padding: 0;
}

.hl-color-btn:hover {
    transform: scale(1.2);
}

.hl-color-btn.yellow { background: #fde047; }
.hl-color-btn.green  { background: #86efac; }
.hl-color-btn.blue   { background: #93c5fd; }
.hl-color-btn.pink   { background: #fbcfe8; }

.hl-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 2px;
}

.hl-action-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    transition: color var(--t);
}

.hl-action-btn:hover {
    color: #ffffff;
}

.hl-action-btn i {
    width: 14px;
    height: 14px;
}

/* Style for highlights inside drawer */
mark.hl-yellow { background: #fef08a; color: inherit; border-radius: 3px; cursor: pointer; padding: 1px 2px; transition: background 0.15s; }
mark.hl-green  { background: #bbf7d0; color: inherit; border-radius: 3px; cursor: pointer; padding: 1px 2px; transition: background 0.15s; }
mark.hl-blue   { background: #bfdbfe; color: inherit; border-radius: 3px; cursor: pointer; padding: 1px 2px; transition: background 0.15s; }
mark.hl-pink   { background: #fbcfe8; color: inherit; border-radius: 3px; cursor: pointer; padding: 1px 2px; transition: background 0.15s; }

mark.hl-yellow:hover { background: #fde047; }
mark.hl-green:hover  { background: #86efac; }
mark.hl-blue:hover   { background: #93c5fd; }
mark.hl-pink:hover   { background: #fbcfe8; }

/* Subtle indicator that highlight has commentary */
mark[data-note]::after {
    content: ' 💬';
    font-size: 0.65rem;
    vertical-align: super;
    opacity: 0.8;
}

/* ==========================================================================
   GOOGLE AUTH & USER PROFILE
   ========================================================================== */
.login-btn-google {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text-2);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--t), color var(--t);
    border: 1px solid var(--border);
}

.login-btn-google:hover {
    background: var(--accent);
    color: var(--accent-inv);
    border-color: var(--accent);
    text-decoration: none;
}

.login-btn-google i {
    width: 14px;
    height: 14px;
}

.user-avatar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--border-mid);
    transition: border-color var(--t);
}

.user-avatar-wrapper:hover .user-avatar {
    border-color: var(--accent);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 120%;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 1000;
    min-width: 140px;
}

.user-dropdown.open {
    display: block !important;
}

.dropdown-item {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-2);
    padding: 6px 8px;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
    transition: background var(--t), color var(--t);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ==========================================================================
   RABBIT HOLE REDESIGN — MULTI-SCREEN & NEW COMPONENTS
   ========================================================================== */

/* Global App Wrapper & Screen Transitions */
.app-container-redesign {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-page);
}

.screen-container {
    flex-grow: 1;
    width: 100%;
    height: calc(100vh - 56px); /* Header is 56px */
    display: flex;
    overflow: hidden;
    position: relative;
    background: var(--bg-page);
}

.screen-container.hidden {
    display: none !important;
}

/* Global Navigation Header */
.global-header {
    height: 56px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 50;
    flex-shrink: 0;
}

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

.brand-logo {
    font-family: var(--font-header);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.3px;
}

.global-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: 2rem;
}

.nav-tab {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    padding: 18px 0;
    position: relative;
    transition: color var(--t);
    background: none;
    border: none;
}

.nav-tab:hover {
    color: var(--text);
}

.nav-tab.active {
    color: var(--accent);
    font-weight: 600;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    border-radius: var(--radius-pill);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   1. SEARCH SCREEN
   ========================================================================== */
.search-screen-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4rem 1.5rem 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    position: relative;
}

.enhanced-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e6f4ea;
    color: #137333;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.enhanced-badge i {
    width: 12px;
    height: 12px;
}

.search-hero-title {
    font-family: var(--font-header);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.5px;
}

.search-hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-3);
    text-align: center;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
    font-weight: 400;
}

.search-box-container {
    width: 100%;
    max-width: 600px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 6px 6px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--t), box-shadow var(--t);
    margin-bottom: 3rem;
}

.search-box-container:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-md), 0 0 0 3px var(--primary-light);
}

.search-box-container input {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: var(--text);
    background: transparent;
}

.search-box-container input::placeholder {
    color: var(--text-3);
}

.kbd-shortcut {
    font-size: 0.68rem;
    color: var(--text-3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 4px;
    font-family: monospace;
    flex-shrink: 0;
}

.btn-search-redesign {
    background: var(--accent);
    color: var(--accent-inv);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--t);
}

.btn-search-redesign:hover {
    background: var(--accent-2);
}

.search-columns-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    width: 100%;
    max-width: 700px;
    margin-bottom: 4rem;
}

.search-column-title {
    font-family: var(--font-header);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-2);
    letter-spacing: 0.8px;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-all-link {
    font-size: 0.72rem;
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.recent-searches-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.recent-search-item {
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
    transition: color var(--t);
}

.recent-search-item:hover {
    color: var(--accent);
}

.suggested-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggested-pill {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: border-color var(--t), color var(--t), background var(--t);
}

.suggested-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-hover);
}

.search-footer-mockup {
    opacity: 0.2;
    margin-top: auto;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

/* ==========================================================================
   2. CONTENT READER SCREEN
   ========================================================================== */
.content-screen-wrapper {
    flex-grow: 1;
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.content-sidebar {
    width: 240px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.toc-title {
    font-family: var(--font-header);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-3);
    letter-spacing: 0.8px;
}

.toc-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.toc-item {
    font-size: 0.8rem;
    color: var(--text-2);
    cursor: pointer;
    transition: color var(--t);
    background: none;
    border: none;
    text-align: left;
}

.toc-item:hover, .toc-item.active {
    color: var(--accent);
    font-weight: 600;
}

.sidebar-card-research {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: auto;
}

.sidebar-card-research h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.sidebar-card-research p {
    font-size: 0.7rem;
    color: var(--text-3);
    margin-bottom: 12px;
}

.btn-new-research-sidebar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #e0ece6;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--t);
}

.btn-new-research-sidebar:hover {
    background: var(--border);
}

.reader-main-column {
    flex-grow: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.reader-content-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 3rem 4rem;
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
}

.article-category {
    font-family: var(--font-header);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.8px;
    margin-bottom: 0.5rem;
}

.article-title-redesign {
    font-family: var(--font-header);
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.premium-callout {
    background: var(--bg-subtle);
    border-left: 3px solid var(--accent);
    padding: 1.25rem 1.5rem;
    border-radius: 4px;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text);
    margin: 1.5rem 0;
}

/* Floating Study Status Footer */
.floating-status-bar {
    height: 52px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
}

.status-selector-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-2);
}

.status-pills {
    display: flex;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    padding: 2px;
    border-radius: var(--radius-pill);
}

.status-pill-btn {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    color: var(--text-2);
    cursor: pointer;
    background: transparent;
    transition: background var(--t), color var(--t);
}

.status-pill-btn.active {
    background: var(--bg);
    color: var(--accent);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.footer-widget-learners {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-2);
    font-weight: 500;
}

.avatar-circle-group {
    display: flex;
    align-items: center;
}

.avatar-mini {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--bg);
    margin-left: -6px;
    background: var(--border-mid);
}

.avatar-mini:first-child {
    margin-left: 0;
}

/* ==========================================================================
   3. MIND MAP SCREEN CONTROLS
   ========================================================================== */
.mindmap-page-wrapper {
    flex-grow: 1;
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.mindmap-search-bar {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    width: 220px;
}

.mindmap-search-bar input {
    border: none;
    outline: none;
    font-size: 0.78rem;
    width: 100%;
    color: var(--text);
    background: transparent;
}

.mindmap-search-bar i {
    width: 14px;
    height: 14px;
    color: var(--text-3);
}

.floating-toggle-controls {
    position: absolute;
    bottom: 1.25rem;
    right: 1.25rem;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 5;
}

.toggle-filter-group {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px;
    box-shadow: var(--shadow-sm);
}

.toggle-option-btn {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    color: var(--text-2);
    cursor: pointer;
    background: transparent;
    transition: background var(--t), color var(--t);
}

.toggle-option-btn.active {
    background: var(--accent);
    color: var(--accent-inv);
    font-weight: 600;
}

.help-bubble-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-inv);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: background var(--t);
}

.help-bubble-btn:hover {
    background: var(--accent-2);
}

.help-bubble-btn i {
    width: 16px;
    height: 16px;
}

/* Dotted grid for D3 Canvas */
.dot-grid-canvas {
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 16px 16px;
}

/* ==========================================================================
   4. RESEARCH HISTORY SCREEN
   ========================================================================== */
.history-screen-wrapper {
    flex-grow: 1;
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.history-sub-sidebar {
    width: 240px;
    background: var(--bg-subtle);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.history-profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.history-profile-title {
    font-family: var(--font-header);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.history-profile-subtitle {
    font-size: 0.68rem;
    color: var(--text-3);
}

.btn-new-research-history {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: var(--accent-inv);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--t);
    margin-bottom: 1.5rem;
}

.btn-new-research-history:hover {
    background: var(--accent-2);
}

.history-menu-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-2);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--t), color var(--t);
    background: none;
    border: none;
    text-align: left;
}

.history-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.history-menu-item.active {
    background: #e0ece6;
    color: var(--accent);
    font-weight: 600;
}

.history-menu-item i {
    width: 15px;
    height: 15px;
    color: var(--text-3);
}

.history-menu-item.active i {
    color: var(--accent);
}

.history-main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 3rem 4rem;
    background: var(--bg);
}

.history-header-block {
    margin-bottom: 2rem;
}

.history-title-redesign {
    font-family: var(--font-header);
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.history-subtitle-redesign {
    font-size: 0.85rem;
    color: var(--text-2);
    line-height: 1.5;
    max-width: 600px;
}

.history-cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 2rem;
}

/* History cards */
.history-progress-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color var(--t), box-shadow var(--t);
}

.history-progress-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.card-info-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1; /* Penuhi sisa ruang horizontal agar kolom progress di kanan sejajar tegak lurus */
}

.card-topic-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-3);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-meta-item i {
    width: 12px;
    height: 12px;
}

.card-progress-right {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 220px;
    flex-shrink: 0;
}

.progress-label-micro {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-3);
}

.progress-bar-outer {
    flex-grow: 1;
    height: 6px;
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
}

.progress-bar-inner {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-pill);
    transition: width 0.3s ease;
}

.progress-percent-bold {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text);
    width: 32px;
    text-align: right;
}

.card-chevron-btn {
    color: var(--text-3);
    display: flex;
    align-items: center;
}

.card-chevron-btn i {
    width: 18px;
    height: 18px;
}

.btn-view-all-history {
    display: block;
    margin: 1.5rem auto 0;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.btn-view-all-history:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ==========================================================================
   MINIMALIST POP-UP MODAL OVERLAY (FOR DETAIL DRAWER)
   ========================================================================== */

#detail-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Open state using CSS :has() */
#detail-drawer-overlay:has(#detail-drawer.open) {
    opacity: 1;
    pointer-events: auto;
}

/* Modal card specific styling */
#detail-drawer {
    width: 800px;
    max-width: 90vw;
    height: 80vh;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s ease, width 0.3s ease;
    overflow: hidden;
}

#detail-drawer.open {
    transform: translateY(0) scale(1);
}

/* Style for study status pills in footer */
.status-pills .status-btn {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--t);
}

.status-pills .status-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.status-pills .status-btn.active[data-status="todo"] {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.status-pills .status-btn.active[data-status="doing"] {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #b45309;
}

.status-pills .status-btn.active[data-status="done"] {
    background: #d1fae5;
    border-color: #10b981;
    color: #047857;
}

/* Support for collapsed/expanded Q&A inside the modal */
#detail-drawer #drawer-col-qa {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-left 0.3s ease;
}

#detail-drawer #drawer-col-qa.collapsed {
    width: 0px !important;
    border-left: 0px solid transparent !important;
}

#detail-drawer #drawer-col-qa:not(.collapsed) {
    width: 380px !important;
    border-left: 1px solid var(--border) !important;
}

/* Card Delete Button (History Cards) */
.card-delete-btn {
    background: none;
    border: none;
    color: var(--text-3);
    padding: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--t), background-color var(--t);
    margin-left: 10px;
}

.card-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.card-delete-btn i {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   DASHBOARD SUBVIEW CUSTOM EXPLORATION STYLES
   ========================================================================== */
#subview-exploration .recent-search-item:hover {
    background: var(--bg-hover) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

#subview-exploration .suggested-pill-dashboard:hover {
    background: var(--bg-hover) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    transform: translateY(-1px);
}

#subview-exploration .search-box-container:focus-within {
    border-color: var(--accent) !important;
    box-shadow: 0 4px 16px rgba(0, 102, 68, 0.08) !important;
}

/* Global Hidden Helper */
.hidden {
    display: none !important;
}

/* ==========================================================================
   MINDMAP CANVAS LOADING OVERLAY
   ========================================================================== */
.mindmap-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    z-index: 20;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mindmap-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.mindmap-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.mindmap-loading-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: -0.1px;
    animation: pulse 1.8s infinite ease-in-out;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ==========================================================================
   MOBILE GLOBAL LAYOUT & BOTTOM NAVIGATION (TASK #1)
   ========================================================================== */

/* Desktop default styles */
.card-mobile-icon-wrapper,
.card-badge-completed,
.mobile-live-sync-badge,
.mobile-drawer-header,
.mobile-reading-progress-container {
    display: none;
}

.mobile-fab {
    display: none;
}

/* Hide mobile navigation by default on desktop */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    /* Hide desktop-only elements in header */
    .global-header .global-nav {
        display: none !important;
    }
    
    .global-header {
        height: 56px;
        padding: 0 1rem;
        border-bottom: 1px solid var(--border);
        background: #ffffff;
        z-index: 1001;
    }
    
    .global-header .brand-logo {
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--primary-green-dark);
    }
    
    #btn-mobile-header-search {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        color: var(--text-2);
        background: transparent;
        border: none;
        cursor: pointer;
    }
    
    #sync-status, #btn-open-settings {
        display: none !important;
    }
    
    .user-avatar-wrapper .user-avatar {
        width: 32px;
        height: 32px;
        border: 2px solid var(--primary-green-light);
        border-radius: 50%;
    }
    
    /* Make the app container fit mobile viewport */
    .app-container-redesign {
        height: 100vh;
        height: -webkit-fill-available;
        display: flex;
        flex-direction: column;
        background: var(--bg-mobile);
        padding-bottom: 60px; /* Space for fixed bottom navigation */
    }
    
    .screen-container {
        height: calc(100vh - 56px - 60px); /* 56px header + 60px bottom nav */
        overflow-y: auto;
    }
    
    /* Mobile Bottom Navigation Bar styling */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
        z-index: 1000;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-2);
        gap: 4px;
        font-size: 0.75rem;
        font-weight: 500;
        cursor: pointer;
        transition: color var(--t);
        flex: 1;
        height: 100%;
    }
    
    .mobile-nav-item i {
        width: 20px;
        height: 20px;
        transition: transform var(--t);
    }
    
    .mobile-nav-item:hover {
        color: var(--primary-green);
    }
    
    .mobile-nav-item.active {
        color: var(--primary-green);
        font-weight: 600;
    }
    
    .mobile-nav-item.active i {
        transform: scale(1.1);
        color: var(--primary-green);
    }
    
    /* Hide dashboard sub-sidebar */
    .history-sub-sidebar {
        display: none !important;
    }
    
    .history-screen-wrapper {
        flex-direction: column;
        overflow: hidden;
    }
    
    .history-main-content {
        padding: 1.5rem 1rem 5rem 1rem !important;
        background: var(--bg-mobile) !important;
        overflow-y: auto;
    }
    
    /* Header Block */
    .history-header-block {
        margin-bottom: 1.5rem;
    }
    
    .history-title-redesign {
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--primary-green-dark);
        margin-bottom: 0.25rem;
    }
    
    .history-subtitle-redesign {
        font-size: 0.8rem;
        color: var(--text-3);
        max-width: 100%;
    }
    
    /* Floating Action Button (FAB) */
    .mobile-fab {
        display: flex;
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary-green);
        color: #ffffff;
        border: none;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 16px rgba(0, 163, 116, 0.4);
        z-index: 999;
        cursor: pointer;
        transition: transform 0.2s ease, background-color 0.2s ease;
    }
    
    .mobile-fab:active {
        transform: scale(0.92);
        background: #008f65;
    }
    
    .mobile-fab i {
        width: 24px;
        height: 24px;
    }
    
    /* History Progress Card Mobile */
    .history-progress-card {
        background: #ffffff !important;
        border: none !important;
        border-radius: 16px !important;
        padding: 1rem !important;
        margin-bottom: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02), 0 0 1px rgba(0, 0, 0, 0.05);
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        position: relative;
    }
    
    .card-mobile-icon-wrapper {
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .card-mobile-icon {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--primary-green-light);
        color: var(--primary-green);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .card-mobile-icon i {
        width: 20px;
        height: 20px;
    }
    
    .card-info-left {
        flex: 1;
        gap: 4px !important;
    }
    
    .card-topic-title {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        color: var(--primary-green-dark) !important;
    }
    
    .card-meta-row {
        gap: 8px !important;
    }
    
    .card-meta-item:not(.card-meta-calendar) {
        display: none !important; /* Keep it clean by showing only date on mobile */
    }
    
    /* Progress styling for mobile */
    .card-progress-right {
        width: auto !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 4px !important;
        min-width: 70px;
    }
    
    .progress-label-micro {
        display: none !important;
    }
    
    .progress-bar-outer {
        width: 60px !important;
        height: 5px !important;
        background: #f1f5f9 !important;
        border-radius: 3px !important;
    }
    
    .progress-bar-inner {
        background: var(--primary-green) !important;
        border-radius: 3px !important;
    }
    
    .progress-percent-bold {
        font-size: 0.8rem !important;
        color: var(--text-2) !important;
    }
    
    /* Completed badge */
    .card-badge-completed {
        display: flex !important;
        align-items: center;
        gap: 4px;
        color: var(--primary-green);
        font-size: 0.75rem;
        font-weight: 600;
        background: var(--primary-green-light);
        padding: 4px 8px;
        border-radius: 12px;
    }
    
    .card-badge-completed i {
        width: 14px;
        height: 14px;
    }
    
    /* Hide progress elements when completed badge is visible */
    .card-badge-completed ~ .progress-bar-outer,
    .card-badge-completed ~ .progress-percent-bold {
        display: none !important;
    }
    
    .card-chevron-btn, .card-delete-btn {
        display: none !important; /* Keep mobile card clean, click triggers detail anyway */
    }
    
    /* ==========================================================================
       TASK #3: MINDMAP VIEWPORT RESPONSIVE & CONTROLS
       ========================================================================== */
    .mindmap-page-wrapper {
        position: relative;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    .mindmap-canvas-container {
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Move zoom controls to vertical pill on right bottom */
    .floating-controls {
        position: absolute !important;
        left: auto !important;
        right: 16px !important;
        bottom: 80px !important;
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border: 1px solid var(--border) !important;
        border-radius: 30px !important;
        padding: 8px 4px !important;
        gap: 8px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
        z-index: 998;
    }
    
    .floating-controls .control-btn {
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important;
        background: transparent !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: var(--text-2) !important;
    }
    
    .floating-controls .control-btn:active {
        background: var(--bg-hover) !important;
        color: var(--primary-green) !important;
    }
    
    .floating-controls .divider,
    #btn-export-session {
        display: none !important; /* Hide non-essential zoom controls on mobile */
    }
    
    /* Live Sync Status Badge melayang di kiri bawah */
    .mobile-live-sync-badge {
        display: flex !important;
        align-items: center;
        gap: 6px;
        position: absolute;
        left: 16px;
        bottom: 80px;
        background: var(--primary-green-light);
        border: 1px solid rgba(0, 163, 116, 0.15);
        color: var(--primary-green-dark);
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(0, 163, 116, 0.05);
        z-index: 998;
        animation: pulse-sync 2s infinite ease-in-out;
    }
    
    .mobile-live-sync-badge .sync-dot {
        color: var(--primary-green);
        font-size: 0.8rem;
    }
    
    @keyframes pulse-sync {
        0%, 100% { opacity: 0.95; }
        50% { opacity: 0.75; }
    }
    
    /* Search bar top-center on mobile */
    .mindmap-search-bar {
        position: absolute !important;
        top: 12px !important;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        background: #ffffff !important;
        border: 1px solid var(--border) !important;
        border-radius: 20px !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
        padding: 0 12px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        z-index: 998;
    }
    
    .mindmap-search-bar input {
        font-size: 0.85rem !important;
    }
    
    /* Hide desktop toggles on mobile */
    .floating-toggle-controls {
        display: none !important;
    }
    
    /* ==========================================================================
       TASK #4: MATERIAL DRAWER IMMERSIVE MOBILE READING
       ========================================================================== */
    #detail-drawer-overlay {
        padding: 0 !important;
        background: #ffffff !important;
        align-items: stretch !important;
        justify-content: stretch !important;
        z-index: 2000 !important;
    }
    
    #detail-drawer {
        max-width: 100% !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
    }
    
    /* Hide default desktop header */
    #detail-drawer .modal-header {
        display: none !important;
    }
    
    /* Show mobile custom header */
    .mobile-drawer-header {
        display: flex !important;
        height: 56px;
        padding: 0 1rem;
        background: #ffffff;
        border-bottom: 1px solid var(--border);
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }
    
    .mobile-back-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: transparent;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-2);
        cursor: pointer;
    }
    
    .mobile-back-btn:active {
        background: var(--bg-hover);
        color: var(--primary-green);
    }
    
    .mobile-back-btn i {
        width: 20px;
        height: 20px;
    }
    
    .mobile-drawer-title {
        font-family: var(--font-header);
        font-size: 1rem;
        font-weight: 700;
        color: var(--primary-green-dark);
        margin: 0;
        text-align: center;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 12px;
    }
    
    .mobile-drawer-actions {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .mobile-drawer-actions .icon-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
        color: var(--text-2);
    }
    
    .mobile-drawer-actions .icon-btn i {
        width: 20px;
        height: 20px;
    }
    
    /* Reading Progress Area */
    .mobile-reading-progress-container {
        display: flex !important;
        flex-direction: column;
        padding: 8px 16px;
        background: #ffffff;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
    }
    
    .mobile-reading-stats {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.75rem;
        color: var(--text-3);
        font-weight: 500;
        margin-bottom: 4px;
    }
    
    .mobile-reading-progress-bar-outer {
        width: 100%;
        height: 4px;
        background: #f1f5f9;
        border-radius: 2px;
        overflow: hidden;
    }
    
    .mobile-reading-progress-bar-inner {
        height: 100%;
        background: var(--primary-green);
        border-radius: 2px;
        width: 0%;
        transition: width 0.15s ease-out;
    }
    
    /* Material body wrapper & Content area size adjustments */
    #detail-drawer .detail-modal-body-wrapper {
        height: calc(100% - 56px - 44px) !important;
    }
    
    .drawer-col-materi {
        padding: 1.5rem 1.25rem 6rem 1.25rem !important;
        background: #ffffff !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Typography customizations for comfortable mobile reading */
    .drawer-col-materi .markdown-body {
        font-size: 1.05rem !important;
        line-height: 1.65 !important;
        color: #2d3748 !important;
        font-family: var(--font) !important;
    }
    
    .drawer-col-materi .markdown-body p {
        margin-bottom: 1.25rem !important;
    }
    
    .drawer-col-materi .markdown-body h3,
    .drawer-col-materi .markdown-body h4 {
        font-family: var(--font-header) !important;
        color: var(--primary-green-dark) !important;
        font-weight: 700 !important;
        margin-top: 1.75rem !important;
        margin-bottom: 0.75rem !important;
        letter-spacing: -0.2px !important;
    }
    
    .drawer-col-materi .markdown-body h3 {
        font-size: 1.25rem !important;
    }
    
    .drawer-col-materi .markdown-body h4 {
        font-size: 1.1rem !important;
    }
    
    /* Customized Green Blockquote */
    .drawer-col-materi .markdown-body blockquote {
        background: var(--primary-green-light) !important;
        border-left: 4px solid var(--primary-green) !important;
        padding: 14px 18px !important;
        border-radius: 0 12px 12px 0 !important;
        margin: 1.5rem 0 !important;
        color: var(--primary-green-dark) !important;
        font-style: italic !important;
        font-weight: 500 !important;
    }
    
    .drawer-col-materi .markdown-body blockquote p {
        margin-bottom: 0 !important;
        font-size: 0.98rem !important;
        line-height: 1.55 !important;
    }
    
    .drawer-col-materi .article-category {
        font-size: 0.65rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* ==========================================================================
       TASK #5: SEARCH SCREEN RESPONSIVE MOBILE EXPLORATION
       ========================================================================== */
    .search-screen-wrapper {
        padding: 2rem 1rem !important;
    }
    
    .search-hero-title {
        font-size: 1.6rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .search-hero-subtitle {
        font-size: 0.85rem !important;
        margin-top: 0 !important;
        margin-bottom: 1.5rem !important;
        color: var(--text-3) !important;
        text-align: center !important;
        line-height: 1.4 !important;
    }
    
    /* Curved pill-shaped input box */
    .search-box-container {
        border-radius: var(--radius-pill) !important;
        padding: 0 4px 0 16px !important;
        height: 48px !important;
        border: 1px solid var(--border) !important;
        background: #ffffff !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        box-shadow: var(--shadow-sm) !important;
        margin-bottom: 2rem !important;
    }
    
    .search-box-container input {
        font-size: 0.9rem !important;
        height: 100% !important;
        border: none !important;
        outline: none !important;
        background: transparent !important;
        padding: 0 !important;
    }
    
    .search-box-container .kbd-shortcut {
        display: none !important;
    }
    
    .btn-search-redesign {
        border-radius: var(--radius-pill) !important;
        background: var(--primary-green) !important;
        color: #ffffff !important;
        font-weight: 600 !important;
        font-size: 0.8rem !important;
        padding: 0 16px !important;
        height: 40px !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        transition: background 0.2s ease !important;
    }
    
    .btn-search-redesign:active {
        background: var(--primary-green-dark) !important;
    }
    
    /* Column Grid */
    .search-columns-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
        margin-top: 2rem !important;
    }
    
    /* Uppercase sub-headers */
    .search-column-title {
        font-size: 0.7rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.8px !important;
        text-transform: uppercase !important;
        color: var(--text-3) !important;
        margin-bottom: 10px !important;
    }
    
    /* Recent searches touch-friendly list items */
    .recent-searches-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .recent-search-item {
        display: flex !important;
        align-items: center !important;
        background: #ffffff !important;
        border: 1px solid var(--border) !important;
        padding: 10px 14px !important;
        border-radius: 12px !important;
        font-size: 0.85rem !important;
        color: var(--text) !important;
        font-weight: 500 !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        line-height: 1.4 !important;
    }
    
    .recent-search-item:active {
        background: var(--bg-hover) !important;
        border-color: var(--primary-green) !important;
    }
    
    /* Horizontally scrollable tag pills */
    .suggested-pills-wrap {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 8px !important;
        padding: 4px 0 10px 0 !important;
        scroll-behavior: smooth !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Hide Suggested scrollbar but retain gesture scroll */
    .suggested-pills-wrap::-webkit-scrollbar {
        display: none !important;
    }
    
    .suggested-pill {
        flex-shrink: 0 !important;
        background: #ffffff !important;
        border: 1px solid var(--border) !important;
        padding: 8px 14px !important;
        border-radius: var(--radius-pill) !important;
        font-size: 0.78rem !important;
        color: var(--text-2) !important;
        font-weight: 500 !important;
        transition: all 0.2s ease !important;
    }
    
    .suggested-pill:active {
        background: var(--bg-hover) !important;
        border-color: var(--primary-green) !important;
        color: var(--primary-green) !important;
    }
    
    /* Native-feeling tab screen transition (Task #6) */
    .screen-container:not(.hidden) {
        animation: mobileFadeInSlide 0.22s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
}

/* Page Transition Keyframes (Task #6) */
@keyframes mobileFadeInSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}




