* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 320px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  user-select: none;
  flex-shrink: 0;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rétractation de la sidebar */
body.sidebar-collapsed .sidebar {
  margin-left: -320px;
}

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

.sidebar-title { font-size: 0.95rem; font-weight: 700; }

.btn-icon-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.85rem;
}
.btn-icon-sm:hover { color: var(--text); background: var(--border); }

/* BOUTON TOGGLE SIDEBAR */
.btn-toggle-sidebar {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius, 8px);
  padding: 5px 9px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-toggle-sidebar:hover {
  color: var(--text);
  background: var(--border);
}

.tree-container { flex: 1; overflow-y: auto; padding: 12px 8px; }

.tree-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 16px 8px 6px 8px;
  font-weight: 700;
}

.tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s;
}

.tree-item-info { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tree-item-actions { display: flex; align-items: center; gap: 4px; }
.tree-item-time { font-family: monospace; font-size: 0.75rem; background: var(--border); padding: 2px 6px; border-radius: 4px; color: var(--text); }

.tree-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.tree-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.tree-item.folder { font-weight: 600; color: var(--text); margin-top: 6px; }
.folder-children { margin-left: 14px; border-left: 1px dashed var(--border); padding-left: 4px; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
}

/* --- CONTENU PRINCIPAL --- */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; width: 100%; }

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

.header-actions { display: flex; align-items: center; gap: 10px; }
.app-title { font-size: 1.2rem; font-weight: 700; margin: 0; }

.badge-total {
  font-size: 0.85rem;
  background: var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
}

.content-body { 
  flex: 1; 
  overflow-y: auto; 
  padding: 20px; 
  max-width: 100%; 
  margin: 0 auto; 
  width: 100%; 
  display: flex; 
  flex-direction: column; 
}

/* Assure que la colonne du jour accepte les positions absolues */
.week-day-column {
  position: relative;
}

/* Ligne rouge indiquant l'heure actuelle (Style Notion Calendar) */
.current-time-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #ff3b30;
  z-index: 20;
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* Puce rouge sur le bord gauche de la colonne */
.current-time-indicator::before {
  content: '';
  position: absolute;
  left: -4px;
  width: 8px;
  height: 8px;
  background-color: #ff3b30;
  border-radius: 50%;
}

/* Badge de l'heure courante (ex: 16:36) */
.current-time-badge {
  position: absolute;
  left: 2px;
  top: -10px;
  background-color: #ff3b30;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Animation de surbrillance lors de la recherche */
@keyframes searchHighlightPulse {
  0% {
    outline: 3px solid var(--primary, #3b82f6);
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.8);
    transform: scale(1.02);
  }
  50% {
    outline: 3px solid var(--primary, #3b82f6);
    box-shadow: 0 0 25px rgba(59, 130, 246, 1);
    transform: scale(1.02);
  }
  100% {
    outline: 3px solid transparent;
    box-shadow: none;
    transform: scale(1);
  }
}

.highlight-task-search {
  animation: searchHighlightPulse 2.5s ease-in-out forwards;
  transition: all 0.3s ease;
  z-index: 10;
}
