:root {
    --bg-color: #0F0F1A;
    --sidebar-bg: #1A1A24;
    --primary: #DFE6E9;
    --secondary: #636E72;
    --accent: #6C5CE7;
    --accent-hover: #5a4bcf;
    --border: #2D2D3B;
    --input-bg: #141420;
    --danger: #ff7675;
    --success: #00b894;

    --radius: 8px;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-text: Georgia, serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--primary);
    font-family: var(--font-text);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6,
.ui-text,
button,
input,
select {
    font-family: var(--font-ui);
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

/* Sidebar Elements */
.sidebar-header {
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--accent);
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.section-title {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.mt-auto {
    margin-top: auto;
}

.mt-2 {
    margin-top: 0.5rem;
}

.w-full {
    width: 100%;
}

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

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

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

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

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

.icon-btn {
    background: transparent;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: color 0.2s, background-color 0.2s;
}

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

/* Common UI */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar svg {
    position: absolute;
    left: 0.75rem;
    color: var(--secondary);
}

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

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

/* Stats */
.stat-box {
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--secondary);
}

.stat-value {
    font-family: var(--font-ui);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

/* Timeline */
.entry-list {
    list-style: none;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.entry-list li {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    cursor: pointer;
    color: var(--secondary);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
}

.entry-list li:hover {
    background-color: var(--border);
    color: var(--primary);
}

.entry-list li.active {
    background-color: rgba(108, 92, 231, 0.15);
    color: var(--accent);
    font-weight: 500;
}

/* Heatmap */
.heatmap {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.heat-day {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 2px;
    background-color: var(--border);
    cursor: pointer;
}

.heat-day.active {
    background-color: var(--accent);
}

/* Header */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-selector h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.top-actions {
    display: flex;
    gap: 1rem;
}

/* Editor */
.editor-container {
    padding: 2rem 3rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.meta-inputs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 500;
}

.meta-inputs select,
.meta-inputs input {
    padding: 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--input-bg);
    color: var(--primary);
    font-size: 1rem;
}

.meta-inputs select:focus,
.meta-inputs input:focus {
    outline: none;
    border-color: var(--accent);
}

.tags-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.tags-container input {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--input-bg);
    color: var(--primary);
    font-size: 0.95rem;
}

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

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

.tag {
    background-color: var(--border);
    color: var(--primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--font-ui);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tag-remove {
    cursor: pointer;
    color: var(--secondary);
}

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

.sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.editor-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: var(--secondary);
}

.editor-section textarea {
    width: 100%;
    min-height: 120px;
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--primary);
    font-family: var(--font-text);
    font-size: 1.1rem;
    line-height: 1.6;
    resize: vertical;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.editor-section textarea:focus {
    outline: none;
    border-color: var(--border);
    background-color: rgba(255, 255, 255, 0.02);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 15, 26, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 600px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

.modal-body {
    padding: 1.5rem;
}

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

#summary-output {
    width: 100%;
    height: 300px;
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 1rem;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.9rem;
    resize: none;
}

/* Utils */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .top-bar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .editor-container {
        padding: 1rem;
    }
}