/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-app: #f3f3f3;
    --bg-sidebar: #e8e8e8;
    --bg-editor: #ffffff;
    --bg-tab-active: #ffffff;
    --bg-tab-inactive: #ececec;
    --border-color: #d4d4d4;
    --text-primary: #333333;
    --text-muted: #616161;
    --accent-blue: #007acc;
    --accent-green: #388e3c;
    --text-tag-bg: #e1e1e1;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', Courier, monospace;
}

[data-theme="dark"] {
    --bg-app: #1e1e1e;
    --bg-sidebar: #252526;
    --bg-editor: #1e1e1e;
    --bg-tab-active: #1e1e1e;
    --bg-tab-inactive: #2d2d2d;
    --border-color: #3c3c3c;
    --text-primary: #cccccc;
    --text-muted: #858585;
    --accent-blue: #3794ff;
    --accent-green: #4ec9b0;
    --text-tag-bg: #323232;
}

[data-theme="peach"] {
    --bg-app: #fff5ee;
    --bg-sidebar: #ffe4e1;
    --bg-editor: #ffffff;
    --bg-tab-active: #ffffff;
    --bg-tab-inactive: #fdf0ed;
    --border-color: #fcd0c7;
    --text-primary: #5c3d35;
    --text-muted: #8b736c;
    --accent-blue: #e07a5f;
    --accent-green: #81b29a;
    --text-tag-bg: #f7d6cd;
}

[data-theme="strawberry"] {
    --bg-app: #fff0f5;
    --bg-sidebar: #ffccd5;
    --bg-editor: #ffffff;
    --bg-tab-active: #ffffff;
    --bg-tab-inactive: #ffe4e1;
    --border-color: #ffccd5;
    --text-primary: #6c2e35;
    --text-muted: #a3676d;
    --accent-blue: #d90429;
    --accent-green: #38b000;
    --text-tag-bg: #ffccd5;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Extreme Zoom Effect */
.zoom-animation {
    animation: extreme-zoom 2.5s cubic-bezier(0.25, 1, 0.5, 1);
}
@keyframes extreme-zoom {
    0% { transform: scale(1); }
    25% { transform: scale(0.1) rotate(-15deg); }
    75% { transform: scale(2.0) rotate(15deg); }
    100% { transform: scale(1); }
}

header.top-header {
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 4px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    z-index: 10;
}

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

.header-menu {
    display: flex;
    list-style: none;
    gap: 12px;
    margin-left: 10px;
}

.header-menu li {
    position: relative;
}

.header-menu li a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
}

.header-menu li a:hover {
    background-color: var(--border-color);
}

/* Dropdown Menu styling */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 120px;
    margin-top: 2px;
}

.dropdown-menu a {
    display: block !important;
    padding: 6px 12px !important;
    font-size: 12px;
    border-radius: 0 !important;
}

.dropdown-menu a:hover {
    background-color: var(--border-color) !important;
}

.header-menu li:hover .dropdown-menu {
    display: block;
}

.header-center {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

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

/* Sidebar styling with support for collapse */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
    transition: width 0.3s ease, border-right 0.3s ease;
}

.sidebar.collapsed {
    width: 0 !important;
    overflow: hidden;
    border-right: none !important;
}

.sidebar-section {
    padding: 10px 0;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 5px 15px;
    letter-spacing: 0.5px;
}

.sidebar-list {
    list-style: none;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    padding: 6px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    font-family: var(--font-mono);
    gap: 8px;
    border-left: 2px solid transparent;
}

.sidebar-item.active a {
    background-color: var(--bg-tab-active);
    border-left-color: var(--accent-blue);
    font-weight: 600;
}

.sidebar-item a:hover {
    background-color: var(--bg-tab-inactive);
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-footer-links {
    display: flex;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-mono);
}

.sidebar-footer-links a:hover {
    color: var(--text-primary);
}

/* Editor Panel */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-editor);
    overflow: hidden;
}

/* Editor Tabs */
.tabs-bar {
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    overflow-x: auto;
}

.editor-tab {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--bg-tab-inactive);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-family: var(--font-mono);
    gap: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.editor-tab.active {
    background-color: var(--bg-tab-active);
    color: var(--text-primary);
    border-bottom-color: transparent;
    font-weight: 500;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 8px 20px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

/* Main Content Editor Area */
.editor-content-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.course-title-section {
    margin-bottom: 20px;
}

.course-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.course-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
}

.badge.wajib {
    background-color: var(--accent-green);
    color: #ffffff;
}

.badge.pilihan, .badge.tag {
    background-color: var(--text-tag-bg);
    color: var(--text-primary);
}

/* Code Block Styling */
.code-container {
    border: 1px solid var(--border-color);
    background-color: var(--bg-app);
    border-radius: 4px;
    padding: 15px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    position: relative;
    overflow-x: auto;
}

.code-container pre {
    white-space: pre-wrap;
    word-break: break-all;
}

.code-keyword {
    color: #d73a49;
    font-weight: 600;
}

.code-comment {
    color: #6a737d;
    font-style: italic;
}

/* Subcategory Items */
.subcategory-item {
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.subcategory-item:last-child {
    border-bottom: none;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

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

.item-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    background-color: var(--text-tag-bg);
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.item-content {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.item-resource {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--accent-blue);
    font-weight: 500;
    font-size: 13px;
}

.item-resource:hover {
    background-color: var(--bg-tab-inactive);
}

/* Bottom Terminal Panel */
.bottom-panel {
    height: 180px;
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: height 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.bottom-panel.collapsed {
    height: 28px !important;
    overflow: hidden;
}

.bottom-panel.collapsed .panel-content {
    display: none !important;
}

.panel-header {
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px;
}

.panel-tabs {
    display: flex;
    gap: 15px;
}

.panel-tab {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    text-transform: uppercase;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.panel-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-blue);
}

.panel-actions {
    display: flex;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.panel-content {
    flex: 1;
    padding: 10px 16px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
}

.log-entry {
    display: flex;
    gap: 15px;
    margin-bottom: 4px;
}

.log-time {
    color: var(--text-muted);
}

.log-message {
    color: var(--text-primary);
}

/* Status Bar */
.status-bar {
    background-color: var(--accent-blue);
    color: #ffffff;
    height: 24px;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    z-index: 10;
}

.status-left, .status-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-dot {
    height: 8px;
    width: 8px;
    background-color: #39d353;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

/* Terminal Modal CLI Overlay */
.terminal-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    font-family: 'Fira Code', var(--font-mono);
    color: #33ff33;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.terminal-header {
    border-bottom: 1px solid #33ff33;
    padding-bottom: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.terminal-body {
    display: flex;
    flex-direction: column;
    min-height: calc(100% - 60px);
}

.terminal-history {
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
    font-size: 14px;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 14px;
}

.terminal-prompt {
    color: #33ff33;
}

.terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: #33ff33;
    font-family: inherit;
    font-size: inherit;
    flex: 1;
}

/* Help Dialog Modal Upgraded */
.help-dialog {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 30px;
    z-index: 3000;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    color: #333;
    text-align: center;
}

[data-theme="dark"] .help-dialog {
    background: rgba(30, 30, 30, 0.85);
    color: #eee;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.help-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.6);
    z-index: 2999;
}

/* Full Screen Animations */
.animation-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    background-color: #000;
    overflow: hidden;
}

/* Matrix Effect */
.matrix-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* CRT Glitch Effect */
.crt-glitch {
    animation: crt-flicker 0.15s infinite, crt-shake 0.2s infinite;
    background: radial-gradient(circle, #3c3c3c 0%, #000000 100%);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff3333;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

@keyframes crt-flicker {
    0% { opacity: 0.9; }
    50% { opacity: 0.95; }
    100% { opacity: 0.9; }
}

@keyframes crt-shake {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0, 0); }
}

/* Flag Hoisting Animation */
.flag-container {
    width: 100%;
    height: 100%;
    background-color: #87CEEB;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 50px;
    position: relative;
}

.flagpole {
    width: 10px;
    height: 80%;
    background-color: #d4d4d4;
    position: relative;
    border-radius: 4px;
}

.flag {
    width: 120px;
    height: 80px;
    position: absolute;
    left: 10px;
    bottom: 0;
    animation: flag-wave 1s ease-in-out infinite alternate;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.flag-red {
    background-color: #e50000;
    flex: 1;
}

.flag-white {
    background-color: #ffffff;
    flex: 1;
}

@keyframes flag-wave {
    0% { transform: skewY(-2deg); }
    100% { transform: skewY(2deg); }
}

/* Birthday Animations */
.birthday-balloon {
    position: absolute;
    width: 50px;
    height: 70px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    animation: float-up 5s linear infinite;
    bottom: -100px;
}

@keyframes float-up {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

/* Falling Letters Animation phrase assembly */
.falling-letter {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 20px;
    color: #38b000;
}

/* Rich Text Editor Styling */
.rte-toolbar {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-bottom: none;
    padding: 6px;
    display: flex;
    gap: 5px;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    flex-wrap: wrap;
}

.rte-btn {
    background-color: var(--bg-editor);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

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

.rte-editor {
    border: 1px solid var(--border-color);
    background-color: var(--bg-editor);
    color: var(--text-primary);
    padding: 15px;
    min-height: 200px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    outline: none;
    overflow-y: auto;
}

/* Bouncing Balls Overlay Styling */
.bounce-ball-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2500;
    background-color: rgba(0, 0, 0, 0.85);
}

.bounce-ball {
    position: absolute;
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

/* Sliding Search Google Style Overlay */
.search-overlay {
    display: none;
    position: fixed;
    top: -100%;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1500;
    background-color: #ffffff;
    color: #202124;
    font-family: Arial, sans-serif;
    transition: top 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.search-overlay.active {
    top: 0;
    display: block;
}

.search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.search-logo {
    font-size: 5rem;
    font-weight: bold;
    margin-bottom: 25px;
    font-family: 'Product Sans', Arial, sans-serif;
    background: linear-gradient(to right, #4285F4 0%, #EA4335 25%, #FBBC05 50%, #4285F4 75%, #34A853 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
}

.search-box-wrapper {
    width: 100%;
    max-width: 580px;
    position: relative;
    margin-bottom: 20px;
}

.search-box {
    width: 100%;
    border: 1px solid #dfe1e5;
    box-shadow: none;
    border-radius: 24px;
    height: 46px;
    padding: 0 20px;
    font-size: 16px;
    outline: none;
}

.search-box:hover, .search-box:focus {
    box-shadow: 0 1px 6px rgba(32,33,36,0.28);
    border-color: rgba(223,225,229,0);
}

/* Advanced Mobile Responsive Adjustments */
@media (max-width: 768px) {
    header.top-header {
        flex-direction: row;
        flex-wrap: nowrap;
        height: 38px;
        gap: 10px;
        padding: 0 10px;
        overflow: hidden;
    }
    .header-center {
        display: none !important;
    }
    .header-left {
        flex: 1;
        overflow-x: auto;
        display: flex;
        align-items: center;
        white-space: nowrap;
        scrollbar-width: none;
    }
    .header-left::-webkit-scrollbar {
        display: none;
    }
    .header-menu {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        margin-left: 2px;
    }
    .workspace {
        flex-direction: row;
    }
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 99;
        box-shadow: 4px 0 15px rgba(0,0,0,0.15);
        width: 240px !important;
    }
    .sidebar.collapsed {
        width: 0 !important;
        transform: translateX(-100%);
    }
    .editor-panel {
        width: 100%;
    }
    .bottom-panel {
        height: 140px;
    }
}

/* CRT Glitch screen static overlay */
.glitch-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    overflow: hidden;
    animation: glitch-anim 0.15s infinite;
}
.glitch-overlay::before {
    content: "SYSTEM DIAGNOSTICS: CRT STATIC DETECTED";
    font-family: monospace;
    font-size: 20px;
    color: #00ff00;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 0 0 8px rgba(0,255,0,0.8);
}
@keyframes glitch-anim {
    0% { background: radial-gradient(circle, #222 10%, #000 90%); filter: hue-rotate(0deg) contrast(150%); }
    25% { background: radial-gradient(circle, #444 15%, #050505 85%); filter: hue-rotate(45deg) contrast(200%) skewX(3deg); }
    50% { background: radial-gradient(circle, #111 5%, #000 95%); filter: hue-rotate(0deg) contrast(120%) skewX(-3deg); }
    75% { background: radial-gradient(circle, #555 20%, #080808 80%); filter: hue-rotate(90deg) contrast(250%) skewX(5deg); }
    100% { background: radial-gradient(circle, #222 10%, #000 90%); filter: hue-rotate(0deg) contrast(150%); }
}

.mbg-food-plate {
    position: absolute;
    font-size: 32px;
    user-select: none;
    z-index: 1000;
}

.crt-chkdsk-screen {
    font-family: monospace;
    font-size: 14px;
    color: #39d353;
    background-color: #000;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    text-align: left;
    white-space: pre-wrap;
    line-height: 1.5;
}
