/* ============================================
   MOOD JOURNAL — Premium Design System
   ============================================ */

/* ---------- Variables ---------- */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2132;
    --bg-sidebar: #13151f;
    --border-color: #2a2d3e;
    --text-primary: #e8eaf0;
    --text-secondary: #8b90a7;
    --text-muted: #555a72;
    --accent-blue: #4f6ef7;
    --accent-blue-hover: #3a57e8;

    /* Mood Colors */
    --mood-happy: #f5a623;
    --mood-sad: #4a90e2;
    --mood-motivated: #27ae60;
    --mood-stressed: #e74c3c;
    --mood-calm: #9b59b6;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
    --bg-primary: #f0f2f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #f7f8fc;
    --border-color: #dde1ee;
    --text-primary: #1a1d27;
    --text-secondary: #4a4f68;
    --text-muted: #9099b8;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ---------- App Layout ---------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    gap: 2rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon { font-size: 1.6rem; }

.brand-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.sidebar-stats {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.stat-pill { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--accent-blue); }

.sidebar-filters { display: flex; flex-direction: column; gap: 8px; }
.filter-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.mood-legend { display: flex; flex-direction: column; gap: 10px; }
.legend-title { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--text-secondary); }
.legend-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.legend-dot.happy { background: var(--mood-happy); }
.legend-dot.sad { background: var(--mood-sad); }
.legend-dot.motivated { background: var(--mood-motivated); }
.legend-dot.stressed { background: var(--mood-stressed); }
.legend-dot.calm { background: var(--mood-calm); }

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-brand-mobile { display: none; font-weight: 700; font-size: 1.1rem; }

.search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    flex: 1;
    max-width: 480px;
    margin-left: auto;
    transition: border-color var(--transition);
}
.search-wrap:focus-within { border-color: var(--accent-blue); }
.search-input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    width: 100%;
    font-family: inherit;
}
.search-input::placeholder { color: var(--text-muted); }

.theme-toggle-btn {
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    flex-shrink: 0;
}
.theme-toggle-btn:hover {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

/* ---------- Form Section ---------- */
.form-section {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.form-heading {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

#journal-form { display: flex; flex-direction: column; gap: 1rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--accent-blue); }
.form-input::placeholder { color: var(--text-muted); }

.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.styled-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b90a7' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

option { background: var(--bg-card); color: var(--text-primary); }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; }

.btn {
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-primary { background: var(--accent-blue); color: white; }
.btn-primary:hover { background: var(--accent-blue-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); color: var(--text-primary); }

/* ---------- Entries Section ---------- */
.entries-section { padding: 2rem; flex: 1; }

/* ---------- Entry Cards ---------- */
.entry-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--border-color);
    transition: transform var(--transition), box-shadow var(--transition);
    animation: fadeSlideIn 0.3s ease;
}

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

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

/* Mood border colors */
.mood-happy    { border-left-color: var(--mood-happy); }
.mood-sad      { border-left-color: var(--mood-sad); }
.mood-motivated{ border-left-color: var(--mood-motivated); }
.mood-stressed { border-left-color: var(--mood-stressed); }
.mood-calm     { border-left-color: var(--mood-calm); }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; gap: 1rem; }
.card-header-left { display: flex; align-items: center; gap: 10px; }
.mood-emoji { font-size: 1.4rem; }
.card-header h3 { font-size: 1rem; font-weight: 600; color: var(--text-primary); }

.mood-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    flex-shrink: 0;
}
.mood-badge-happy    { background: rgba(245,166,35,0.15);  color: var(--mood-happy); }
.mood-badge-sad      { background: rgba(74,144,226,0.15);  color: var(--mood-sad); }
.mood-badge-motivated{ background: rgba(39,174,96,0.15);   color: var(--mood-motivated); }
.mood-badge-stressed { background: rgba(231,76,60,0.15);   color: var(--mood-stressed); }
.mood-badge-calm     { background: rgba(155,89,182,0.15);  color: var(--mood-calm); }

.card-content { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; margin-bottom: 1rem; }

.card-footer { display: flex; justify-content: space-between; align-items: center; }
.card-date { font-size: 0.8rem; color: var(--text-muted); }
.card-actions { display: flex; gap: 8px; }

.edit-btn, .delete-btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.edit-btn { background: rgba(79,110,247,0.15); color: var(--accent-blue); }
.edit-btn:hover { background: rgba(79,110,247,0.3); }
.delete-btn { background: rgba(231,76,60,0.15); color: var(--mood-stressed); }
.delete-btn:hover { background: rgba(231,76,60,0.3); }

/* ---------- Empty State ---------- */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; display: block; }
.empty-state p { font-size: 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .sidebar { display: none; }

    .topbar { padding: 1rem; }
    .topbar-brand-mobile { display: block; }
    .search-wrap { max-width: 100%; }

    .form-section { padding: 1.25rem; }
    .entries-section { padding: 1.25rem; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .card-header { flex-direction: column; align-items: flex-start; }
    .form-actions { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
}
