:root {
    --bg-dark: #121212;
    --bg-surface: #1E1E1E;
    --bg-elevated: #2A2A2A;
    --border: #333333;
    --border-hover: #444444;
    --text-primary: #E0E0E0;
    --text-secondary: #9E9E9E;
    --amber: #FFB300;
    --amber-hover: #FF8F00;
    --danger: #EF5350;
    --danger-hover: #E53935;
    --focus-ring: rgba(255, 179, 0, 0.3);
}

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

body, html {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

#app {
    height: 100vh;
    width: 100vw;
    display: flex;
}

.view {
    display: none;
    width: 100%;
    height: 100%;
}

.view.active {
    display: flex;
}

/* Glassmorphism utility */
.glass {
    background: rgba(30, 30, 30, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Auth View */
#auth-view {
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1E1E1E 0%, #121212 100%);
}

.auth-container {
    padding: 3rem;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-logo {
    margin-bottom: 1rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

.input-group {
    text-align: left;
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.hidden {
    display: none !important;
}

.error-text {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.auth-footer {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn.primary {
    background-color: var(--amber);
    color: #000;
}

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

.btn.secondary {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background-color: var(--border-hover);
}

.btn.text {
    background: transparent;
    color: var(--text-secondary);
    padding: 0;
}

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

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

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

.btn.icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
}

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

.full-width {
    width: 100%;
    padding: 0.75rem;
}

/* Dashboard View */
#dashboard-view {
    flex-direction: row;
}

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

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

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

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

.search-bar svg {
    position: absolute;
    left: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--amber);
}

.sidebar-actions {
    padding: 1rem;
}

.tags-filter {
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-pill {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background-color: var(--bg-elevated);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--text-secondary);
}

.tag-pill:hover, .tag-pill.active {
    background-color: var(--amber);
    color: #000;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

.note-item {
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 0.25rem;
}

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

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

.note-item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
}

.empty-state, .editor-state {
    display: none;
    flex: 1;
    flex-direction: column;
}

.empty-state.active, .editor-state.active {
    display: flex;
}

.empty-state {
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

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

.note-title-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    width: 60%;
}

.note-title-input:focus {
    outline: none;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.tags-input-container {
    padding: 0.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.tags-input-container input {
    background: transparent;
    border: none;
    color: var(--amber);
    font-size: 0.85rem;
    flex: 1;
}

.tags-input-container input:focus {
    outline: none;
}

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

#note-content, #note-preview {
    width: 100%;
    height: 100%;
    padding: 2rem;
    overflow-y: auto;
}

#note-content {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
}

#note-content:focus {
    outline: none;
}

.editor-footer {
    padding: 0.5rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    padding: 2rem;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.file-input {
    margin-bottom: 1.5rem;
    width: 100%;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Markdown typography styles for preview */
.markdown-body {
    line-height: 1.6;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.markdown-body p, .markdown-body ul, .markdown-body ol {
    margin-bottom: 1em;
}
.markdown-body code {
    background-color: var(--bg-elevated);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: monospace;
}
.markdown-body pre {
    background-color: var(--bg-elevated);
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
}
.markdown-body blockquote {
    border-left: 4px solid var(--border-hover);
    padding-left: 1em;
    color: var(--text-secondary);
}
.markdown-body a {
    color: var(--amber);
}

@media (max-width: 768px) {
    #dashboard-view {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .main-content {
        height: 50vh;
    }
}
