/* ═══════════════════════════════════════════════════════════════════
   Personal Diary — Premium CSS
   Glassmorphism, smooth animations, time-of-day gradients
   ═══════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables / Themes ────────────────────────────────────── */

:root {
    /* Light theme (default) */
    --bg-primary: #f8f6f3;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0ece6;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-strong: rgba(255, 255, 255, 0.85);
    --bg-glass-hover: rgba(255, 255, 255, 0.9);
    --border-glass: rgba(255, 255, 255, 0.5);
    --border-subtle: rgba(0, 0, 0, 0.06);

    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-tertiary: #8a8aa0;
    --text-inverse: #ffffff;

    --accent: #6c63ff;
    --accent-light: #8b83ff;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --accent-bg: rgba(108, 99, 255, 0.08);

    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;

    --gradient-morning: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    --gradient-day: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    --gradient-evening: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
    --gradient-night: linear-gradient(135deg, #0c0c1d 0%, #1a1a3e 50%, #2d1b4e 100%);
    --gradient-accent: linear-gradient(135deg, #6c63ff 0%, #a855f7 100%);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    --blur: 20px;
    --blur-strong: 40px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-serif: 'Merriweather', 'Georgia', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition-fast: 0.15s ease;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    --sidebar-width: 280px;
    --header-height: 64px;
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-glass: rgba(26, 26, 46, 0.75);
    --bg-glass-strong: rgba(26, 26, 46, 0.9);
    --bg-glass-hover: rgba(26, 26, 46, 0.95);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.06);

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0c0;
    --text-tertiary: #6a6a8a;

    --accent-glow: rgba(108, 99, 255, 0.4);
    --accent-bg: rgba(108, 99, 255, 0.12);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
}

/* Night mode — warm, eye-friendly */
[data-theme="night"] {
    --bg-primary: #1a1208;
    --bg-secondary: #261e10;
    --bg-tertiary: #2e2415;
    --bg-glass: rgba(38, 30, 16, 0.8);
    --bg-glass-strong: rgba(38, 30, 16, 0.92);
    --bg-glass-hover: rgba(38, 30, 16, 0.96);
    --border-glass: rgba(255, 200, 100, 0.1);
    --border-subtle: rgba(255, 200, 100, 0.06);

    --text-primary: #f0e0c8;
    --text-secondary: #c0a880;
    --text-tertiary: #806840;

    --accent: #d4a45a;
    --accent-light: #e0b878;
    --accent-glow: rgba(212, 164, 90, 0.3);
    --accent-bg: rgba(212, 164, 90, 0.1);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
}


/* ─── Base Reset & Typography ───────────────────────────────────── */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background var(--transition-slow), color var(--transition);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Merriweather:ital,wght@0,300;0,400;1,300;1,400&family=JetBrains+Mono:wght@400;500&display=swap');


/* ─── Animated Background ───────────────────────────────────────── */

#bg-gradient {
    position: fixed;
    inset: 0;
    z-index: -2;
    transition: opacity 2s ease;
}

.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    z-index: -1;
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

.bg-orb:nth-child(1) {
    width: 600px;
    height: 600px;
    background: var(--accent);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.bg-orb:nth-child(2) {
    width: 400px;
    height: 400px;
    background: #a855f7;
    bottom: -100px;
    left: -100px;
    animation-delay: -7s;
}

.bg-orb:nth-child(3) {
    width: 300px;
    height: 300px;
    background: #f472b6;
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(10px, -10px) scale(1.02); }
}


/* ─── App Layout ────────────────────────────────────────────────── */

#app {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(var(--blur-strong));
    -webkit-backdrop-filter: blur(var(--blur-strong));
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow);
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-logo-sub {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 8px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    user-select: none;
}

.nav-item:hover {
    background: var(--accent-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-bg);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: var(--radius-full);
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-subtle);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-card:hover {
    background: var(--accent-bg);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-streak {
    font-size: 11px;
    color: var(--text-tertiary);
}


/* ─── Main Content ──────────────────────────────────────────────── */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin var(--transition-slow);
}

.content-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 16px 32px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--header-height);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-body {
    padding: 32px;
    max-width: 900px;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ─── Glass Card ────────────────────────────────────────────────── */

.card {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-glow);
}

.card-sm {
    padding: 16px;
    border-radius: var(--radius-md);
}


/* ─── Buttons ───────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    box-shadow: 0 0 40px var(--accent-glow);
    transform: translateY(-1px);
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

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

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 18px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

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

.btn-danger:hover {
    background: #c0392b;
}

.fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--gradient-accent);
    color: white;
    font-size: 28px;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    z-index: 90;
    transition: all var(--transition-spring);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 50px var(--accent-glow), var(--shadow-lg);
}


/* ─── Inputs ────────────────────────────────────────────────────── */

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: all var(--transition-fast);
    outline: none;
    backdrop-filter: blur(10px);
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder {
    color: var(--text-tertiary);
}

textarea.input {
    resize: vertical;
    min-height: 120px;
    line-height: 1.7;
    font-family: var(--font-serif);
}

.search-bar {
    position: relative;
}

.search-bar .input {
    padding-left: 44px;
}

.search-bar .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
    pointer-events: none;
}


/* ─── Entry Cards ───────────────────────────────────────────────── */

.entries-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.entry-card {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.entry-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity var(--transition);
}

.entry-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-glow);
}

.entry-card:hover::before {
    opacity: 1;
}

.entry-card.pinned {
    border-color: var(--warning);
}

.entry-card.pinned::before {
    background: var(--warning);
    opacity: 1;
}

.entry-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.entry-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.entry-mood {
    font-size: 20px;
}

.entry-preview {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--font-serif);
}

.entry-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.entry-date {
    font-size: 12px;
    color: var(--text-tertiary);
}

.entry-words {
    font-size: 12px;
    color: var(--text-tertiary);
}

.entry-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tag:hover {
    background: var(--accent);
    color: white;
}

.entry-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.entry-action-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.entry-action-btn:hover {
    color: var(--accent);
    background: var(--accent-bg);
}

.entry-action-btn.active {
    color: var(--warning);
}

.entry-action-btn.fav-active {
    color: var(--danger);
}


/* ─── Editor ────────────────────────────────────────────────────── */

.editor-container {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-wrap: wrap;
}

.toolbar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-fast);
    font-family: var(--font-mono);
}

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

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border-subtle);
    margin: 0 4px;
}

.editor-area {
    width: 100%;
    min-height: 300px;
    padding: 20px 24px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 16px;
    line-height: 1.8;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition-fast);
}

.editor-area:focus {
    border-color: var(--accent);
}

.editor-preview {
    padding: 20px 24px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    min-height: 200px;
    font-family: var(--font-serif);
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
}

.editor-preview h1, .editor-preview h2, .editor-preview h3 {
    font-family: var(--font-sans);
    margin: 16px 0 8px;
    color: var(--text-primary);
}

.editor-preview h1 { font-size: 24px; }
.editor-preview h2 { font-size: 20px; }
.editor-preview h3 { font-size: 17px; }

.editor-preview p { margin-bottom: 12px; }

.editor-preview blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 12px 0;
}

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

.editor-preview pre {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
}

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

.editor-preview img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

.editor-tabs {
    display: flex;
    gap: 0;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

.editor-tab {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: transparent;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.editor-tab.active {
    color: var(--text-primary);
    background: var(--bg-glass);
    border-color: var(--border-glass);
}


/* ─── Mood Selector ─────────────────────────────────────────────── */

.mood-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mood-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-glass);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-glass);
}

.mood-option:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.mood-option.selected {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: var(--shadow-glow);
    transform: scale(1.05);
}

.mood-emoji {
    font-size: 28px;
    transition: transform var(--transition-spring);
}

.mood-option:hover .mood-emoji {
    transform: scale(1.2);
}

.mood-option.selected .mood-emoji {
    transform: scale(1.3);
    animation: bounce 0.5s ease;
}

.mood-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: capitalize;
}

@keyframes bounce {
    0%, 100% { transform: scale(1.3); }
    50% { transform: scale(1.5); }
}


/* ─── Calendar ──────────────────────────────────────────────────── */

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.calendar-month {
    font-size: 20px;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    padding: 8px;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    font-size: 14px;
    color: var(--text-secondary);
    gap: 2px;
}

.calendar-day:hover {
    background: var(--accent-bg);
}

.calendar-day.today {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 700;
}

.calendar-day.has-entry {
    color: var(--text-primary);
    font-weight: 600;
}

.calendar-day.has-entry::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    bottom: 4px;
}

.calendar-day.other-month {
    color: var(--text-tertiary);
    opacity: 0.4;
}

.calendar-day .day-mood {
    font-size: 10px;
    line-height: 1;
}

.calendar-day-number {
    font-size: 14px;
    line-height: 1;
}


/* ─── Stats Dashboard ───────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-change {
    font-size: 12px;
    margin-top: 6px;
    font-weight: 600;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

.chart-container {
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.chart-canvas {
    width: 100% !important;
    max-height: 300px;
}

/* Heatmap */
.heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fill, 14px);
    gap: 3px;
}

.heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--border-subtle);
    transition: all var(--transition-fast);
}

.heatmap-cell.level-1 { background: rgba(108, 99, 255, 0.2); }
.heatmap-cell.level-2 { background: rgba(108, 99, 255, 0.4); }
.heatmap-cell.level-3 { background: rgba(108, 99, 255, 0.6); }
.heatmap-cell.level-4 { background: rgba(108, 99, 255, 0.8); }
.heatmap-cell.level-5 { background: rgba(108, 99, 255, 1.0); }

.heatmap-cell:hover {
    transform: scale(1.5);
    box-shadow: var(--shadow-glow);
}


/* ─── Streak Banner ─────────────────────────────────────────────── */

.streak-banner {
    background: var(--gradient-accent);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: white;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.streak-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.streak-fire {
    font-size: 48px;
    z-index: 1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.streak-info {
    z-index: 1;
}

.streak-count {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
}

.streak-text {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}


/* ─── Modal ─────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(var(--blur-strong));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-spring);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.visible .modal {
    transform: scale(1) translateY(0);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}


/* ─── Auth Screen ───────────────────────────────────────────────── */

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(var(--blur-strong));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient-accent);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-glow);
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.auth-logo p {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-top: 4px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-tertiary);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.auth-toggle {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-toggle a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-toggle a:hover {
    text-decoration: underline;
}


/* ─── Prompt Card ───────────────────────────────────────────────── */

.prompt-card {
    background: var(--gradient-accent);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.prompt-card::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 16px;
    font-size: 80px;
    opacity: 0.15;
    font-family: Georgia, serif;
}

.prompt-text {
    font-size: 18px;
    font-family: var(--font-serif);
    font-style: italic;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.prompt-category {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.prompt-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.prompt-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.prompt-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}


/* ─── Tags ──────────────────────────────────────────────────────── */

.tags-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    min-height: 44px;
    align-items: center;
    cursor: text;
}

.tags-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.tags-input-wrapper .tag {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
}

.tag-remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 14px;
    transition: opacity var(--transition-fast);
}

.tag-remove:hover {
    opacity: 1;
}

.tags-input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    flex: 1;
    min-width: 80px;
    padding: 4px 0;
}


/* ─── Toast Notifications ───────────────────────────────────────── */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.4s var(--transition-spring);
}

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    font-size: 14px;
    color: var(--text-primary);
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}


/* ─── Empty State ───────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-text {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto 20px;
    line-height: 1.6;
}


/* ─── Theme Switcher ────────────────────────────────────────────── */

.theme-switcher {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
}

.theme-option {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
    color: var(--text-secondary);
}

.theme-option.active {
    background: var(--accent);
    color: white;
}


/* ─── Loading ───────────────────────────────────────────────────── */

.loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}


/* ─── Scrollbar ─────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: var(--radius-full);
    opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}


/* ─── Media Attachments ─────────────────────────────────────────── */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.media-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

.media-item:hover img {
    transform: scale(1.05);
}

.media-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.media-item:hover .media-remove {
    opacity: 1;
}


/* ─── Encryption Toggle ──────────────────────────────────────────── */

.encrypt-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.encrypt-toggle:hover {
    border-color: var(--accent);
}

.encrypt-toggle.active {
    border-color: var(--success);
    background: rgba(46, 204, 113, 0.08);
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--border-subtle);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition);
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: var(--shadow-sm);
}

.encrypt-toggle.active .toggle-switch {
    background: var(--success);
}

.encrypt-toggle.active .toggle-switch::after {
    transform: translateX(20px);
}

.encrypt-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.encrypt-label strong {
    color: var(--text-primary);
}


/* ─── Responsive ────────────────────────────────────────────────── */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition);
    }

    .sidebar-overlay.visible {
        opacity: 1;
        visibility: visible;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .content-body {
        padding: 16px;
    }

    .content-header {
        padding: 12px 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mood-selector {
        justify-content: center;
    }

    .modal {
        padding: 24px;
        margin: 12px;
    }

    .fab {
        bottom: 20px;
        right: 20px;
        width: 54px;
        height: 54px;
        font-size: 24px;
    }

    .entry-header {
        flex-direction: column;
    }

    .streak-banner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        gap: 2px;
    }

    .calendar-day {
        font-size: 12px;
    }

    .mood-option {
        padding: 8px 10px;
    }

    .mood-emoji {
        font-size: 24px;
    }
}


/* ─── Page Transitions ──────────────────────────────────────────── */

.page-enter {
    animation: fadeInUp 0.35s ease;
}

.page-exit {
    animation: fadeOutDown 0.25s ease forwards;
}

@keyframes fadeOutDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(16px); }
}


/* ─── Selection ─────────────────────────────────────────────────── */

::selection {
    background: var(--accent);
    color: white;
}


/* ─── Print ─────────────────────────────────────────────────────── */

@media print {
    .sidebar, .content-header, .fab, .toast-container { display: none !important; }
    .main-content { margin: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ─── Enhancements ─────────────────────────────────────────── */
.today-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card, #fff);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  font-size: 22px;
  cursor: pointer;
  z-index: 99;
  transition: transform 0.2s;
}
.today-fab:hover { transform: scale(1.1); }

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}
.lightbox-overlay img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
.lightbox-close {
  position: absolute;
  top: 16px; right: 24px;
  background: rgba(255,255,255,0.15);
  border: none; color: white;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 24px; cursor: pointer;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

mark {
  background: rgba(255, 235, 59, 0.5);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.word-cloud-tag {
  display: inline-block;
  margin: 4px 8px;
  font-family: var(--font-serif, serif);
  color: var(--text-secondary, #555);
  transition: color 0.2s;
}
.word-cloud-tag:hover { color: var(--accent, #6c63ff); cursor: pointer; }
