/* ==========================================================================
   DESIGN SYSTEM & CUSTOM PROPERTIES (TextoNaNuvem)
   Focado em Rich Aesthetics, Glassmorphism e responsividade Android premium.
   ========================================================================== */

:root {
    /* Paleta Dark Theme (Default) */
    --bg-base: #0c0a14;
    --bg-surface: rgba(22, 19, 39, 0.6);
    --bg-surface-solid: #161327;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(147, 51, 234, 0.4);
    
    --primary: #a855f7;       /* Roxo elétrico */
    --primary-hover: #c084fc;
    --secondary: #06b6d4;     /* Ciano neon */
    --secondary-hover: #22d3ee;
    
    --text-primary: #f3f4f6;  /* Branco gelo */
    --text-muted: #9ca3af;    /* Cinza sutil */
    --text-dark: #1f2937;
    
    --accent-glow: rgba(168, 85, 247, 0.15);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    --blur-val: 16px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;

    /* Tamanho de Fonte Dinâmico do Editor */
    --editor-font-size: 1rem;
    
    /* Configurações de Fundo do Layout */
    --bg-header: rgba(12, 10, 20, 0.6);
    --bg-sidebar: rgba(18, 16, 32, 0.95);
    --bg-lines: rgba(0, 0, 0, 0.15);
    --bg-input-darker: rgba(0, 0, 0, 0.25);
    --bg-panel: rgba(22, 19, 39, 0.9);
}

/* Suporte Automático a Light Mode */
@media (prefers-color-scheme: light) {
    :root {
        --bg-base: #f4f5f8;
        --bg-surface: rgba(255, 255, 255, 0.75);
        --bg-surface-solid: #ffffff;
        --border-color: rgba(0, 0, 0, 0.12);
        --border-hover: rgba(168, 85, 247, 0.5);
        
        /* Aumentamos o contraste no Light Mode significativamente */
        --text-primary: #000000;
        --text-muted: #2d3748;
        
        --accent-glow: rgba(168, 85, 247, 0.05);
        --bg-base-glow: radial-gradient(circle at 50% 0%, rgba(168, 85, 247, 0.08), transparent 70%);

        --bg-header: rgba(255, 255, 255, 0.85);
        --bg-sidebar: rgba(255, 255, 255, 0.98);
        --bg-lines: rgba(0, 0, 0, 0.04);
        --bg-input-darker: rgba(0, 0, 0, 0.05);
        --bg-panel: rgba(255, 255, 255, 0.95);
    }
}

/* ==========================================================================
   RESET & CONFIGURAÇÃO GLOBAL
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Melhora feedback no Android */
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    position: relative;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

/* Efeito sutil de background radial para adicionar profundidade */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% -20%, rgba(168, 85, 247, 0.15), transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* ==========================================================================
   ESTILOS DE BOTÕES E COMPONENTES COMUNS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    gap: 8px;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.btn-block {
    width: 100%;
}

.input-block input {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

.input-block input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 12px var(--accent-glow);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.4;
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   SELETOR DE IDIOMA (PT/EN)
   ========================================================================== */

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.lang-switch button {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.lang-switch button:hover {
    color: var(--text-primary);
}

.lang-switch button:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 1px;
}

.lang-switch button[aria-pressed="true"] {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.35);
}

.lang-switch--corner {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;
}

.lang-switch--top {
    align-self: flex-end;
    margin-bottom: 8px;
}

.lang-switch--header {
    margin-left: 4px;
}

.lang-switch--card {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

/* ==========================================================================
   VISTA 1: LANDING PAGE (Criação/Acesso)
   ========================================================================== */

.landing-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    justify-content: safe center;
    padding: 24px;
    overflow-y: auto;
}

.landing-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 2.8rem;
    color: var(--secondary);
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.5));
    animation: float 4s ease-in-out infinite;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo-text span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    font-size: 1.05rem;
    color: var(--text-muted);
}

/* Card Principal Glassmorphic */
.action-card {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--blur-val));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 32px;
    transition: var(--transition-smooth);
}

.action-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 15px 35px rgba(168, 85, 247, 0.08);
}

.action-card h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.action-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Grupo de Input Personalizado de URL */
.input-group {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2px 14px;
    margin-bottom: 20px;
    transition: var(--transition-smooth);
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

.url-prefix {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    user-select: none;
}

.input-group input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 14px 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.landing-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Grid de Features */
.features-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.feature-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.feature-icon {
    font-size: 1.5rem;
    background: rgba(168, 85, 247, 0.1);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-item h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.feature-item p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.landing-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 16px;
}

/* ==========================================================================
   VISTA 2: TELA DE SENHA (Auth Card)
   ========================================================================== */

.auth-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--blur-val));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lock-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

.auth-card h2 {
    font-family: var(--font-display);
    margin-bottom: 10px;
}

.auth-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.auth-card form .input-block {
    margin-bottom: 16px;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-smooth);
}

.back-link:hover {
    color: var(--primary);
}

/* ==========================================================================
   VISTA 3: EDITOR PRINCIPAL (Tela Cheia)
   ========================================================================== */

.editor-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

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

.home-btn {
    font-size: 1.4rem;
    color: var(--text-muted);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.home-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
}

#btn-back-to-list {
    width: auto;
    min-width: 38px;
    height: 38px;
    white-space: nowrap;
    flex-shrink: 0;
}

.note-badge {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: none; /* Oculta em telas muito pequenas */
}

.note-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* Indicador de Status Real-Time */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    transition: var(--transition-smooth);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-indicator.synced .status-dot {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-indicator.saving .status-dot {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
    animation: pulse 1s infinite alternate;
}

.status-indicator.offline .status-dot {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.btn-share {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
    color: var(--text-primary);
}

.btn-share:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
}

/* Corpo do Editor */
.editor-body {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Wrapper Flexível do Editor de Código */
.editor-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Numeração de Linhas Estilo VSCode/Ghidra */
.line-numbers {
    width: 50px;
    height: 100%;
    padding: 24px 8px 24px 0;
    text-align: right;
    font-family: var(--font-mono);
    font-size: var(--editor-font-size);
    line-height: 1.6;
    color: var(--text-muted);
    background: var(--bg-lines);
    border-right: 1px solid var(--border-color);
    user-select: none;
    overflow-y: hidden; /* O scroll é controlado por JS sincronizado com a textarea */
    flex-shrink: 0;
    box-sizing: border-box;
}

.line-numbers div {
    padding-right: 8px;
    height: 1.6em; /* Altura exata por linha correspondente ao line-height */
    box-sizing: border-box;
    opacity: 0.4;
    transition: var(--transition-smooth);
}

.line-numbers div.active-line {
    color: var(--secondary);
    opacity: 1;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.editor-wrapper textarea {
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text-primary);
    font-family: var(--font-mono); /* Mesma fonte monospace */
    font-size: var(--editor-font-size); /* Tamanho de fonte dinamico */
    line-height: 1.6;             /* Mesmo line-height */
    padding: 24px 24px 24px 16px; /* Alinhamento vertical e horizontal milimétrico */
    caret-color: var(--primary);
    overflow-y: auto;
    white-space: pre-wrap;        /* Reativa a quebra automática de linha (Word Wrap) */
    overflow-wrap: break-word;
    word-wrap: break-word;        /* Quebra apenas palavras/links extremamente longos sem espaços */
    word-break: normal;           /* Evita quebras silábicas incorretas da língua portuguesa */
    box-sizing: border-box;
    position: relative;
    z-index: 2; /* Fica à frente do overlay de destaque flutuante */
}

/* Espelho de medição oculto para alinhamento em tempo real do Word-Wrap */
.editor-mirror {
    position: absolute;
    top: 0;
    left: 50px; /* Alinhado ao lado da régua de linhas */
    right: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: -100;
    height: auto;
    font-family: var(--font-mono);
    font-size: var(--editor-font-size);
    line-height: 1.6;
    padding: 24px 24px 24px 16px;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: normal;
    box-sizing: border-box;
    overflow: hidden;
}

.editor-mirror div {
    min-height: 1.6em;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: normal;
    box-sizing: border-box;
    white-space: pre-wrap;
}

/* ==========================================================================
   PAINEL DE BUSCA E SUBSTITUIÇÃO (Find & Replace)
   ========================================================================== */

.find-replace-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9;
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.find-row, .replace-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.find-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.find-input-wrapper input, .replace-row input {
    width: 100%;
    padding: 8px 75px 8px 12px; /* Espaço para o match counter */
    font-size: 0.9rem;
    font-family: var(--font-sans);
    background: var(--bg-input-darker);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-smooth);
}

.replace-row input {
    padding: 8px 12px; /* Sem contador de match */
    flex: 1;
}

.find-input-wrapper input:focus, .replace-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--accent-glow);
}

.match-count {
    position: absolute;
    right: 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    user-select: none;
    pointer-events: none;
}

.find-nav-buttons {
    display: flex;
    gap: 4px;
}

.btn-find {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-find:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

.btn-close-find {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-close-find:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.replace-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Animação slideDown */
@keyframes slideDown {
    from {
        transform: translateY(-15px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Ajustes responsivos para o painel de busca no mobile */
@media (max-width: 480px) {
    .find-replace-panel {
        padding: 10px 12px;
    }
    
    .find-row, .replace-row {
        gap: 8px;
    }
    
    .find-input-wrapper input, .replace-row input {
        padding: 6px 65px 6px 10px;
        font-size: 0.85rem;
    }
    
    .replace-row input {
        padding: 6px 10px;
    }
    
    .btn-find {
        width: 28px;
        height: 28px;
    }
    
    .btn-small {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

/* Destaque visual tipo Marca-Texto Amarelo Vibrante para busca */
.search-highlight-overlay {
    position: absolute;
    background-color: rgba(253, 224, 71, 0.65); /* Amarelo Marca-Texto Vibrante */
    border: 1.5px solid #eab308;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1; /* Fica atrás da textarea transparente mas visível */
    box-shadow: 0 0 12px rgba(253, 224, 71, 0.7);
}

mark.search-highlight-text,
.search-highlight-text {
    background-color: #facc15 !important;
    color: #000000 !important;
    font-weight: 700 !important;
    border-radius: 3px !important;
    padding: 1px 4px !important;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.6) !important;
    transition: all 0.2s ease;
}

mark.search-highlight-text.active-match,
.search-highlight-text.active-match {
    background-color: #f97316 !important; /* Laranja Vivos Marca-Texto Focado */
    color: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 0 16px rgba(249, 115, 22, 0.95) !important;
    outline: 2px solid #ea580c !important;
}

.note-card.active-search-card {
    border-color: #f97316 !important;
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.45) !important;
}

/* Rodapé do Editor com Estatísticas Glassmorphic */
.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    user-select: none;
    z-index: 10;
}

.footer-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-separator {
    opacity: 0.3;
}

.stat-item strong {
    color: var(--text-primary);
}

.footer-theme-info {
    font-family: var(--font-mono);
}

/* ==========================================================================
   OVERLAYS E MODAIS GLASSMORPHIC
   ========================================================================== */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 6, 14, 0.85);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.25s ease;
}

.overlay-card {
    position: relative;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

.shield-icon, .warning-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.shield-icon {
    color: var(--secondary);
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.4));
}

.warning-icon {
    color: var(--warning);
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
}

.overlay-card h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.overlay-card p {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Tabs para escolher Pública / Privada */
.setup-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

.setup-actions {
    margin-top: 16px;
}

/* Compartilhamento */
.share-copy-box {
    display: flex;
    background: var(--bg-input-darker);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 16px;
    align-items: center;
}

.share-copy-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
}

.share-copy-box button {
    padding: 8px 16px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.share-tip {
    font-size: 0.8rem !important;
    color: var(--text-muted);
    margin-bottom: 20px !important;
}

.conflict-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================================================
   KEYFRAMES E ANIMAÇÕES
   ========================================================================== */

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

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

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVIDADE E ADAPTAÇÃO MOBILE (ANDROID)
   ========================================================================== */

@media (min-width: 600px) {
    .landing-buttons {
        flex-direction: row;
    }
    
    .landing-buttons .btn {
        flex: 1;
    }
    
    .note-badge {
        display: inline;
    }
    
    .conflict-buttons {
        flex-direction: row;
    }
    .conflict-buttons button {
        flex: 1;
    }
}

/* Ajustes finos para Android PWA e Teclados Virtuais */
@media (max-width: 600px) {
    .landing-container {
        padding: 16px;
    }

    .lang-switch--corner {
        top: 12px;
        right: 12px;
    }

    .lang-switch--header button {
        padding: 4px 6px;
        font-size: 0.68rem;
    }
    
    .action-card {
        padding: 20px;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px;
    }
    
    .header-left {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }
    
    .header-right {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }
    
    .line-numbers {
        width: 38px;
        font-size: calc(var(--editor-font-size) * 0.85);
        padding: 16px 4px 16px 0;
    }

    .editor-wrapper textarea {
        padding: 16px;
        font-size: var(--editor-font-size);
        position: relative;
        z-index: 2; /* Fica à frente do overlay de destaque flutuante */
    }
    
    .editor-mirror {
        left: 38px; /* Alinhado ao lado da régua de linhas no mobile */
        padding: 16px; /* Sincroniza paddings exatos com a textarea no mobile */
    }
    
    .status-text {
        display: none; /* Oculta texto de status em mobile pequeno, mantém apenas a bolinha */
    }
    
    .status-indicator {
        padding: 6px;
    }
}

/* ==========================================================================
   RECURSOS AVANÇADOS PREMIUM: ZEN MODE, TIMELINE E SEGURANÇA
   ========================================================================== */

/* Sidebar do Histórico de Revisões Cyberpunk */
.history-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: var(--bg-sidebar);
    backdrop-filter: blur(var(--blur-val));
    border-left: 1px solid var(--border-color);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-sidebar.active {
    transform: translateX(0);
}

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

.history-header h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item:hover {
    border-color: var(--primary);
    background: rgba(168, 85, 247, 0.05);
    transform: translateY(-1px);
}

.history-item-time {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.btn-history-restore {
    background: rgba(168, 85, 247, 0.1);
    color: var(--primary-hover);
    border: 1px solid rgba(168, 85, 247, 0.2);
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
}

.btn-history-restore:hover {
    background: var(--primary);
    color: #ffffff;
}

/* Opções de Segurança no Compartilhamento */
.share-security-options {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: left;
}

.share-security-options h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.security-row {
    margin-bottom: 10px;
    font-size: 0.88rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.security-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

.security-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.security-row select {
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.security-row select:focus {
    border-color: var(--primary);
}

/* Estilos do Zen Mode (Modo Foco) */
.zen-mode .editor-header,
.zen-mode .line-numbers,
.zen-mode .editor-footer,
.zen-mode .find-replace-panel {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-5px);
}

.zen-mode .editor-wrapper textarea {
    padding: 40px 12%; /* Centraliza o texto como um livro físico */
    font-size: 1.15rem; /* Aumenta ligeiramente para melhor leitura */
}

/* Transições fluidas para entrar e sair do Zen Mode */
.editor-header, .line-numbers, .editor-footer, .find-replace-panel {
    transition: opacity 0.3s ease, transform 0.3s ease, var(--transition-smooth);
}

.editor-wrapper textarea {
    transition: padding 0.3s ease, font-size 0.3s ease, var(--transition-smooth);
}

/* Botão flutuante sutil do Zen Mode no canto inferior direito quando ativo */
.zen-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--primary-hover);
    cursor: pointer;
    z-index: 999;
    font-size: 1.1rem;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
    transition: var(--transition-smooth);
}

.zen-indicator:hover {
    background: var(--primary);
    color: #ffffff;
    transform: scale(1.1);
}

.zen-mode .zen-indicator {
    display: flex; /* Exibe apenas no Zen Mode */
}

/* Sincronização e Responsividade da Sidebar de Histórico no Mobile */
@media (max-width: 480px) {
    .history-sidebar {
        width: 100%; /* Ocupa tela cheia no mobile */
    }
    
    .zen-mode .editor-wrapper textarea {
        padding: 24px 16px; /* Ajuste suave de escrita imersiva para tela pequena */
        font-size: 1.05rem;
    }
}

/* ==========================================================================
   ESTILOS PREMIUM DA CHAVE DE RECUPERAÇÃO MESTRA (Dual-Key Banner)
   ========================================================================== */

.recovery-key-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(22, 19, 39, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--secondary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 8;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.banner-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--secondary);
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
}

.banner-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.banner-key {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(6, 182, 212, 0.3);
    margin-top: 6px;
    display: inline-block;
    width: max-content;
    letter-spacing: 1px;
    user-select: all;
}

.banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-banner-copy {
    padding: 8px 16px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid var(--secondary);
    background: rgba(6, 182, 212, 0.1);
    color: var(--secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-banner-copy:hover {
    background: var(--secondary);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.btn-banner-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-banner-close:hover {
    color: var(--danger);
    transform: scale(1.1);
}

/* Responsividade do banner no mobile */
@media (max-width: 768px) {
    .recovery-key-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .banner-key {
        font-size: 0.95rem;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    
    .banner-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==========================================================================
   ESTILOS ADICIONAIS: WORKSPACE E TELAS ALTERNADAS (LISTA VS EDITOR)
   ========================================================================== */

/* Ajusta o container do editor para layouts de visualização única */
.editor-body {
    display: block;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   TELA 1: LISTA DE NOTAS (WORKSPACE LIST VIEW)
   -------------------------------------------------------------------------- */
.workspace-list-view {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: 40px 24px;
    box-sizing: border-box;
    background: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.workspace-list-view::-webkit-scrollbar {
    width: 6px;
}

.workspace-list-view::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.workspace-list-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.3s ease-out;
}

.workspace-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.workspace-title span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Grid de Cards */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    width: 100%;
    padding-bottom: 40px;
}

/* Card de Nota Padrão */
.note-card {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--blur-val));
    -webkit-backdrop-filter: blur(var(--blur-val));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 150px;
    transition: var(--transition-smooth);
    position: relative;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

.note-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 10px 25px rgba(168, 85, 247, 0.12);
    transform: translateY(-4px);
}

.note-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    margin-right: 18px; /* Espaço para o botão de deletar */
}

.note-card-icon {
    font-size: 1.15rem;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 2px;
    transition: var(--transition-smooth);
}

.note-card:hover .note-card-icon {
    color: var(--primary);
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}

.note-card-title {
    font-family: var(--font-sans);
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.note-card-body {
    flex: 1;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.note-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* Botão de Deletar Card */
.note-card-delete {
    position: absolute;
    top: 14px;
    right: 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    opacity: 0; /* Oculto por padrão, surge no hover */
    transition: var(--transition-smooth);
    cursor: pointer;
    font-size: 0.95rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.note-card:hover .note-card-delete {
    opacity: 0.5;
}

.note-card-delete:hover {
    opacity: 1 !important;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger) !important;
    transform: scale(1.1);
}

/* Card de Criação de Nota */
.note-card-create {
    border: 2px dashed var(--border-color);
    background: rgba(255, 255, 255, 0.01);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 150px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-smooth);
    box-sizing: border-box;
}

.note-card-create:hover {
    border-color: var(--secondary);
    background: rgba(6, 182, 212, 0.02);
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.12);
    transform: translateY(-4px);
}

.create-icon {
    font-size: 2rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.note-card-create:hover .create-icon {
    color: var(--secondary);
    transform: scale(1.15);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.create-text {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.note-card-create:hover .create-text {
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   TELA 2: WORKSPACE DE EDIÇÃO (EDITOR VIEW)
   -------------------------------------------------------------------------- */
.editor-workspace {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    position: relative;
    animation: fadeIn 0.25s ease-out;
}

/* Campo de Título Ativo */
.active-note-title-wrapper {
    padding: 16px 24px 6px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    background: transparent;
}

.active-note-title-wrapper input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.3px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
    border-bottom: 2px solid transparent;
}

.active-note-title-wrapper input:focus {
    border-bottom-color: rgba(168, 85, 247, 0.3);
    background: rgba(255, 255, 255, 0.01);
}

/* Animação de entrada suave */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsividade Mobile e Tablet */
@media (max-width: 768px) {
    .workspace-list-view {
        padding: 24px 16px;
    }
    
    .workspace-title {
        font-size: 1.5rem;
    }
    
    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
    }
    
    .note-card, .note-card-create {
        min-height: 130px;
        padding: 16px;
    }
    
    .note-card-delete {
        opacity: 0.6; /* Exibe por padrão no mobile devido à falta de hover */
    }
    
    .active-note-title-wrapper {
        padding: 12px 16px 4px 12px;
    }
    
    .active-note-title-wrapper input {
        font-size: 1.25rem;
    }
    
    .editor-wrapper textarea {
        padding: 16px 16px 16px 10px;
    }
    
    .line-numbers {
        padding: 16px 6px 16px 0;
        width: 44px;
    }
}

/* ==========================================================================
   MENU DE CONTEXTO (LONG PRESS) — FAVORITAR / FIXAR
   ========================================================================== */

/* Overlay invisível para fechar o menu ao clicar fora */
.context-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: transparent;
}

/* Menu flutuante glassmorphic */
.note-context-menu {
    position: fixed;
    z-index: 1000;
    min-width: 180px;
    background: rgba(30, 27, 50, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(139, 92, 246, 0.15);
    padding: 6px 0;
    animation: contextMenuIn 0.15s ease-out;
    overflow: hidden;
}

@keyframes contextMenuIn {
    from { opacity: 0; transform: scale(0.92) translateY(-4px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.context-menu-item:hover {
    background: rgba(139, 92, 246, 0.18);
}

.context-menu-item .ctx-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.context-menu-item.active-option {
    color: var(--secondary);
}

/* Separador no menu de contexto */
.context-menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 12px;
}

/* --------------------------------------------------------------------------
   INDICADORES VISUAIS NOS CARDS (PIN E FAVORITO)
   -------------------------------------------------------------------------- */

/* Badge de indicadores (pin + estrela) no cabeçalho do card */
.note-card-badges {
    display: flex;
    gap: 5px;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
}

.badge-pin, .badge-fav {
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.9;
}

.badge-pin {
    color: var(--secondary);
}

.badge-fav {
    color: #fbbf24; /* Dourado */
}

/* Card favoritado recebe borda dourada sutil */
.note-card.is-favorited {
    border-color: rgba(251, 191, 36, 0.35);
}

.note-card.is-favorited:hover {
    border-color: rgba(251, 191, 36, 0.6);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.12), 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Card fixado recebe um indicador visual na borda superior */
.note-card.is-pinned {
    border-top: 2px solid var(--secondary);
}
