* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色调 */
    --primary: #5b7db1;
    --primary-light: #7b97c7;
    --primary-dark: #405b8c;

    /* 辅助色 */
    --secondary: #b4a7d6;
    --accent: #ffb74d;
    --danger: #e57373;
    --success: #81c784;

    /* 中性色 */
    --bg-color: #f7f9fc;
    --card-color: #ffffff;
    --text-color: #37474f;
    --text-muted: #78909c;
    --border-color: #e1e7ed;

    /* 其他 */
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    background-image: radial-gradient(#e4ebf5 0.5px, transparent 0.5px),
    radial-gradient(#e4ebf5 0.5px, var(--bg-color) 0.5px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    padding: 20px;
}

/* Layout */
#app {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background-color: var(--card-color);
    border-radius: var(--radius);
    padding: 16px 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 3px solid var(--primary);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}

.brand i {
    font-size: 24px;
}

.brand h1 {
    font-weight: 600;
    font-size: 22px;
}

.date-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.date {
    font-weight: 500;
    color: var(--text-color);
}

.weather {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary-light);
    color: white;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 14px;
}

.main-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .date-info {
        align-items: flex-start;
    }
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.control-panel {
    background-color: var(--card-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.control-panel h3 {
    margin-bottom: 16px;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 16px;
}

.control-group {
    margin-bottom: 16px;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: var(--transition);
}

select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(91, 125, 177, 0.2);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius);
    border: none;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.btn i {
    font-size: 14px;
}

.btn.primary {
    background-color: var(--primary);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-dark);
}

.btn.secondary {
    background-color: var(--secondary);
    color: white;
}

.btn.secondary:hover {
    background-color: #9485c0;
}

.btn.danger {
    background-color: var(--danger);
    color: white;
}

.btn.danger:hover {
    background-color: #d32f2f;
}



/* Recent */
.recent-notes {
    background-color: var(--card-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.recent-notes h3 {
    margin-bottom: 16px;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 16px;
}

.recent-note {
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.recent-note:last-child {
    border-bottom: none;
}

.recent-note:hover {
    background-color: var(--bg-color);
}

.note-title {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-date {
    font-size: 12px;
    color: var(--text-muted);
}



/* Content Area */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.title-input input {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 500;
    background-color: var(--card-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.title-input input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(91, 125, 177, 0.2), var(--shadow-sm);
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
}

.editor-wrap, .preview-wrap {
    background-color: var(--card-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-header, .preview-header {
    background-color: var(--primary);
    color: white;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 15px;
}

textarea {
    flex: 1;
    min-height: 400px;
    padding: 16px;
    border: none;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-color);
    resize: none;
}

textarea:focus {
    outline: none;
}

.markdown-preview {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    min-height: 400px;
}

/* Markdown */
.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    color: var(--text-color);
    font-weight: 600;
}

.markdown-preview h1 {
    font-size: 28px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.markdown-preview h2 {
    font-size: 24px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.markdown-preview h3 {
    font-size: 20px;
}

.markdown-preview p {
    margin-bottom: 16px;
    line-height: 1.7;
}

.markdown-preview a {
    color: var(--primary);
    text-decoration: none;
}

.markdown-preview a:hover {
    text-decoration: underline;
}

.markdown-preview ul,
.markdown-preview ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.markdown-preview li {
    margin-bottom: 4px;
}

.markdown-preview blockquote {
    padding: 0 16px;
    border-left: 4px solid var(--primary-light);
    color: var(--text-muted);
    margin-bottom: 16px;
}

.markdown-preview img {
    max-width: 100%;
    border-radius: 4px;
}

.markdown-preview pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.markdown-preview code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    background-color: rgba(0,0,0,0.05);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 90%;
}

.markdown-preview pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-preview hr {
    height: 1px;
    background-color: var(--border-color);
    border: none;
    margin: 24px 0;
}

.markdown-preview table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}

.markdown-preview th,
.markdown-preview td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
}

.markdown-preview th {
    background-color: var(--bg-color);
    font-weight: 500;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    background-color: var(--card-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    background-color: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius) var(--radius) 0 0;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px;
    padding-left: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
}

.search-box i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.diary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diary-item {
    padding: 14px;
    background-color: var(--bg-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.diary-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.diary-title {
    font-weight: 500;
    margin-bottom: 6px;
}

.diary-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

.diary-tags {
    display: flex;
    gap: 8px;
}

.weather-tag, .mood-tag {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
}

.weather-tag {
    background-color: rgba(91, 125, 177, 0.1);
    color: var(--primary);
}

.mood-tag {
    background-color: rgba(180, 167, 214, 0.1);
    color: var(--secondary);
}

.empty-list {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--success);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 500px) {
    .diary-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .toast {
        left: 24px;
        right: 24px;
        text-align: center;
    }
}
