:root {
    /* Light Mode (Default) */
    --bg-color: #f3f4f6;
    --sidebar-bg: #ffffff;
    --text-color: #1f2937;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #e5e7eb;
    --sidebar-width: 300px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --input-bg: #ffffff;
    --header-height: 64px;
}

body.dark-mode {
    /* Dark Mode Overrides */
    --bg-color: #111827;
    --sidebar-bg: #1f2937;
    --text-color: #f3f4f6;
    --border-color: #374151;
    --input-bg: #374151;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: block;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

.app-shell {
    display: flex;
    height: 100vh;
    width: 100%;
}

.landing-active {
    overflow: auto;
    background: radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.12), transparent 30%), radial-gradient(circle at 80% 0%, rgba(20, 184, 166, 0.1), transparent 32%), var(--bg-color);
}

.landing {
    min-height: 100vh;
    padding: 5.5rem 6vw 3rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background: #0f172a;
    color: #e5e7eb;
    position: relative;
    overflow: hidden;
}

.landing .logo-title {
    color: #e5e7eb;
}

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 6vw;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 120;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.landing-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #3b82f6;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: white;
    letter-spacing: 0.5px;
    box-shadow: 0 15px 45px rgba(99, 102, 241, 0.35);
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-subtitle {
    font-size: 0.875rem;
    color: #94a3b8;
}

.landing-actions {
    display: flex;
    gap: 0.75rem;
}

.landing-ambient {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    filter: blur(45px);
    opacity: 0.45;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.orb-1 { background: #2563eb; top: -60px; left: -40px; }
.orb-2 { background: #22c55e; top: 40%; left: -120px; }
.orb-3 { background: #f59e0b; bottom: -120px; right: 10%; }
.orb-4 { background: #0ea5e9; top: 10%; right: -60px; }

.landing-btn {
    border: 1px solid #334155;
    background: #1f2937;
    color: #e2e8f0;
    padding: 0.65rem 1.2rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.landing-btn.solid {
    background: #2563eb;
    border: none;
    color: #e5e7eb;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

.landing-btn.ghost:hover,
.landing-btn.solid:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

.landing-btn.large {
    padding: 0.8rem 1.5rem;
}

.landing-hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.landing-copy h1 {
    font-size: clamp(2.5rem, 3vw, 3rem);
    line-height: 1.1;
    margin: 0.5rem 0 0.75rem;
    color: #f8fafc;
}

.landing-copy .lede {
    color: #cbd5e1;
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 640px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #a5b4fc;
    font-size: 0.85rem;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    margin: 1.25rem 0;
}

.hero-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.landing-visual {
    display: flex;
    justify-content: flex-end;
}

.glass-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.5rem;
    padding: 1.5rem;
    width: min(480px, 100%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
}

.glass-card .pill {
    display: inline-flex;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 0.85rem;
}

.glass-card .card-title {
    margin-top: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #e5e7eb;
}

.glass-card p {
    color: #cbd5e1;
    margin-top: 0.35rem;
}

.mock-editor {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    background: #0f172a;
    color: #e2e8f0;
    font-family: "Source Code Pro", "Fira Code", Consolas, monospace;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mock-line {
    line-height: 1.6;
}

.mock-line .muted {
    color: #64748b;
}

.mock-line .accent {
    color: #a5b4fc;
}

.mock-line.indent {
    padding-left: 1rem;
}

.landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    color: #e5e7eb;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

.feature-icon {
    font-size: 1.6rem;
}

.feature-card h3 {
    margin: 0.35rem 0;
    font-size: 1.1rem;
}

.feature-card p {
    color: #cbd5e1;
    line-height: 1.5;
}

.landing-footer {
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: center;
}

.landing-footer a {
    color: inherit;
}

.landing-footer .logo-mark.small {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    color: #cbd5e1;
}

.footer-links a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.footer-links a:hover {
    color: #e5e7eb;
}

.footer-meta {
    color: #94a3b8;
    font-size: 0.95rem;
}

.landing button:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.3s ease, background-color 0.3s;
    position: relative;
}

.sidebar-header {
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--header-height);
    height: var(--header-height);
    box-sizing: border-box;
}

.btn-new-group {
    position: relative;
}

.btn-new-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-width: 180px;
    z-index: 30;
}

.btn-new-dropdown .menu-item {
    width: 100%;
    justify-content: flex-start;
    font-weight: 600;
}

.btn-new-dropdown .menu-item:hover {
    background-color: var(--input-bg);
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-color);
}

.btn-new {
    background-color: #8b5cf6;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    min-width: 100px;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-new:hover {
    background-color: #7c3aed;
}

#btn-export {
    background-color: #f59e0b !important;
    min-width: 100px;
}

#btn-export:hover {
    background-color: #d97706 !important;
}

.search-bar {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.search-input:focus {
    border-color: var(--accent-color);
}

.guest-banner {
    margin: 0 1rem 0.5rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    background: #ecfeff;
    border: 1px solid #bae6fd;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.guest-save-btn {
    background: #0ea5e9;
    border: none;
    color: white;
    padding: 0.45rem 0.8rem;
    border-radius: 0.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guest-save-btn:hover {
    background: #0284c7;
}

.notes-toggle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
    padding: 0 1rem 0.5rem;
}

.toggle-btn {
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    padding: 0.45rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}

.notes-list {
    flex: 1;
    overflow-y: auto;
}

.empty-row {
    padding: 1rem 1.5rem;
    color: #6b7280;
}

.note-item {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    gap: 0.5rem;
}

.note-item:hover {
    background-color: var(--bg-color);
}

.note-item.active {
    background-color: var(--bg-color);
    border-left: 3px solid var(--accent-color);
}

.note-item.deleted {
    opacity: 0.75;
    background: #fef2f2;
    border-left-color: #fca5a5;
}

.note-content {
    flex: 1;
    min-width: 0;
}

.note-title {
    font-weight: 600;
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.note-preview {
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-date {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.note-menu {
    position: relative;
    flex-shrink: 0;
}

.note-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-color);
    opacity: 0.5;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
}

.note-item:hover .note-menu-btn {
    opacity: 1;
}

.note-menu-btn:hover {
    background: var(--bg-color);
    opacity: 1;
}

.note-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 120px;
    z-index: 100;
    display: none;
    margin-top: 0.25rem;
    overflow: hidden;
}

.note-menu-dropdown.show {
    display: block;
}

.menu-item {
    width: 100%;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-color);
    transition: background-color 0.2s;
    display: block;
}

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

.menu-item-danger {
    color: #ef4444;
}

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

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

.password-input-container {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
}

.password-input-container .modal-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 0.875rem;
    margin-bottom: 0;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.password-input-container .modal-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.6;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.modal-input {
    width: 100%;
    padding: 0.875rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.sidebar-footer {
    display: none;
}

/* Floating WhatsApp Button */
.floating-whatsapp {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
}

.floating-whatsapp:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
    background-color: #20BA5A;
}

.floating-whatsapp:active {
    transform: scale(0.95);
}

.floating-whatsapp svg {
    width: 28px;
    height: 28px;
    display: block;
}

.footer-content {
    text-align: center;
}

.footer-text {
    font-size: 0.75rem;
    color: var(--text-color) !important;
    opacity: 1 !important;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    font-weight: 400;
}

.footer-text strong {
    opacity: 1;
    font-weight: 600;
}

.footer-contact {
    font-size: 0.75rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.footer-contact a {
    color: var(--accent-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

.footer-contact a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.footer-link {
    margin-top: 0.75rem;
}

.footer-link a {
    font-size: 0.875rem;
    color: #25D366;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: opacity 0.2s;
}

.footer-link a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Main Editor */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
}

.editor-header {
    padding: 0.875rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--sidebar-bg);
    min-height: var(--header-height);
    height: var(--header-height);
    box-sizing: border-box;
    gap: 1rem;
}

.editor-header .editor-title-input {
    flex: 1;
    min-width: 0;
}

.editor-title-input {
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    outline: none;
    width: 100%;
    color: var(--text-color);
    background-color: transparent;
}

.editor-title-input::placeholder {
    color: #9ca3af;
}

.save-status {
    font-size: 0.85rem;
    color: #16a34a;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
}

.save-status.saving {
    color: #ca8a04;
    background: #fef9c3;
    border-color: #fde68a;
}

.save-status.unsaved {
    color: #dc2626;
    background: #fee2e2;
    border-color: #fecdd3;
}

.btn-copy-content {
    background-color: #14b8a6;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    min-width: 100px;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-copy-content:hover {
    background-color: #0d9488;
}

.btn-copy-content.copied {
    background-color: #10b981;
}

.btn-copy-content.copied:hover {
    background-color: #059669;
}

.btn-share {
    background-color: #6366f1;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    min-width: 100px;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-share:hover {
    background-color: #4f46e5;
}

.btn-delete {
    background-color: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    padding: 0.5rem 1.5rem;
    min-width: 100px;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background-color: #ef4444;
    color: white;
}

.editor-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.control-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--input-bg);
    color: var(--text-color);
    min-width: 180px;
}

.control-button {
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.control-button:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.content-search-buttons {
    display: flex;
    gap: 0.25rem;
}

.content-search-floating {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    padding: 0.35rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 50;
}

.content-search-floating .control-input {
    min-width: 240px;
    border: none;
    background: transparent;
    padding-left: 0.85rem;
}

.content-search-floating .control-button {
    border-radius: 999px;
}

.file-input-hidden {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.header-menu-container {
    position: relative;
}

.header-menu-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 40px;
    height: 40px;
}

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

.header-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 100;
    margin-top: 0.5rem;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.header-dropdown .menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.control-select {
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--input-bg);
    font-size: 0.875rem;
    color: var(--text-color);
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
}

.control-select:hover {
    border-color: var(--accent-color);
}

.control-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.editor-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    padding: 0;
}

#ace-editor {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    font-size: 14px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-size: 1.125rem;
    gap: 1.5rem;
    padding: 2rem;
}

.empty-state p {
    margin: 0;
}

.btn-new-empty {
    background-color: #8b5cf6;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-new-empty:hover {
    background-color: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

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

.btn-logout-icon {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 40px;
    height: 40px;
}

.btn-logout-icon:hover {
    background-color: var(--input-bg);
    border-color: #ef4444;
    color: #ef4444;
}

.hidden {
    display: none !important;
}

/* Login Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-box {
    background: var(--sidebar-bg);
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-box h2 {
    margin-bottom: 0.75rem;
    color: var(--text-color);
    font-size: 1.75rem;
    font-weight: 700;
}

.modal-box p {
    margin-bottom: 1.75rem;
    color: var(--text-color);
    opacity: 0.75;
    line-height: 1.6;
    font-size: 0.95rem;
}

.modal-box input {
    width: 100%;
    padding: 0.875rem;
    margin-bottom: 1.75rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.modal-box input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.modal-actions button {
    padding: 0.5rem 1.5rem;
    border: none;
    min-width: 100px;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s;
}

.modal-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--border-color) !important;
    color: var(--text-color);
}

.btn-secondary:hover {
    background: var(--input-bg);
}

/* Lock Button - Deep Blue/Indigo */
.btn-lock {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: white;
}

.btn-lock:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Unlock Button - Teal/Cyan */
.btn-unlock {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: white;
}

.btn-unlock:hover {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

/* Delete Button - Red */
.btn-delete-modal {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-delete-modal:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Cancel Button - Slate Gray */
.btn-cancel {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
}

.btn-cancel:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

/* Close Button - Neutral Gray */
.btn-close {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-close:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

/* OK Button - Emerald Green */
.btn-ok {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-ok:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.modal-confirm {
    max-width: 400px;
}

.modal-share {
    max-width: 500px;
}

.modal-share .small-text {
    margin-top: 0.25rem !important;
    margin-bottom: 1.5rem !important;
}

.modal-notification {
    max-width: 400px;
}

/* Login Step Styles */
.login-step {
    display: block;
}

.login-step.hidden {
    display: none;
}

.login-option {
    transition: all 0.3s ease;
}

.login-option:hover {
    border-color: #3b82f6 !important;
    background-color: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

body.dark-mode .login-option:hover {
    background-color: #1e293b;
    border-color: #3b82f6 !important;
}

.notification-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.notification-icon.success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.notification-icon.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.notification-icon.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.notification-icon.info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.modal-notification h2 {
    margin-bottom: 0.5rem;
}

.modal-notification p {
    margin-bottom: 1.5rem;
}

.share-link-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.share-link-label {
    font-size: 0.875rem;
    color: var(--text-color);
    opacity: 0.7;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, color 0.2s;
    user-select: none;
}

.share-link-label:hover {
    opacity: 1;
}

.share-link-label.copied {
    color: #10b981;
    opacity: 1;
    font-weight: 600;
}

.share-link-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.875rem;
    font-family: monospace;
    outline: none;
    transition: border-color 0.2s, cursor 0.2s;
    line-height: 1.5;
    box-sizing: border-box;
    cursor: pointer;
}

.share-link-input:hover {
    border-color: var(--accent-color);
}

.share-link-input:focus {
    border-color: var(--accent-color);
    cursor: text;
}

.small-text {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-bottom: 0 !important;
    font-style: italic;
}

/* Mobile Menu Toggle Button */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

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

.menu-toggle:active {
    background-color: var(--input-bg);
    opacity: 0.8;
}

.menu-toggle svg {
    display: block;
    pointer-events: none;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    pointer-events: all;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .landing {
        padding: 4.5rem 1.25rem 2.5rem;
        gap: 1.5rem;
    }

    .landing-nav {
        flex-direction: column;
        align-items: flex-start;
        position: sticky;
        top: 0;
    }

    .landing-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .landing-hero {
        grid-template-columns: 1fr;
    }

    .landing-visual {
        justify-content: center;
    }

    .glass-card {
        width: 100%;
    }

    /* Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 75vw;
        max-width: 300px;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

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

    .sidebar-overlay {
        display: block;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Menu Toggle */
    .menu-toggle {
        display: flex !important;
        margin-right: 0.75rem;
        flex-shrink: 0;
        z-index: 10;
        position: relative;
    }

    /* Main Editor */
    .main {
        width: 100%;
    }

    .editor-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .editor-title-input {
        font-size: 1.125rem;
        flex: 1;
        min-width: 0;
    }

    .editor-controls {
        flex-wrap: wrap;
        gap: 0.375rem;
        width: 100%;
        margin-top: 0.5rem;
    }

    .control-select {
        font-size: 0.875rem;
        padding: 0.5rem 2rem 0.5rem 0.75rem;
        min-width: 120px;
        flex: 1;
        min-width: calc(50% - 0.1875rem);
    }

    .editor-controls button {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
        min-width: auto;
        flex: 1;
        min-width: calc(50% - 0.1875rem);
    }

    .control-input {
        width: 100%;
    }

    .content-search-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .content-search-floating {
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        transform: none;
        max-width: unset;
        bottom: 16px;
        border-radius: 16px;
    }

    .content-search-floating .control-input {
        min-width: 0;
        flex: 1;
    }

    /* Sidebar Header */
    .sidebar-header {
        padding: 0.75rem 1rem;
    }

    .logo {
        font-size: 1.125rem;
    }

    .btn-new {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        min-width: auto;
    }

    /* Search Bar */
    .search-bar {
        padding: 0.75rem;
    }

    .search-input {
        font-size: 0.875rem;
        padding: 0.625rem 0.875rem;
    }

    /* Notes List */
    .notes-list {
        flex: 1 1 auto;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        max-height: calc(100vh - 200px); /* Reserve space for header, search, and footer */
        max-height: calc(100dvh - 200px); /* Dynamic viewport height */
        -webkit-overflow-scrolling: touch;
    }

    .note-item {
        padding: 0.625rem 1rem;
    }

    .note-title {
        font-size: 0.9375rem;
    }

    .note-preview {
        font-size: 0.8125rem;
        line-height: 1.4;
    }

    .note-date {
        font-size: 0.75rem;
    }

    /* Sidebar Footer - Hidden on Mobile */
    .sidebar-footer {
        display: none !important;
    }
    
    /* Floating WhatsApp Button - Mobile */
    .floating-whatsapp {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
        box-shadow: 0 4px 16px rgba(37, 211, 102, 0.5);
    }
    
    .floating-whatsapp svg {
        width: 26px;
        height: 26px;
    }
    
    .footer-content {
        display: block;
    }
    
    .footer-text {
        font-size: 0.7rem;
        margin-bottom: 0.375rem;
    }
    
    .footer-link {
        margin-top: 0.5rem;
    }
    
    .whatsapp-link {
        font-size: 0.7rem;
        padding: 0.375rem 0.75rem;
    }

    /* Modals */
    .modal-overlay {
        padding: 1rem;
    }

    .modal-box {
        padding: 1.5rem;
        max-width: 95%;
        width: 100%;
    }

    .modal-box h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .modal-box p {
        font-size: 0.9375rem;
        margin-bottom: 1.25rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .modal-actions button {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }

    .modal-input {
        font-size: 1rem;
        padding: 0.875rem;
    }

    /* Password Input Container */
    .password-input-container .modal-input {
        padding: 0.875rem 3rem 0.875rem 0.875rem;
    }

    /* Share Modal */
    .share-link-input {
        font-size: 0.875rem;
        padding: 0.75rem;
    }

    .share-link-label {
        font-size: 0.875rem;
    }

    /* Notification Modal */
    .notification-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 1rem;
    }

    .notification-icon svg {
        width: 28px;
        height: 28px;
    }

    /* Empty State */
    .empty-state {
        padding: 2rem 1rem;
        gap: 1.25rem;
    }

    .empty-state p {
        font-size: 1rem;
        text-align: center;
    }

    .btn-new-empty {
        padding: 0.875rem 1.75rem;
        font-size: 0.9375rem;
        width: auto;
        min-width: 200px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .sidebar {
        width: 75vw;
        max-width: 280px;
    }

    .editor-header {
        padding: 0.625rem 0.75rem;
    }

    .editor-title-input {
        font-size: 1rem;
    }

    .editor-controls {
        gap: 0.5rem;
    }

    .control-select,
    .editor-controls button {
        min-width: 100%;
        flex: 1 1 100%;
    }

    .modal-box {
        padding: 1.25rem;
        max-width: 100%;
    }

    .modal-box h2 {
        font-size: 1.25rem;
    }

    .modal-box p {
        font-size: 0.875rem;
    }

    .sidebar-header {
        padding: 0.625rem 0.75rem;
    }

    .search-bar {
        padding: 0.625rem;
    }

    .note-item {
        padding: 0.5rem 0.75rem;
    }
    
    /* Floating WhatsApp Button - Small Mobile */
    .floating-whatsapp {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 52px;
        height: 52px;
    }
    
    .floating-whatsapp svg {
        width: 24px;
        height: 24px;
    }
}

/* Tablet Responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }

    .editor-header {
        padding: 0.875rem 1.5rem;
    }

    .editor-controls {
        gap: 0.5rem;
    }

    .control-select {
        font-size: 0.875rem;
        padding: 0.5rem 2rem 0.5rem 0.75rem;
    }

    .editor-controls button {
        font-size: 0.875rem;
        padding: 0.5rem 1.25rem;
    }
}
