/* =========================================
   1. GLOBAL RESET & BACKGROUND
   ========================================= */
body, html {
    margin: 0; padding: 0; width: 100%; min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    background-color: #000000; color: #ffffff; overflow-x: hidden;
}

button, input, select, .note-header h3, h3, ::placeholder, .backlinks-box {
    text-transform: lowercase;
}

/* =========================================
   2. VIEW CONTROLLER
   ========================================= */
.view {
    display: none; flex-direction: column; align-items: center;
    width: 100%; min-height: 100vh; box-sizing: border-box;
    opacity: 0; transform: scale(0.98);
}
.view.active { display: flex; animation: snapIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes snapIn { to { opacity: 1; transform: scale(1); } }

#view-menu, #view-new, #view-note, #view-login { justify-content: center; padding: 20px; }
#view-search { justify-content: flex-start; padding: 80px 20px 40px 20px; }

/* =========================================
   3. MENU BUTTONS
   ========================================= */
.menu-container { display: flex; flex-direction: column; gap: 15px; align-items: center; }
.menu-btn {
    background: transparent; border: none; color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem; cursor: pointer; padding: 10px 20px;
    transition: all 0.15s ease;
}
.menu-btn:hover { color: #ffffff; transform: scale(1.05); text-shadow: 0 0 15px rgba(255, 255, 255, 0.3); }

/* =========================================
   4. LIQUID GLASS
   ========================================= */
.glass-panel, .hidden-modal {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 35%, rgba(0, 0, 0, 0.2) 60%, rgba(0, 255, 163, 0.02) 85%, rgba(0, 255, 163, 0.04) 100%);
    backdrop-filter: blur(30px) saturate(120%); -webkit-backdrop-filter: blur(30px) saturate(120%);
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.04); border-top: 1px solid rgba(255, 255, 255, 0.25); border-left: 1px solid rgba(255, 255, 255, 0.12); border-bottom: 1px solid rgba(0, 0, 0, 0.9);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.9), inset 2px 2px 4px rgba(255, 255, 255, 0.15), inset 6px 6px 15px rgba(255, 255, 255, 0.05), inset -5px -5px 20px rgba(0, 0, 0, 0.8);
    width: 100%; max-width: 650px; display: flex; flex-direction: column; overflow: hidden;
}

.view-header { width: 100%; max-width: 650px; margin-bottom: 20px; }
.back-btn { background: none; border: none; color: rgba(255, 255, 255, 0.3); cursor: pointer; transition: color 0.15s ease; padding: 0; }
.back-btn:hover { color: #ffffff; }

/* =========================================
   5. INPUTS & TOOLBAR
   ========================================= */
.glass-input, .glass-btn {
    width: 100%; background: transparent; border: none; color: #ffffff;
    padding: 22px 25px; font-size: 1rem; font-family: inherit; box-sizing: border-box;
}
.glass-input:focus { outline: none; background: rgba(255, 255, 255, 0.02); }
.glass-input::placeholder { color: rgba(255, 255, 255, 0.2); }
.title-input { font-size: 1.5rem; font-weight: 600; }

.editor-toolbar { display: flex; gap: 8px; padding: 12px 25px; background: rgba(255, 255, 255, 0.02); border-bottom: 1px solid rgba(255, 255, 255, 0.03); align-items: center; }
.toolbar-btn {
    background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: all 0.15s ease; font-family: inherit;
}
.toolbar-btn:hover { background: rgba(255, 255, 255, 0.1); }
.toolbar-btn.active { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.4); color: #fff; box-shadow: inset 0 1px 3px rgba(0,0,0,0.3); }
select.toolbar-btn { appearance: none; -webkit-appearance: none; }
select.toolbar-btn option { background: #121212; color: #fff; }

.link-btn { margin-left: auto; background: transparent; border: none; color: rgba(0, 255, 163, 0.7); font-weight: 500; }
.link-btn:hover { background: transparent; color: rgba(0, 255, 163, 1); text-shadow: 0 0 10px rgba(0, 255, 163, 0.3); }

.content-input { height: 300px; overflow-y: auto; cursor: text; border-radius: 0; line-height: 1.6; text-transform: none; }
.content-input[contenteditable]:empty::before { content: attr(placeholder); color: rgba(255, 255, 255, 0.2); pointer-events: none; display: block; }
.glass-btn { background: rgba(255, 255, 255, 0.02); border-top: 1px solid rgba(255, 255, 255, 0.05); cursor: pointer; font-weight: 500; }
.glass-btn:hover { background: rgba(255, 255, 255, 0.06); }

/* =========================================
   6. NOTE CARDS & LINKS (Search List)
   ========================================= */
.content-input h1, .note-card h1, #note-view-content h1 { font-size: 1.8rem; margin: 0.2em 0 0.5em 0; font-weight: 600; text-transform: lowercase;}
.content-input h2, .note-card h2, #note-view-content h2 { font-size: 1.4rem; margin: 0.2em 0 0.5em 0; font-weight: 500; text-transform: lowercase;}
.content-input h3, .note-card h3, #note-view-content h3 { font-size: 1.1rem; margin: 0.2em 0 0.5em 0; font-weight: 500; color: #aaa; text-transform: lowercase;}
.content-input p, .note-card p, #note-view-content p { margin: 0 0 1em 0; }

.note-container { width: 100%; max-width: 650px; display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
.note-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.03); border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), inset 1px 1px 2px rgba(255, 255, 255, 0.05); 
    padding: 20px 25px; transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}
.note-card:hover { 
    border-top-color: rgba(255, 255, 255, 0.3); 
    transform: translateY(-2px); 
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.note-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.note-header h3 { margin: 0; font-weight: 600; font-size: 1.25rem; }
.note-card .note-body { 
    line-height: 1.6; color: rgba(255, 255, 255, 0.6); font-size: 1rem; 
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; 
}

.action-btns { display: flex; gap: 12px; align-items: center; }
.action-btn { background: transparent; border: none; cursor: pointer; font-size: 0.9rem; transition: color 0.15s; padding: 0; }
.edit-btn { color: rgba(255, 255, 255, 0.5); }
.edit-btn:hover { color: #ffffff; }
.delete-btn { color: rgba(255, 76, 76, 0.5); }
.delete-btn:hover { color: #ff4c4c; }
.cancel-btn-icon { color: rgba(255, 255, 255, 0.3); font-size: 1.2rem; }
.cancel-btn-icon:hover { color: #ffffff; }

.zettel-link { color: #00ffa3; text-decoration: none; font-weight: 500; background: rgba(0, 255, 163, 0.1); padding: 2px 6px; border-radius: 4px; transition: all 0.15s ease; text-transform: lowercase; }
.zettel-link:hover { background: rgba(0, 255, 163, 0.2); box-shadow: 0 0 8px rgba(0, 255, 163, 0.4); }
.backlinks-box { margin-top: 15px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.05); font-size: 0.85em; color: rgba(255, 255, 255, 0.4); }

/* =========================================
   7. LINK MODAL 
   ========================================= */
.hidden-modal { 
    display: none; position: fixed; top: 50%; left: 50%; 
    transform: translate(-50%, -50%) scale(0.95); z-index: 1000; 
    width: 90%; max-width: 400px; height: auto; 
}
.hidden-modal.active { display: flex; animation: snapIn 0.2s forwards; }

#link-modal h3 { margin: 25px 25px 15px 25px; }
.modal-results { max-height: 200px; overflow-y: auto; margin: 0 25px 15px 25px; display: flex; flex-direction: column; gap: 5px; }
.modal-item { padding: 10px 15px; background: rgba(255, 255, 255, 0.03); border-radius: 6px; cursor: pointer; text-transform: lowercase; }
.modal-item:hover { background: rgba(255, 255, 255, 0.1); }
.cancel-btn { color: #ff4c4c; background: rgba(255, 76, 76, 0.05); }
.cancel-btn:hover { background: rgba(255, 76, 76, 0.1); }

/* =========================================
   8. TAGS, HIVE & MINIMAL LOGIN
   ========================================= */
.zettel-tag {
    color: #2563eb; 
    font-weight: 500;
    cursor: pointer;
    background: rgba(37, 99, 235, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
}
.zettel-tag:hover { background: rgba(37, 99, 235, 0.25); text-shadow: 0 0 8px rgba(37, 99, 235, 0.4); }

.editor-tag { color: #2563eb; font-weight: 500; }

.vis-network:focus { outline: none; }

.minimal-input {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
    font-family: inherit;
    text-align: center;
    width: 250px;
    outline: none;
    transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: text;
}
.minimal-input:focus { color: #ffffff; text-shadow: 0 0 15px rgba(255, 255, 255, 0.3); }
.minimal-input::placeholder { color: rgba(255, 255, 255, 0.4); text-transform: lowercase; }

/* =========================================
   10. BILDER IM EDITOR & LESE-MODUS
   ========================================= */
.note-body img, .content-input img { 
    max-width: 100%; 
    border-radius: 12px; 
    margin: 15px 0; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    display: block; 
}

/* =========================================
   11. ABSOLUTE EXPORT BUTTON GEOMETRY
   ========================================= */
.export-bottom-btn {
    position: absolute;
    bottom: 40px;
    font-size: 0.9rem !important;
    opacity: 0.4;
}