:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #999999;
    --accent: #CE412B;
    --accent-hover: #A8321E;
    --border: #e0e0e0;
    --tag-bg: #f0f0f0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 5px;
}

/* Input Section */
.input-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.note-input {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

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

.markdown-preview {
    display: none;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    min-height: 50px;
    font-size: 15px;
}

.markdown-preview.show {
    display: block;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    margin: 12px 0 8px 0;
    font-size: 1em;
}

.markdown-preview p {
    margin: 8px 0;
}

.markdown-preview ul,
.markdown-preview ol {
    margin: 8px 0;
    padding-left: 24px;
}

.markdown-preview li {
    margin: 4px 0;
}

.markdown-preview code {
    background: var(--tag-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-preview pre {
    background: var(--tag-bg);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.markdown-preview pre code {
    background: none;
    padding: 0;
}

.markdown-preview blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-secondary);
}

.markdown-preview a {
    color: var(--accent);
    text-decoration: none;
}

.markdown-preview a:hover {
    text-decoration: underline;
}

.markdown-preview strong {
    font-weight: 600;
}

.markdown-preview em {
    font-style: italic;
}

.markdown-preview hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

/* Preview Toggle */
.preview-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.toggle-btn {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Input Actions */
.input-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.tag-input-field {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

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

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

/* Filter Section */
.filter-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

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

.filter-tabs {
    display: flex;
    gap: 5px;
}

.filter-tab {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    background: var(--tag-bg);
}

.filter-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Notes List */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.note-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    position: relative;
}

.note-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.note-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.note-actions {
    display: flex;
    gap: 10px;
}

.note-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    transition: color 0.2s;
}

.note-action-btn:hover {
    color: var(--accent);
}

.note-content {
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 12px;
}

.note-content h1,
.note-content h2,
.note-content h3,
.note-content h4,
.note-content h5,
.note-content h6 {
    margin: 12px 0 8px 0;
    font-size: 1em;
}

.note-content p {
    margin: 8px 0;
}

.note-content ul,
.note-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.note-content li {
    margin: 4px 0;
}

.note-content code {
    background: var(--tag-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.note-content pre {
    background: var(--tag-bg);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.note-content pre code {
    background: none;
    padding: 0;
}

.note-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-secondary);
}

.note-content a {
    color: var(--accent);
    text-decoration: none;
}

.note-content a:hover {
    text-decoration: underline;
}

.note-content strong {
    font-weight: 600;
}

.note-content em {
    font-style: italic;
}

.note-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--tag-bg);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.tag:hover {
    background: #e0e0e0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
}

/* Stats Footer */
.stats {
    margin-top: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 16px;
    }

    .header h1 {
        font-size: 24px;
    }

    .input-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .filter-section {
        flex-direction: column;
    }

    .filter-tabs {
        width: 100%;
    }

    .filter-tab {
        flex: 1;
        text-align: center;
    }
}
