:root {
    --bg-body: #f1f3f8;
    --bg-editor: #ffffff;
    --bg-header: #f7f8fc;
    --bg-hover: #e8eaf0;
    --bg-active: #dde0e8;
    --bg-preview: #ffffff;
    --border-color: #e2e4ec;
    --text-main: #2d3250;
    --text-secondary: #475569;
    --text-dim: #94a3b8;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #60a5fa;
    --sidebar-width: 60px;
    --header-height: 54px;
    --panel-header-height: 42px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-ui: 'Inter', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    
    /* Device frame colors - Light theme (dark elements) */
    --device-frame: #1a1a1a;
    --device-frame-inner: #2a2a2a;
    --device-camera-bg: #0a0a0a;
    --device-camera-border: #333;
    --device-button-light: #3a3a3a;
    --device-button-dark: #1a1a1a;
}

body.dark-theme {
    --bg-body: #0f0f14;
    --bg-editor: #16161e;
    --bg-header: #1a1a24;
    --bg-hover: #242430;
    --bg-active: #2e2e3d;
    --bg-preview: #16161e;
    --border-color: #2a2a3a;
    --text-main: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-dim: #64748b;
    --accent: #818cf8;
    --accent-light: #a5b4fc;
    --accent-glow: rgba(129, 140, 248, 0.15);
    
    /* Device frame colors - Dark theme (lighter elements) */
    --device-frame: #e0e0e0;
    --device-frame-inner: #c0c0c0;
    --device-camera-bg: #a0a0a0;
    --device-camera-border: #d0d0d0;
    --device-button-light: #f0f0f0;
    --device-button-dark: #c0c0c0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
    
html, body {
    height: 100%;
    overflow: auto;
}

body {
    font-family: var(--font-ui);
    background: var(--bg-body);
    color: var(--text-main);
    display: flex;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-user-select: none;  /* Chrome/Safari */
    -moz-user-select: none;     /* Firefox */
    -ms-user-select: none;      /* IE/Edge */
    user-select: none;          /* Standard */
}

/* PREVENT TRANSITION ON LOAD to avoid flash */
body.preload {
    transition: none !important;
}
body.preload * {
    transition: none !important;
}

/* Re-enable for inputs so users can type */
input, textarea {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ==================== SIDEBAR ==================== */
.global-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-header);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 6px;
    z-index: 1000;
    height: 100vh;
    flex-shrink: 0;
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, border-color 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body.dark-theme .global-sidebar {
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
}

.global-sidebar.open {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-logo {
    color: var(--accent);
    font-weight: 900;
    font-size: 18px;
    margin-bottom: 10px;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    flex-shrink: 0;
}

.sidebar-section-title {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-top: 8px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.sidebar-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.sidebar-divider {
    width: 36px;
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
    flex-shrink: 0;
}

.sidebar-tooltip {
    position: absolute;
    left: 52px;
    background: var(--bg-header);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    transform: translateX(-5px);
    border: 1px solid var(--border-color);
    z-index: 10;
}

.sidebar-btn:hover .sidebar-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* ==================== MAIN STAGE ==================== */
.main-stage {
    flex: 1;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    overflow: hidden;
    margin-left: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== APP CONTAINERS ==================== */
.app-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

.app-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-30px) scale(0.98);
    z-index: 0;
}

.app-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    z-index: 10;
}

#code-app.app-hidden {
    transform: translateX(30px) scale(0.98);
}

/* ==================== UNIFIED HEADER - AUTO HIDE ==================== */
.app-header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    flex-shrink: 0;
    z-index: 100;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                padding 0.3s ease,
                border-width 0.3s ease,
                background 0.3s ease, 
                border-color 0.3s ease;
    overflow: hidden;
}

/* Header trigger zone for mouse devices */
.header-trigger-zone {
    display: none;
}

body.has-mouse .header-trigger-zone {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 15px;
    z-index: 99;
}

/* Auto-hide ONLY the main app header for mouse devices */
body.has-mouse .app-header.header-hidden {
    height: 0;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border-bottom-width: 0;
    pointer-events: none;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.menu-toggle.active {
    background: var(--accent);
    color: white;
}

.menu-toggle i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

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

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.app-logo i { font-size: 18px; }

.app-logo-text { display: none; }

@media (min-width: 480px) {
    .app-logo-text { display: inline; }
}

.header-spacer { flex: 1; }

.header-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.header-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.header-btn i { font-size: 16px; }

/* Theme Toggle Visibility Rule: Hide on Portrait Phones/Tablets */
.theme-toggle-btn {
    display: flex; /* Default visible */
}

@media (max-width: 1024px) and (orientation: portrait) {
    .theme-toggle-btn {
        display: none !important;
    }
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 4px;
    flex-shrink: 0;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}

.sync-dot.syncing { animation: pulse 1s infinite; }
.sync-dot.offline { background: var(--text-dim); }

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

.user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.user-btn:hover { background: var(--accent-light); }
.user-btn i { font-size: 14px; }
.user-btn span { display: none; }

@media (min-width: 480px) {
    .user-btn span { display: inline; }
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    cursor: pointer;
    object-fit: cover;
    transition: var(--transition);
}

.user-avatar:hover { transform: scale(1.1); }

.font-control {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.font-control button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.font-control button:hover {
    background: var(--bg-active);
    color: var(--accent);
}

.font-control span {
    min-width: 24px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-code);
    color: var(--text-main);
}

/* ==================== TAB BAR (Notepad) - ALWAYS VISIBLE ==================== */
.tab-bar {
    height: var(--panel-header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    overflow: hidden;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.tab-bar-scroll {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.tab-bar-scroll::-webkit-scrollbar { display: none; }

.tab-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    min-width: 100px;
    max-width: 160px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-bar-item:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.tab-bar-item.active {
    background: var(--bg-editor);
    color: var(--accent);
}

.tab-bar-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.tab-bar-item .tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
    flex-shrink: 0;
}

.tab-bar-item.active .tab-dot {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}

.tab-bar-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.tab-bar-close {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    flex-shrink: 0;
    font-size: 14px;
}

.tab-bar-item:hover .tab-bar-close { opacity: 1; }

.tab-bar-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.tab-bar-add {
    width: 42px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    border-left: 1px solid var(--border-color);
}

.tab-bar-add:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.tab-bar-add i { font-size: 14px; }

.tab-repo-tag {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--text-main);
    color: var(--bg-editor);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
    z-index: 150;
    box-shadow: var(--shadow-md);
    text-transform: none;
    letter-spacing: 0;
}

.tab-repo-tag::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text-main);
}

.tab-bar-item:hover .tab-repo-tag {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.tab-repo-indicator {
    position: absolute;
    top: 4px;
    right: 24px;
    width: 6px;
    height: 6px;
    background: var(--info);
    border-radius: 50%;
}

/* ==================== CONTEXT MENU ==================== */
.context-menu {
    position: fixed;
    background: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: top left;
    transition: all 0.15s ease;
    overflow: hidden;
    padding: 6px 0;
}

.context-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-ui);
}

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

.context-menu-item i {
    width: 16px;
    font-size: 14px;
    color: var(--text-dim);
}

.context-menu-item:hover i { color: var(--accent); }

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger i { color: var(--danger); }
.context-menu-item.danger:hover { background: rgba(239, 68, 68, 0.1); }

/* ==================== NOTEPAD EDITOR ==================== */
.notepad-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background: var(--bg-editor);
    transition: background 0.3s ease;
}

.line-numbers {
    width: 50px;
    padding: 16px 8px 16px 0;
    text-align: right;
    color: var(--text-dim);
    background: var(--bg-header);
    border-right: 1px solid var(--border-color);
    font-family: var(--font-code);
    font-size: 13px;
    line-height: 1.65;
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
    transition: background 0.3s ease, border-color 0.3s ease;
    /* Hidden by default as per requirement */
    display: none; 
}

.notepad-textarea {
    flex: 1;
    padding: 16px;
    border: none;
    outline: none;
    resize: none;
    background: var(--bg-editor);
    color: var(--text-main);
    font-family: var(--font-code);
    font-size: 14px;
    line-height: 1.65;
    white-space: pre;
    overflow: auto;
    caret-color: var(--accent);
    tab-size: 4;
    -webkit-overflow-scrolling: touch;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Change placeholder font to match editor font */
.notepad-textarea::placeholder { 
    color: var(--text-dim); 
    font-family: var(--font-code);
}

.notepad-textarea::selection { background: var(--accent-glow); }

.notepad-textarea.word-wrap {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ==================== CODE EDITOR ==================== */
.editor-split {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.code-col {
    width: 50%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    min-width: 0;
    transition: width 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    background: var(--bg-editor);
}

.preview-col {
    width: 50%;
    display: flex;
    flex-direction: column;
    background: var(--bg-editor);
    position: relative;
    min-width: 0;
    transition: width 0.3s ease, background 0.3s ease;
}

.code-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    min-height: 0;
    transition: flex 0.3s ease, border-color 0.3s ease;
}

.code-box:last-child { border-bottom: none; }
.code-box.hidden { display: none !important; }

/* Code box header - ALWAYS VISIBLE */
.code-box-header {
    height: var(--panel-header-height);
    padding: 0 12px;
    background: var(--bg-header);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    color: var(--text-main);
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.code-box-header .lang-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.lang-dot.html { background: #e44d26; box-shadow: 0 0 6px rgba(228,77,38,0.5); }
.lang-dot.css { background: #2196f3; box-shadow: 0 0 6px rgba(33,150,243,0.5); }
.lang-dot.js { background: #f7df1e; box-shadow: 0 0 6px rgba(247,223,30,0.5); }
.lang-dot.preview { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }

.code-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.code-line-numbers {
    width: 40px;
    padding: 10px 6px 10px 0;
    text-align: right;
    color: var(--text-dim);
    background: var(--bg-header);
    border-right: 1px solid var(--border-color);
    font-family: var(--font-code);
    font-size: 12px;
    line-height: 20px;
    overflow: hidden;
    flex-shrink: 0;
    transition: background 0.3s ease, border-color 0.3s ease;
    /* Hidden by default */
    display: none;
}

.code-textarea {
    flex: 1;
    padding: 10px;
    border: none;
    outline: none;
    resize: none;
    background: var(--bg-editor);
    color: var(--text-main);
    font-family: var(--font-code);
    font-size: 13px;
    line-height: 20px;
    white-space: pre;
    overflow: auto;
    caret-color: var(--accent);
    tab-size: 2;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Change placeholder font to match editor font */
.code-textarea::placeholder {
    color: var(--text-dim);
    font-family: var(--font-code);
}

/* ==================== PREVIEW SECTION - HEADER ALWAYS VISIBLE ==================== */
.preview-header {
    height: var(--panel-header-height);
    padding: 0 12px;
    background: var(--bg-header);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    color: var(--text-main);
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

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

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

.device-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.device-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.device-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.device-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.preview-iframe-container {
    flex: 1;
    overflow: auto;
    background: #eef0f5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body.dark-theme .preview-iframe-container {
    background: #0a0a0f;
}

.device-frame {
    background: white;
    transition: width 0.5s ease, height 0.5s ease, transform 0.3s ease, border-color 0.3s ease;
    position: relative;
    box-shadow: none;
    border: none;
    overflow: hidden;
    transform-origin: center center;
    flex-shrink: 0;
}

/* Desktop mode - full size, no transform */
.preview-iframe-container:not(.mobile):not(.tablet) .device-frame {
    width: 100%;
    height: 100%;
    transform: none;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* ==================== DEVICE MODES - Samsung S24 Ultra Style ==================== */

/* Mobile Device Frame - Light Theme (Dark Frame) */
.preview-iframe-container.mobile .device-frame {
    width: 375px;
    height: 812px;
    border-radius: 5px;
    border: 3px solid var(--device-frame);
    box-shadow: 
        inset 0 0 0 1px var(--device-frame-inner),
        0 20px 50px -10px rgba(0, 0, 0, 0.5);
    padding: 0;
    background: var(--device-frame);
    transform: scale(0.95);
    overflow: visible;
    position: relative;
}

/* Camera dot - mobile (punch-hole style) */
.preview-iframe-container.mobile .device-frame::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--device-camera-bg);
    border: 1.5px solid var(--device-camera-border);
    border-radius: 50%;
    z-index: 10;
    box-shadow: inset 0 0 2px rgba(255,255,255,0.1);
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Side button (sleek thin horizontal) - mobile */
.preview-iframe-container.mobile .device-frame::after {
    content: '';
    position: absolute;
    top: 100px;
    right: -4px;
    width: 3px;
    height: 55px;
    background: linear-gradient(to bottom, var(--device-button-light), var(--device-button-dark), var(--device-button-light));
    border-radius: 0 2px 2px 0;
    z-index: 10;
    transition: background 0.3s ease;
}

.preview-iframe-container.mobile .preview-iframe {
    border-radius: 3px;
    background: white;
}

/* Mobile Landscape */
.preview-iframe-container.mobile.landscape .device-frame {
    width: 812px;
    height: 375px;
}

.preview-iframe-container.mobile.landscape .device-frame::before {
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
}

.preview-iframe-container.mobile.landscape .device-frame::after {
    top: -4px;
    right: 100px;
    left: auto;
    width: 55px;
    height: 3px;
    background: linear-gradient(to right, var(--device-button-light), var(--device-button-dark), var(--device-button-light));
    border-radius: 2px 2px 0 0;
}

/* Tablet Device Frame */
.preview-iframe-container.tablet .device-frame {
    width: 768px;
    height: 1024px;
    border-radius: 5px;
    border: 4px solid var(--device-frame);
    box-shadow: 
        inset 0 0 0 1px var(--device-frame-inner),
        0 25px 60px -15px rgba(0, 0, 0, 0.5);
    padding: 0;
    background: var(--device-frame);
    transform: scale(0.95);
    overflow: visible;
    position: relative;
}

/* Camera dot - tablet (punch-hole style) */
.preview-iframe-container.tablet .device-frame::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--device-camera-bg);
    border: 1.5px solid var(--device-camera-border);
    border-radius: 50%;
    z-index: 10;
    box-shadow: inset 0 0 2px rgba(255,255,255,0.1);
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Side button (sleek thin horizontal) - tablet */
.preview-iframe-container.tablet .device-frame::after {
    content: '';
    position: absolute;
    top: 80px;
    right: -5px;
    width: 3px;
    height: 45px;
    background: linear-gradient(to bottom, var(--device-button-light), var(--device-button-dark), var(--device-button-light));
    border-radius: 0 2px 2px 0;
    z-index: 10;
    transition: background 0.3s ease;
}

.preview-iframe-container.tablet .preview-iframe {
    border-radius: 3px;
    background: white;
}

/* Tablet Landscape */
.preview-iframe-container.tablet.landscape .device-frame {
    width: 1024px;
    height: 768px;
}

.preview-iframe-container.tablet.landscape .device-frame::before {
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
}

.preview-iframe-container.tablet.landscape .device-frame::after {
    top: -5px;
    right: 80px;
    left: auto;
    width: 45px;
    height: 3px;
    background: linear-gradient(to right, var(--device-button-light), var(--device-button-dark), var(--device-button-light));
    border-radius: 2px 2px 0 0;
}

/* Dark theme shadow adjustments */
body.dark-theme .preview-iframe-container.mobile .device-frame,
body.dark-theme .preview-iframe-container.tablet .device-frame {
    box-shadow: 
        inset 0 0 0 1px var(--device-frame-inner),
        0 20px 50px -10px rgba(0, 0, 0, 0.3);
}

/* ==================== FULLSCREEN MODES ==================== */

/* Desktop Fullscreen Mode */
body.fullscreen-mode .code-col {
    display: none !important;
}

body.fullscreen-mode .preview-col {
    width: 100% !important;
    border: none !important;
}

body.fullscreen-mode .preview-iframe-container {
    padding: 0;
}

body.fullscreen-mode .preview-iframe-container:not(.mobile):not(.tablet) .device-frame {
    border: none;
    border-radius: 0;
}

/* Mobile Fullscreen Mode (Portrait) */
body.mobile-fullscreen-mode .code-col {
    display: none !important;
}

body.mobile-fullscreen-mode .preview-col {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

body.mobile-fullscreen-mode .editor-split {
    flex-direction: column;
}

body.mobile-fullscreen-mode .preview-iframe-container {
    padding: 0;
}

body.mobile-fullscreen-mode .device-frame {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    transform: none !important;
    box-shadow: none !important;
}

body.mobile-fullscreen-mode .device-frame::before,
body.mobile-fullscreen-mode .device-frame::after {
    display: none !important;
}

body.mobile-fullscreen-mode .preview-iframe {
    border-radius: 0 !important;
}

body.mobile-fullscreen-mode .zoom-controls {
    display: none !important;
}

/* ==================== ZOOM CONTROLS ==================== */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-header);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.zoom-controls.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.zoom-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(128,128,128,0.1);
    color: var(--text-main);
    cursor: pointer;
    transition: 0.2s;
}

.zoom-btn:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.zoom-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.zoom-display {
    font-size: 11px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
    font-family: var(--font-code);
    color: var(--text-main);
}

/* ==================== RESPONSIVE - MOBILE/TABLET ==================== */

/* Mobile/Tablet: Hide font size controls to save space */
@media (max-width: 1024px) {
    .font-control {
        display: none !important;
    }
}

/* 1. Disable notification tags on phones and tablets */
@media (max-width: 1024px) {
    .toast-container {
        display: none !important;
    }
}

/* 2. Prevent Auth Blink: Hide all auth elements by default */
#np-login-btn, #ce-login-btn,
#np-user-avatar, #ce-user-avatar {
    display: none;
}


/* Mobile Portrait */
@media (max-width: 768px) and (orientation: portrait) {
    .editor-split {
        flex-direction: column;
    }

    .code-col {
        width: 100% !important;
        height: 50%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .preview-col {
        width: 100% !important;
        height: 50%;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    .preview-iframe-container {
        padding: 0;
    }

    .device-frame {
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        border-radius: 0 !important;
        transform: none !important;
        box-shadow: none !important;
    }

    .device-frame::before,
    .device-frame::after {
        display: none !important;
    }

    .preview-iframe {
        border-radius: 0 !important;
    }
}

/* Mobile/Tablet Landscape - Hide device buttons, show full preview */
@media (max-width: 1024px) and (orientation: landscape) {
    .editor-split {
        flex-direction: row;
    }

    .code-col {
        width: 50% !important;
        height: 100% !important;
        border-right: 1px solid var(--border-color);
        border-bottom: none;
    }

    .preview-col {
        width: 50% !important;
        height: 100% !important;
    }

    /* Hide mobile and tablet buttons, keep only desktop/fullscreen */
    #btn-dev-mobile,
    #btn-dev-tablet {
        display: none !important;
    }

    /* Keep desktop button visible */
    #btn-dev-desktop {
        display: flex !important;
    }
    
    /* HIDE MOBILE FULLSCREEN BUTTON IN LANDSCAPE */
    #btn-mobile-fs {
        display: none !important;
    }

    .preview-iframe-container {
        padding: 0;
    }

    .device-frame {
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        border-radius: 0 !important;
        transform: none !important;
        box-shadow: none !important;
    }

    .device-frame::before,
    .device-frame::after {
        display: none !important;
    }

    .preview-iframe {
        border-radius: 0 !important;
    }

    .zoom-controls {
        display: none !important;
    }
}
    /* Remove button styling in landscape mode */
@media (max-width: 1024px) and (orientation: landscape) {
    #btn-dev-desktop {
        background: transparent !important;
        color: var(--text-dim) !important;
    }

    #btn-dev-desktop:hover {
        background: transparent !important;
        color: var(--text-dim) !important;
    }

    #btn-dev-desktop.active {
        background: transparent !important;
        color: var(--text-dim) !important;
    }
}
    /* Desktop */
    @media (min-width: 769px) {
        .mobile-only {
            display: none !important;
        }
    }

    @media (min-width: 1025px) {
        .desktop-only {
            display: flex !important;
        }
    }

    /* ==================== STATUS BAR ==================== */
    .status-bar {
        height: 32px;
        padding-bottom: var(--safe-bottom);
        background: var(--accent);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 12px;
        font-size: 11px;
        color: rgba(255,255,255,0.9);
        font-weight: 500;
        flex-shrink: 0;
        transition: background 0.3s ease;
    }

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

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

    .status-item.clickable {
        cursor: pointer;
        padding: 2px 8px;
        border-radius: 4px;
        transition: all 0.2s ease;
    }

    .status-item.clickable:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    /* ==================== VIEW SWITCHER (Refined) ==================== */
    .view-switcher {
        position: fixed;
        bottom: 50px; /* Moved up as requested */
        left: 50%;
        transform: translateX(-50%);
        background: var(--bg-header);
        border: 1px solid var(--border-color);
        padding: 4px;
        border-radius: 50px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 220px;
        box-shadow: var(--shadow-md);
        z-index: 2000;
        opacity: 0; /* Hidden by default for auto-hide */
        pointer-events: none;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .view-switcher.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .view-switcher:hover, .view-switcher.focused {
        transform: translateX(-50%) translateY(-2px);
    }

    /* The sliding pill background */
    .switcher-glider {
        position: absolute;
        top: 4px;
        left: 4px;
        width: calc(50% - 4px);
        height: calc(100% - 8px);
        background: var(--accent);
        border-radius: 40px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 0;
        box-shadow: 0 4px 15px var(--accent-glow);
    }

    .view-switcher[data-view="code"] .switcher-glider {
        transform: translateX(100%);
    }

    .switch-opt {
        padding: 10px 0;
        border-radius: 50px;
        border: none;
        background: transparent;
        color: var(--text-dim);
        font-weight: 600;
        font-size: 13px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-family: var(--font-ui);
        z-index: 1;
        position: relative;
        transition: color 0.3s ease;
    }

    .switch-opt i { font-size: 14px; }

    .switch-opt.active {
        color: white;
    }

    .switch-opt:not(.active):hover {
        color: var(--text-main);
    }

/* ==================== MODAL / BOTTOM SHEET ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 5000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-sheet {
    background: var(--bg-editor);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s ease, background 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-sheet {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
    margin: 10px auto;
    flex-shrink: 0;
}

.sheet-header {
    padding: 12px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sheet-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--transition);
}

.sheet-close:hover {
    background: var(--danger);
    color: white;
}

.sheet-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Desktop behavior */
@media (min-width: 768px) {
    .modal-overlay { 
        align-items: center; 
    }

    .modal-sheet {
        border-radius: var(--radius);
        max-width: 440px;
        transform: scale(0.95);
    }

    .modal-overlay.active .modal-sheet {
        transform: scale(1);
    }

    .sheet-handle { 
        display: none; 
    }
}

/* Landscape mode for mobile/tablet - Side panel */
@media (max-width: 1024px) and (orientation: landscape) {
    .modal-overlay {
        align-items: stretch;
        justify-content: flex-start;
    }
    
    .modal-sheet {
        border-radius: 0 var(--radius) var(--radius) 0;
        width: 50%;
        max-width: 420px;
        max-height: 100vh;
        height: 100vh;
        transform: translateX(-100%);
    }
    
    .modal-overlay.active .modal-sheet {
        transform: translateX(0);
    }
    
    .sheet-handle {
        display: none;
    }
    
    .sheet-header {
        padding: 12px 24px 16px;
    }
    
    .sheet-body {
        padding: 20px 24px;
        padding-left: 28px;
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
    }
}
    /* ==================== AUTH MODAL ==================== */
    .auth-content { text-align: center; }

    .auth-content p {
        color: var(--text-secondary);
        margin-bottom: 24px;
        font-size: 14px;
    }

    .google-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        width: 100%;
        padding: 14px 24px;
        background: white;
        border: 1px solid #dadce0;
        border-radius: var(--radius-sm);
        font-size: 15px;
        font-weight: 500;
        color: #1f1f1f;
        cursor: pointer;
        transition: var(--transition);
    }

    body.dark-theme .google-btn {
        background: #1f1f1f;
        border-color: #333;
        color: white;
    }

    .google-btn:hover { box-shadow: var(--shadow-md); }
    .google-btn img { width: 20px; height: 20px; }

    .auth-features {
        margin-top: 28px;
        padding-top: 20px;
        border-top: 1px solid var(--border-color);
        text-align: left;
    }

    .auth-features h4 {
        font-size: 12px;
        color: var(--text-dim);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 12px;
    }

    .feature-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 0;
        font-size: 13px;
        color: var(--text-secondary);
    }

    .feature-item i {
        color: var(--success);
        font-size: 14px;
    }

    /* ==================== REPO TAG MODAL ==================== */
    .repo-tag-input-group { margin-bottom: 20px; }

    .repo-tag-input-group label {
        display: block;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
        margin-bottom: 8px;
    }

    .repo-tag-input-group input {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        background: var(--bg-body);
        color: var(--text-main);
        font-family: var(--font-ui);
        font-size: 15px;
        outline: none;
        transition: var(--transition);
    }

    .repo-tag-input-group input:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--accent-glow);
    }

    .repo-tag-hint {
        font-size: 12px;
        color: var(--text-dim);
        margin-top: 8px;
    }

    .repo-tag-preview {
        background: var(--bg-hover);
        border-radius: var(--radius-sm);
        padding: 16px;
        margin-bottom: 20px;
        text-align: center;
        display: none;
    }

    .repo-tag-preview.visible { display: block; }

    .repo-tag-preview-label {
        font-size: 11px;
        color: var(--text-dim);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 8px;
    }

    .repo-tag-preview-value {
        font-size: 14px;
        font-weight: 600;
        padding: 8px 16px;
        background: var(--text-main);
        color: var(--bg-editor);
        border-radius: 6px;
        display: inline-block;
    }

    .repo-tag-actions {
        display: flex;
        gap: 12px;
    }

    .repo-tag-actions button {
        flex: 1;
        padding: 14px;
        border-radius: var(--radius-sm);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition);
        font-family: var(--font-ui);
    }

    .repo-tag-btn-cancel {
        background: var(--bg-hover);
        border: 1px solid var(--border-color);
        color: var(--text-main);
    }

    .repo-tag-btn-cancel:hover { background: var(--bg-active); }

    .repo-tag-btn-save {
        background: var(--accent);
        border: none;
        color: white;
    }

    .repo-tag-btn-save:hover { background: var(--accent-light); }

    .repo-tag-btn-remove {
        background: transparent;
        border: 1px solid var(--danger);
        color: var(--danger);
        flex: 0.5;
        display: none;
    }

    .repo-tag-btn-remove.visible { display: block; }

    .repo-tag-btn-remove:hover {
        background: var(--danger);
        color: white;
    }

    /* ==================== DASHBOARD MODAL ==================== */
    .dashboard-header-info {
        display: flex;
        align-items: center;
        gap: 14px;
        padding-bottom: 20px;
        margin-bottom: 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .dashboard-header-info img {
        width: 50px;
        height: 50px;
        border-radius: 50%;
    }

    .dashboard-user-info h4 {
        font-size: 16px;
        font-weight: 600;
    }

    .dashboard-user-info p {
        font-size: 13px;
        color: var(--text-dim);
    }

    .dashboard-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 16px;
    }

    .dashboard-tab {
        flex: 1;
        padding: 10px;
        background: var(--bg-hover);
        border: none;
        border-radius: var(--radius-sm);
        color: var(--text-dim);
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: var(--transition);
        font-family: var(--font-ui);
    }

    .dashboard-tab.active {
        background: var(--accent);
        color: white;
    }

    .dashboard-tab:not(.active):hover { color: var(--text-main); }

    .dashboard-content { min-height: 150px; }

    /* PROFILE STATS GRID - NEW */
    .profile-stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-top: 20px;
    }

    .profile-stat-card {
        background: var(--bg-hover);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        padding: 16px;
        display: flex;
        align-items: center;
        gap: 12px;
        transition: var(--transition);
    }

    .profile-stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }

    .profile-stat-icon {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        flex-shrink: 0;
    }

    .profile-stat-icon.notes { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
    .profile-stat-icon.codes { background: rgba(247, 223, 30, 0.15); color: #f7df1e; }
    .profile-stat-icon.slots { background: rgba(16, 185, 129, 0.15); color: var(--success); }
    .profile-stat-icon.shares { background: rgba(96, 165, 250, 0.15); color: var(--info); }

    .profile-stat-info { display: flex; flex-direction: column; }
    .profile-stat-value { font-size: 22px; font-weight: 700; color: var(--text-main); line-height: 1; }
    .profile-stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

    .slots-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .slot-card {
        background: var(--bg-hover);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        padding: 14px;
        transition: var(--transition);
    }

    .slot-card.empty {
        border-style: dashed;
        opacity: 0.7;
    }

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

    .slot-number {
        font-size: 13px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 6px;
        color: var(--text-main);
    }

    .slot-number i { color: var(--accent); }

    .slot-badge {
        font-size: 9px;
        padding: 3px 8px;
        border-radius: 20px;
        background: var(--success);
        color: white;
        font-weight: 600;
    }

    .slot-badge.empty-badge { background: var(--text-dim); }

    .slot-preview {
        font-size: 11px;
        color: var(--text-dim);
        margin-bottom: 10px;
        height: 32px;
        overflow: hidden;
        font-family: var(--font-code);
        background: var(--bg-editor);
        padding: 6px 8px;
        border-radius: 6px;
    }

    .slot-actions {
        display: flex;
        gap: 6px;
    }

    .slot-btn {
        flex: 1;
        padding: 7px 0;
        border: none;
        border-radius: 6px;
        font-size: 10px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        transition: var(--transition);
        font-family: var(--font-ui);
    }

    .slot-btn.save-btn { background: var(--accent); color: white; }
    .slot-btn.load-btn { background: var(--success); color: white; }
    .slot-btn.del-btn { background: var(--danger); color: white; flex: 0.5; }
    .slot-btn:disabled { opacity: 0.3; cursor: not-allowed; }

    /* MENU ITEM WITH BADGE */
    .menu-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px;
        margin: 0 -20px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        transition: var(--transition);
        position: relative;
    }

    .menu-item:hover { background: var(--bg-hover); }
    .menu-item.danger { color: var(--danger); }
    .menu-item i { font-size: 16px; width: 20px; text-align: center; }

    .menu-item-badge {
        margin-left: auto;
        background: var(--accent-glow);
        color: var(--accent);
        font-size: 11px;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 20px;
        min-width: 24px;
        text-align: center;
    }

    /* SHARE SLOT CARD */
    .share-slot-card {
        background: var(--bg-hover);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        padding: 14px;
        margin-bottom: 12px;
        transition: var(--transition);
    }

    .share-slot-card:hover { border-color: var(--accent); }

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

    .share-slot-type { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
    .share-slot-type i { font-size: 14px; }
    .share-slot-type.notepad i { color: var(--accent); }
    .share-slot-type.code i { color: #f7df1e; }
    .share-slot-date { font-size: 11px; color: var(--text-dim); }

    .share-slot-preview {
        font-size: 11px;
        color: var(--text-dim);
        margin-bottom: 10px;
        padding: 8px 10px;
        background: var(--bg-editor);
        border-radius: 6px;
        font-family: var(--font-code);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .share-slot-link {
        font-size: 10px;
        color: var(--info);
        margin-bottom: 10px;
        padding: 6px 10px;
        background: rgba(96, 165, 250, 0.1);
        border-radius: 6px;
        font-family: var(--font-code);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
    }

    .share-slot-link:hover { background: rgba(96, 165, 250, 0.2); }

    .share-slot-actions { display: flex; gap: 6px; }
    .share-slot-actions .slot-btn { flex: 1; }
    .share-slot-actions .slot-btn.copy-btn { background: var(--info); color: white; }
    .share-slot-actions .slot-btn.open-btn { background: var(--success); color: white; }

    /* EMPTY STATE */
    .empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); }
    .empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
    .empty-state h4 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
    .empty-state p { font-size: 13px; }

    /* ==================== SETTINGS MODAL ==================== */
    .settings-section { margin-bottom: 24px; }

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

    .setting-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 0;
        border-bottom: 1px solid var(--border-color);
    }

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

    .setting-info h4 {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 2px;
    }

    .setting-info p {
        font-size: 12px;
        color: var(--text-dim);
    }

    /* Style for font size controls in settings */
    .setting-value-control {
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--bg-body);
        padding: 4px;
        border-radius: 6px;
        border: 1px solid var(--border-color);
    }

    .setting-value-control button {
        width: 28px;
        height: 28px;
        border: none;
        background: transparent;
        cursor: pointer;
        color: var(--text-main);
        border-radius: 4px;
        font-weight: 600;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: var(--transition);
    }

    .setting-value-control button:hover {
        background: var(--bg-active);
        color: var(--accent);
    }

    .setting-value-control span {
        min-width: 24px;
        text-align: center;
        font-family: var(--font-code);
        font-size: 13px;
        font-weight: 600;
        color: var(--text-main);
    }

    .toggle {
        width: 48px;
        height: 28px;
        background: var(--bg-active);
        border-radius: 14px;
        cursor: pointer;
        position: relative;
        transition: var(--transition);
        flex-shrink: 0;
    }

    .toggle.active { background: var(--accent); }

    .toggle::after {
        content: '';
        position: absolute;
        width: 22px;
        height: 22px;
        background: white;
        border-radius: 50%;
        top: 3px;
        left: 3px;
        transition: var(--transition);
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    .toggle.active::after { left: 23px; }

    /* ==================== SHARE MODAL STYLES (IMPORTED) ==================== */
    .qr-box {
        background: white;
        padding: 20px;
        border-radius: 16px;
        box-shadow: 0 8px 30px rgba(0,0,0,0.12);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-bottom: 20px;
    }
    .qr-box img { width: 180px; height: 180px; display: block; }
    .qr-loading {
        width: 180px;
        height: 180px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 15px;
        color: #888;
        font-size: 14px;
    }
    .spinner {
        width: 50px;
        height: 50px;
        border: 4px solid #eee;
        border-top-color: var(--accent);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .link-box { width: 100%; display: flex; gap: 10px; margin-bottom: 20px; }
    .link-box input {
        flex: 1;
        padding: 14px 16px;
        border: 2px solid var(--border-color);
        border-radius: 12px;
        background: var(--bg-hover);
        color: var(--text-main);
        font-family: var(--font-code);
        font-size: 12px;
        outline: none;
    }
    .link-box input:focus { border-color: var(--accent); }

    .copy-btn {
        padding: 14px 24px;
        background: var(--accent);
        color: white;
        border: none;
        border-radius: 12px;
        font-family: var(--font-ui);
        font-size: 15px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .copy-btn:hover:not(:disabled) {
        background: var(--accent-light);
        transform: translateY(-2px);
    }
    .copy-btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .copy-btn svg { width: 18px; height: 18px; }

    .status-box {
        width: 100%;
        padding: 16px 20px;
        border-radius: 12px;
        font-size: 14px;
        text-align: center;
        line-height: 1.5;
        font-weight: 600;
        display: none;
        margin-bottom: 15px;
    }
    .status-box.loading { background: var(--accent-glow); color: var(--accent); display: block; }
    .status-box.success { background: rgba(16, 185, 129, 0.15); color: var(--success); display: none; }
    .status-box.error { background: rgba(239, 68, 68, 0.15); color: var(--danger); display: block; }

    .alt-section {
        width: 100%;
        border-top: 1px solid var(--border-color);
        padding-top: 20px;
        margin-top: 5px;
    }
    .alt-title {
        font-size: 11px;
        color: var(--text-dim);
        text-transform: uppercase;
        letter-spacing: 1.5px;
        margin-bottom: 15px;
        text-align: center;
    }
    .alt-btns { display: flex; gap: 12px; width: 100%; }
    .alt-btns button {
        flex: 1;
        padding: 14px;
        background: var(--bg-hover);
        border: 2px solid var(--border-color);
        color: var(--text-main);
        border-radius: 12px;
        font-family: var(--font-ui);
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    .alt-btns button:hover {
        border-color: var(--accent);
        color: var(--accent);
        transform: translateY(-2px);
        background: var(--bg-active);
    }
    .alt-btns button svg { width: 18px; height: 18px; }

    /* ==================== TOAST ==================== */
    .toast-container {
        position: fixed;
        bottom: 80px;
        right: 20px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        z-index: 10000;
        pointer-events: none;
    }

    .toast {
        padding: 12px 20px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        font-family: var(--font-ui);
        color: white;
        display: flex;
        align-items: center;
        gap: 10px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.3);
        animation: toastIn 0.4s ease, toastOut 0.4s ease forwards;
        animation-delay: 0s, 2.5s;
        backdrop-filter: blur(10px);
    }

    .toast.success { background: rgba(16, 185, 129, 0.95); }
    .toast.info { background: rgba(99, 102, 241, 0.95); }
    .toast.warning { background: rgba(245, 158, 11, 0.95); color: #333; }
    .toast.error { background: rgba(239, 68, 68, 0.95); }

    @keyframes toastIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
    @keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-20px); } }
