/* Merci365 Custom Styles */

:root {
  --bg-page: #F0F2F8;
  --bg-card: #FFFFFF;
  --bg-sidebar: #f8fafc;
  --border-sidebar: #e2e8f0;
  --content-max-width: 1280px;
  --text-primary: #1a1a1a;
  --text-secondary: #64748b;
  --accent: #0891b2;
  --accent-hover: #0e7490;
  --accent-light: #ecfeff;
  --heatmap-completed: #2dd4bf;
  --heatmap-missed: #cffafe;
  --heatmap-empty: #e2e8f0;
}

/* Dark mode */
[data-theme="dark"] {
  --bg-page: #1a1a2e;
  --bg-card: #16213e;
  --bg-sidebar: #16213e;
  --border-sidebar: #0f3460;
  --text-primary: #eee;
  --text-secondary: #8892b0;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  transition: all 0.3s;
}

/* Sidebar - Desktop default */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s, border-color 0.3s;
  z-index: 10;
}

.main-content {
  flex: 1 1 auto;
  width: calc(100% - 260px);
  max-width: calc(100% - 260px);
  min-width: 0;
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}

.main-content > * {
  width: 100%;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
}

.card {
  background: var(--bg-card);
  border-radius: 20px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  padding: 24px;
  border: none;
  transition: background-color 0.3s;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 4px;
  transition: all 0.2s;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
}

.nav-item:hover:not(.active) { background-color: rgba(8, 145, 178, 0.1); }

.nav-item.active {
  background-color: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.nav-item svg { margin-right: 12px; flex-shrink: 0; }

.btn-primary {
  background-color: var(--accent);
  color: white;
  padding: 16px 24px;
  border-radius: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px -3px rgba(8, 145, 178, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-primary:hover { background-color: var(--accent-hover); transform: translateY(-1px); }
.btn-primary svg { width: 20px; height: 20px; }

.progress-bar { height: 8px; background-color: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #0891b2, #2dd4bf); border-radius: 999px; transition: width 0.5s ease; }

.heatmap-grid { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; gap: 3px; }

.heatmap-cell { width: 14px; height: 14px; border-radius: 3px; }
.heatmap-cell.completed { background-color: var(--heatmap-completed); }
.heatmap-cell.missed { background-color: var(--heatmap-missed); opacity: 0.6; }
.heatmap-cell.empty { background-color: var(--heatmap-empty); }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.badge-fire { background-color: #fce7f3; color: #db2777; }

.entry-item { display: flex; align-items: flex-start; gap: 16px; padding: 16px; border-radius: 16px; transition: background-color 0.2s; cursor: pointer; }
.entry-item:hover { background-color: rgba(8, 145, 178, 0.05); }

.entry-date { min-width: 60px; padding: 8px; border-radius: 12px; text-align: center; background-color: var(--accent-light); flex-shrink: 0; }
.entry-date .month { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--accent); }
.entry-date .day { font-size: 20px; font-weight: 700; color: #4c1d95; line-height: 1; }

.entry-content { flex: 1; }
.entry-title { font-weight: 600; font-size: 14px; color: var(--text-primary); margin-bottom: 4px; }
.entry-number { font-size: 10px; font-weight: 700; color: var(--text-secondary); }
.entry-preview { font-size: 12px; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.type-bar { margin-bottom: 16px; }
.type-bar-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.type-bar-fill { height: 8px; border-radius: 999px; overflow: hidden; }
.type-merci .type-bar-fill { background-color: #0891b2; }
.type-anecdote .type-bar-fill { background-color: #a78bfa; }
.type-citation .type-bar-fill { background-color: #06b6d4; }
.type-poeme .type-bar-fill { background-color: #6366f1; }

.theme-toggle { display: flex; background-color: #e2e8f0; border-radius: 999px; padding: 4px; cursor: pointer; }
[data-theme="dark"] .theme-toggle { background-color: #0f3460; }
.theme-toggle-btn { padding: 6px 12px; border-radius: 999px; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.theme-toggle-btn.active { background-color: white; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
[data-theme="dark"] .theme-toggle-btn.active { background-color: #1e3a5f; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 32px; }
.grid-3 { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
.col-span-2 { grid-column: span 2; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Hamburger - hidden on desktop */
.hamburger { display: none; }

/* Grid responsive */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .heatmap-grid { gap: 2px; }
  .heatmap-cell { width: 12px; height: 12px; }
}

/* Mobile: sidebar hidden, hamburger shown */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -260px !important;
    width: 260px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
  }

  .sidebar.open { left: 0 !important; }

  .hamburger {
    display: flex !important;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 999;
    background: var(--bg-card);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .hamburger svg { width: 24px; height: 24px; color: var(--text-primary); }

  .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); z-index: 998; }
  .sidebar-overlay.open { display: block; }

  .main-content {
    margin-left: 0 !important;
    padding: 16px;
    padding-top: 60px;
    width: 100% !important;
    max-width: 100% !important;
  }

  .main-content > * {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .grid-4 { grid-template-columns: 1fr; }
  header.flex { flex-direction: column; align-items: flex-start !important; gap: 12px; }
  header .text-right { text-align: left !important; }
  .card { padding: 16px; border-radius: 16px; }
  .heatmap-grid { overflow-x: auto; padding-bottom: 8px; }
  .entry-item { flex-direction: column; gap: 12px; }
  .entry-date { flex-direction: row; gap: 8px; min-width: auto; }
  .hide-mobile { display: none !important; }
  .btn-primary { width: 100%; justify-content: center; }
  .flex.gap-4 { flex-direction: column; }
  .flex.gap-4 button { width: 100%; }
}

@media (max-width: 480px) {
  h1, .text-3xl { font-size: 24px !important; }
  .stat-num { font-size: 28px; }
  .heatmap-cell { width: 10px; height: 10px; }
}
