:root { --bg-body: #F4F4F5; --bg-paper: #FFFFFF; --text-main: #18181B; --text-muted: #A1A1AA; --border-color: #E4E4E7; --accent: #2563EB; --danger: #EF4444; --shadow: 0 10px 15px -3px rgba(0,0,0,0.1); --font-family: 'Inter', sans-serif; }
@media (prefers-color-scheme: dark) { :root { --bg-body: #18181B; --bg-paper: #27272A; --text-main: #E4E4E7; --border-color: #3F3F46; --shadow: 0 10px 15px -3px rgba(0,0,0,0.5); } }
body { margin: 0; font-family: var(--font-family); background-color: var(--bg-body); color: var(--text-main); display: flex; justify-content: center; min-height: 100vh; overflow-x: hidden; }
.app-container { width: 100%; max-width: 950px; margin-top: 40px; margin-bottom: 100px; padding: 0 20px; box-sizing: border-box; position: relative; z-index: 1; }

/* HOVER TRIGGER */
.hover-trigger { position: fixed; top: 0; left: 0; width: 20px; height: 100%; background: transparent; z-index: 2500; display: block; }

/* SIDEBAR */
.sidebar { position: fixed; left: -320px; top: 0; width: 300px; height: 100%; background-color: var(--bg-paper); box-shadow: 4px 0 15px rgba(0,0,0,0.1); z-index: 2000; transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; padding: 20px; box-sizing: border-box; }
.sidebar.open { left: 0; }
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 1999; opacity: 0; pointer-events: none; transition: opacity 0.3s; backdrop-filter: blur(2px); }
.sidebar-overlay.visible { opacity: 1; pointer-events: auto; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.add-note-btn { background: var(--accent); color: white; width: 30px; height: 30px; border-radius: 50%; display: flex; justify-content: center; align-items: center; padding: 0; font-size: 20px; }
.notes-list { flex-grow: 1; overflow-y: auto; margin-bottom: 10px; }
.note-item { padding: 10px; margin-bottom: 5px; border-radius: 6px; cursor: pointer; background: var(--bg-body); font-size: 14px; display: flex; justify-content: space-between; align-items: center; border: 1px solid transparent; }
.note-item.active { border-color: var(--accent); background: rgba(37,99,235,0.1); color: var(--accent); }
.delete-note:hover { color: var(--danger); }

/* AUTH */
.auth-section { margin-top: auto; border-top: 1px solid var(--border-color); padding-top: 15px; }
.auth-btn { width: 100%; text-align: left; background: rgba(37,99,235,0.1); color: var(--accent); margin-bottom: 5px; border-radius: 8px; padding: 10px; }
.auth-btn.logout { background: rgba(239,68,68,0.1); color: var(--danger); }
.close-sidebar-btn { width: 100%; padding: 10px; margin-top: 5px; background: var(--bg-body); color: var(--text-muted); border-radius: 8px; }
.auth-input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-body); color: var(--text-main); box-sizing: border-box; }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

/* TOOLBAR */
.toolbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; margin-bottom: 20px; user-select: none; gap: 10px; flex-wrap: wrap; }
.tools-left, .tools-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
button { background: none; border: none; cursor: pointer; font-family: inherit; font-weight: 600; color: var(--text-muted); padding: 8px; border-radius: 6px; transition: 0.2s; white-space: nowrap; }
button:hover { color: var(--text-main); background: rgba(0,0,0,0.05); }
.btn-primary { color: var(--accent); }
.magic-btn:hover { color: #F59E0B; transform: scale(1.1); }
#editor { background: var(--bg-paper); min-height: 70vh; padding: 60px; border-radius: 12px; box-shadow: var(--shadow); font-size: 18px; line-height: 1.7; outline: none; border: 1px solid transparent; }
#editor:focus { border-color: var(--border-color); }
#editor:empty:before { content: attr(placeholder); color: var(--text-muted); display: block; }
.separator { width: 1px; height: 20px; background: var(--border-color); }
.status-indicator { font-size: 12px; color: var(--text-muted); opacity: 0; transition: 0.5s; }
.status-indicator.visible { opacity: 1; }

/* MODALS (OLD) */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 3000; justify-content: center; align-items: center; backdrop-filter: blur(2px); }
.modal.visible { display: flex; }
.modal-content { background: var(--bg-paper); padding: 20px; border-radius: 12px; width: 90%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.ai-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.ai-options button { background: var(--bg-body); padding: 15px; border: 1px solid var(--border-color); border-radius: 8px; flex-direction: column; display: flex; gap: 5px; color: var(--text-main); }
.ai-options button:hover { border-color: var(--accent); color: var(--accent); }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; max-height: 300px; overflow-y: auto; margin: 15px 0; }
.emoji-btn { font-size: 24px; padding: 5px; } .emoji-btn:hover { transform: scale(1.2); }
.close-modal { width: 100%; padding: 10px; border: 1px solid var(--border-color); color: var(--text-muted); }

/* --- ÍÎÂÎÅ ÂÑÏËÛÂÀÞÙÅÅ ÌÅÍÞ (COLOR POPUP) --- */
.color-popup {
    display: none;
    position: absolute;
    z-index: 5000;
    background: var(--bg-paper);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    animation: popIn 0.1s ease-out;
}
.color-popup.visible { display: block; }
.color-row { display: flex; gap: 8px; }
.color-option {
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1); cursor: pointer; transition: transform 0.1s; padding: 0;
}
.color-option:hover { transform: scale(1.2); border-color: var(--accent); }
.remove-option {
    background: transparent; border: 1px dashed var(--text-muted);
    color: var(--text-muted); font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.remove-option:hover { border-color: var(--danger); color: var(--danger); }
@keyframes popIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* MIC FAB */
.mic-btn { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: white; box-shadow: 0 4px 15px rgba(37,99,235,0.4); font-size: 24px; display: flex; justify-content: center; align-items: center; z-index: 1000; transition: 0.2s; }
.mic-btn:active { transform: scale(0.9); }
.mic-btn.recording { background: var(--danger); animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* MOBILE */
@media (max-width: 600px) {
    .hover-trigger { display: none; }
    .app-container { padding: 0 15px; margin-top: 15px; margin-bottom: 80px; }
    #editor { padding: 20px; font-size: 16px; min-height: 60vh; }
    .toolbar { justify-content: space-between; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; min-width: 100%; }
    .toolbar::-webkit-scrollbar { display: none; }
    .desktop-only { display: flex !important; }
    .separator, .stats-text, #ai-balance { display: none !important; }
    .ai-options { grid-template-columns: 1fr; }
    .emoji-grid { grid-template-columns: repeat(5, 1fr); }
    .mic-btn { bottom: 20px; right: 20px; }
}
@media print { .toolbar, .mic-btn, .sidebar, .modal { display: none !important; } body, .app-container { background: white; margin: 0; padding: 0; max-width: 100%; } #editor { box-shadow: none; border: none; } }