/* css/styles.css */
:root {
    /* Light Mode Tokens */
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --danger-color: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow: hidden; /* App feels like native app */
}

/* Views */
.view {
    display: none;
    height: 100vh;
    width: 100vw;
}

.view.active {
    display: flex;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn.outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn.outline:hover {
    background-color: var(--surface-color);
}

.btn.small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn.full-width {
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: var(--surface-color);
    color: var(--text-primary);
}

.icon-btn.danger:hover {
    color: var(--danger-color);
}

/* Landing View */
#landing-view {
    flex-direction: column;
    overflow-y: auto;
}

.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    backdrop-filter: blur(10px);
    background-color: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.hero {
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.guest-editor-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.content-input {
    font-family: inherit;
    font-size: 1rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    resize: none;
    width: 100%;
    min-height: 200px;
    line-height: 1.6;
}

.editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.feature {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s;
}

.feature:hover {
    transform: translateY(-5px);
}

.feature h3 {
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* App View */
#app-view {
    display: flex;
}

.sidebar {
    width: 300px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-search {
    padding: 0 1.5rem 1rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-primary);
    outline: none;
}

.sidebar-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.sidebar-filters {
    padding: 0 1.5rem 1rem;
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.filter-btn.active, .filter-btn:hover {
    color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.1);
}

.sidebar-tags {
    padding: 0 1.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tag {
    font-size: 0.75rem;
    background-color: var(--bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tag:hover, .tag.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tag .remove-tag {
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

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

.note-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.note-item.active {
    background-color: rgba(99, 102, 241, 0.05);
    border-left: 3px solid var(--primary-color);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.note-item-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.pin-icon {
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

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

.note-item-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.editor-header {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    background-color: var(--surface-color);
}

.editor-tools, .user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-right: 0.25rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem;
    overflow: hidden;
}

.tags-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tags-display {
    display: flex;
    gap: 0.5rem;
}

#tag-input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.editor-panes {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.editor-panes textarea {
    height: 100%;
}

.markdown-preview {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding-right: 1rem;
    line-height: 1.6;
}

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.markdown-preview p {
    margin-bottom: 1rem;
}

.markdown-preview pre {
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.markdown-preview code {
    font-family: monospace;
    background-color: var(--surface-color);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
}

.hidden {
    display: none !important;
}
