/* Codei - Modern Cloud IDE & Live Sharing Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-darker: #090d16;
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #334155;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    
    --accent-cyan: #06b6d4;
    --accent-purple: #a855f7;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
    
    --header-height: 60px;
    --footer-height: 32px;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-darker);
    color: var(--text-primary);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
                radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
                var(--bg-darker);
}

/* Top Navigation Bar */
.navbar {
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    gap: 1rem;
    z-index: 50;
}

.nav-left, .nav-center, .nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-left {
    min-width: 260px;
}

.nav-center {
    flex: 1;
    justify-content: center;
    max-width: 600px;
}

.nav-right {
    justify-content: flex-end;
}

/* Logo */
.brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    user-select: none;
}

.brand-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
}

.brand-name {
    background: linear-gradient(120deg, #ffffff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

/* Title Input */
.title-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.25rem 0.6rem;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 320px;
}

.title-wrapper:focus-within, .title-wrapper:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-highlight);
}

.title-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    width: 100%;
    outline: none;
}

.title-edit-icon {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 0.4rem;
    pointer-events: none;
}

/* Language Selector */
.select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.custom-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 2rem 0.45rem 0.85rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.custom-select:hover, .custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
    background: rgba(30, 41, 59, 1);
}

.custom-select option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 0.5rem;
}

.select-arrow {
    position: absolute;
    right: 0.75rem;
    pointer-events: none;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Auto-Save & Sync Status */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: all 0.3s ease;
}

.sync-indicator.synced .sync-dot {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.sync-indicator.saving .sync-dot {
    background-color: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
    animation: pulseSync 1s infinite alternate;
}

.sync-indicator.unsaved .sync-dot {
    background-color: var(--accent-rose);
}

@keyframes pulseSync {
    from { opacity: 0.4; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1.15); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-ui);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #6d28d9 100%);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: #34d399;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.btn-icon {
    padding: 0.45rem;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
}

.btn-share {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(6, 182, 212, 0.3);
    font-weight: 600;
}

.btn-share:hover {
    background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
    box-shadow: 0 4px 18px rgba(6, 182, 212, 0.5);
    transform: translateY(-1px);
}

/* Pulsing Live Badge for Real Time */
.badge-live {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.8rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-full);
    color: #fca5a5;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #ef4444; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.badge-viewers {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
}

/* Main Workspace */
.main-workspace {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.editor-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #1e1e1e;
}

#monaco-editor-target,
#monaco-viewer-target {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.code-pre-render {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 14px 18px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
    color: #f8fafc;
    background: #1e1e1e;
    overflow: auto;
    white-space: pre;
    z-index: 5;
    box-sizing: border-box;
    transition: opacity 0.15s ease;
}

.code-pre-render.hidden {
    display: none !important;
}

/* Split Preview Container (Optional for HTML/JS) */
.preview-container {
    width: 45%;
    height: 100%;
    border-left: 1px solid var(--border-color);
    background: #ffffff;
    display: none;
    flex-direction: column;
}

.preview-container.active {
    display: flex;
}

.preview-header {
    height: 36px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.preview-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

/* Bottom Status Bar */
.status-bar {
    height: var(--footer-height);
    background: var(--bg-darker);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    user-select: none;
    z-index: 40;
}

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

.status-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.status-clickable {
    cursor: pointer;
    transition: color 0.15s ease;
}

.status-clickable:hover {
    color: var(--text-primary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    transform: translateY(12px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

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

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

/* Share Modal Special Components */
.share-feature-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: #6ee7b7;
    font-size: 0.85rem;
}

.share-input-group {
    display: flex;
    gap: 0.5rem;
}

.share-url-input {
    flex: 1;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-primary);
    outline: none;
    user-select: all;
}

.share-url-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #ffffff;
    border-radius: var(--radius-md);
    width: 140px;
    height: 140px;
    margin: 0 auto;
}

#qrcode-render canvas, #qrcode-render img {
    width: 120px !important;
    height: 120px !important;
}

/* Tabs inside Modal */
.modal-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.modal-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Snippet List in Drawer */
.snippets-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 380px;
    overflow-y: auto;
}

.snippet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.snippet-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--border-highlight);
    transform: translateX(2px);
}

.snippet-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.snippet-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.snippet-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.lang-pill {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 45px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.15rem;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.3s ease;
}

.toast.toast-success {
    border-color: rgba(16, 185, 129, 0.4);
}

.toast.toast-info {
    border-color: rgba(99, 102, 241, 0.4);
}

.toast.toast-warning {
    border-color: rgba(245, 158, 11, 0.4);
}

.toast.toast-error {
    border-color: rgba(244, 63, 94, 0.4);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Read-Only Spectator Mode Specifics */
.spectator-banner {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
    padding: 0.4rem 1.25rem;
    font-size: 0.82rem;
    color: #e0e7ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 45;
}

.spectator-banner-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.realtime-flash-banner {
    position: absolute;
    top: 75px;
    right: 25px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #a7f3d0;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 100;
}

.realtime-flash-banner.show {
    opacity: 1;
    transform: translateY(0);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-surface-elevated);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsiveness */
@media (max-width: 900px) {
    .nav-center {
        display: none;
    }
    .btn span.btn-text {
        display: none;
    }
    .status-item.hide-mobile {
        display: none;
    }
}

/* ==========================================================================
   Codei - Brand Logo, Google Auth, Folders & Protected Mode Styles
   ========================================================================== */

/* Brand Logo Upgrade */
.brand-logo-wrap {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
}

.brand-logo-svg {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.45);
    flex-shrink: 0;
}

/* Google Sign-In Button */
.btn-google {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-weight: 500;
    font-size: 0.82rem;
    padding: 0.4rem 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-google:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 12px rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.google-icon-svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* User Profile Widget */
.user-widget {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.65rem 0.25rem 0.35rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-highlight);
}

.user-avatar-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.4rem;
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    z-index: 100;
    backdrop-filter: blur(16px);
}

.user-dropdown-menu.active {
    display: flex;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.3rem 0;
}

/* ==========================================================================
   Modo Protegido (Cápsula Informativa, Escudo Anti-Captura & Blindagem Anti-IA)
   ========================================================================== */

/* Cápsula Interativa no Navbar */
.capsule-protected-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.badge-protected {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(217, 119, 6, 0.25) 100%);
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-radius: var(--radius-full);
    color: #fde68a;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
    user-select: none;
}

.badge-protected:hover,
.badge-protected.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.28) 0%, rgba(217, 119, 6, 0.38) 100%);
    border-color: rgba(245, 158, 11, 0.75);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.badge-protected-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
    animation: pulse-protected 2s infinite ease-in-out;
}

@keyframes pulse-protected {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.capsule-chevron {
    font-size: 0.65rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.badge-protected.active .capsule-chevron {
    transform: rotate(180deg);
}

/* Popover Informativo da Proteção para o Visualizador */
.protected-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 330px;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 24px rgba(245, 158, 11, 0.18);
    padding: 1rem 1.15rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.protected-popover.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.protected-popover-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.popover-shield-icon {
    font-size: 1.5rem;
    background: rgba(245, 158, 11, 0.15);
    padding: 0.35rem 0.55rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.popover-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #fef08a;
    margin: 0;
}

.popover-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0;
}

.protected-popover-body {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.85rem 0;
}

.protection-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.protection-feature-item .feature-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.protection-feature-item strong {
    display: block;
    font-size: 0.78rem;
    color: #f1f5f9;
    margin-bottom: 2px;
}

.protection-feature-item p {
    font-size: 0.71rem;
    color: #94a3b8;
    line-height: 1.4;
    margin: 0;
}

.protected-popover-footer {
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.68rem;
    color: #fde68a;
    text-align: center;
    font-style: italic;
}

/* Proteção visual contra cópia e seleção */
.protected-view-mode {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.protected-view-mode * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Canvas da Matriz Óptica Adversarial Anti-IA / Anti-OCR */
.anti-ai-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 12;
}

/* ==========================================================================
   Lente de Foco Dinâmica (Spotlight Reading Guard) & Anti-IA Blur Mask
   ========================================================================== */

.protected-blur-overlay {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(14px) brightness(0.55) contrast(0.85);
    -webkit-backdrop-filter: blur(14px) brightness(0.55) contrast(0.85);
    background: rgba(10, 15, 29, 0.42);
    pointer-events: none;
    z-index: 15;
    mask-image: radial-gradient(
        ellipse 340px 42px at var(--spotlight-x, -9999px) var(--spotlight-y, -9999px),
        transparent 0%,
        transparent 65%,
        black 100%
    );
    -webkit-mask-image: radial-gradient(
        ellipse 340px 42px at var(--spotlight-x, -9999px) var(--spotlight-y, -9999px),
        transparent 0%,
        transparent 65%,
        black 100%
    );
    transition: opacity 0.2s ease;
}

.spotlight-reticle {
    position: absolute;
    width: 680px;
    height: 84px;
    left: var(--spotlight-x, -9999px);
    top: var(--spotlight-y, -9999px);
    transform: translate(-50%, -50%);
    border-radius: 42px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.15), inset 0 0 15px rgba(245, 158, 11, 0.08);
    pointer-events: none;
    z-index: 16;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.spotlight-reticle.active {
    opacity: 1;
}

/* Cursor de Lupa (Magnifying Glass) para Código Protegido */
body.protected-view-mode .editor-container,
body.protected-view-mode .editor-container *,
body.protected-view-mode .monaco-editor,
body.protected-view-mode .monaco-editor *,
body.protected-view-mode .monaco-editor .overflow-guard,
body.protected-view-mode .monaco-editor .monaco-scrollable-element,
body.protected-view-mode .monaco-editor .view-lines,
body.protected-view-mode .monaco-editor .view-line,
body.protected-view-mode .code-pre-render {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36' fill='none'%3E%3Ccircle cx='14' cy='14' r='9' stroke='%23f59e0b' stroke-width='2.6' fill='rgba(245,158,11,0.22)' filter='drop-shadow(0 2px 4px rgba(0,0,0,0.5))'/%3E%3Ccircle cx='14' cy='14' r='6.5' stroke='rgba(255,255,255,0.4)' stroke-width='1.2' fill='none'/%3E%3Cpath d='M10 9.5a5.5 5.5 0 0 1 5.5 -2' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' opacity='0.85'/%3E%3Cline x1='21' y1='21' x2='32' y2='32' stroke='%23f59e0b' stroke-width='3.6' stroke-linecap='round'/%3E%3Cline x1='22' y1='22' x2='30' y2='30' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' opacity='0.8'/%3E%3C/svg%3E") 14 14, zoom-in !important;
}

/* Marca d'água canário anti-IA */
.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 1.5rem;
    opacity: 0.55;
}

.watermark-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(245, 158, 11, 0.12);
    letter-spacing: 0.16em;
    transform: rotate(-18deg);
    user-select: none;
    white-space: nowrap;
    text-transform: uppercase;
}


/* Bloqueio completo na impressão */
@media print {
    html, body {
        display: none !important;
        visibility: hidden !important;
    }
}

/* Switch Toggle Component */
.toggle-switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-switch-group:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.switch-control {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch-control input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
}

.switch-control input:checked + .switch-slider {
    background: linear-gradient(135deg, var(--accent-amber) 0%, #f97316 100%);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.switch-control input:checked + .switch-slider:before {
    transform: translateX(20px);
}

/* ==========================================================================
   Folders & Organization Modal Styles
   ========================================================================== */

.folders-modal-layout {
    display: flex;
    min-height: 440px;
    max-height: 520px;
    gap: 1rem;
    overflow: hidden;
}

.folders-sidebar {
    width: 220px;
    border-right: 1px solid var(--border-color);
    padding-right: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
}

.folders-nav-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.3rem 0.5rem;
    margin-top: 0.3rem;
}

.folder-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.folder-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.folder-nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #e0e7ff;
    font-weight: 600;
}

.folder-count-pill {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
}

.folders-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: 0.75rem;
}

.folder-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.folder-create-inline {
    display: flex;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

