/* ============================================
   Thème "cahier" — inspiré d'un carnet de cours
   ============================================ */

:root[data-theme="light"] {
    --bg-page: #f6f4ee;
    --bg-sidebar: #efece2;
    --bg-card: #ffffff;
    --bg-card-hover: #fbfaf6;
    --text-principal: #262421;
    --text-discret: #6b6659;
    --ligne: #ddd7c7;
    --accent: #2c4b8c;      /* bleu stylo */
    --accent-doux: #dbe4f5;
    --alerte: #a1352b;      /* rouge correction */
    --succes: #3f7a52;
    --ombre: rgba(38, 36, 33, 0.08);
}

:root[data-theme="dark"] {
    --bg-page: #191b1d;
    --bg-sidebar: #141617;
    --bg-card: #212426;
    --bg-card-hover: #262a2c;
    --text-principal: #e9e6dd;
    --text-discret: #9a978c;
    --ligne: #34383a;
    --accent: #8fb4ff;
    --accent-doux: #253552;
    --alerte: #e0776a;
    --succes: #7bc396;
    --ombre: rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text-principal);
    transition: background 0.2s ease, color 0.2s ease;
}

h1, h2, h3 {
    font-family: Georgia, "Source Serif Pro", serif;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin: 0 0 0.6em 0;
}

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

/* ---------- Sidebar ---------- */

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--ligne);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
}

.btn-icon {
    background: none;
    border: 1px solid var(--ligne);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-principal);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
}

.nav-modules {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    text-align: left;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    padding: 10px 12px;
    font-size: 0.95rem;
    color: var(--text-principal);
    border-radius: 0 8px 8px 0;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-card-hover);
}

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

/* ---------- Content ---------- */

.content {
    flex: 1;
    padding: 32px 40px;
    max-width: 980px;
}

.loading {
    color: var(--text-discret);
}

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

.module-header p {
    color: var(--text-discret);
    margin: 4px 0 0 0;
}

.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn:hover {
    filter: brightness(1.08);
}

.btn-secondaire {
    background: transparent;
    border: 1px solid var(--ligne);
    color: var(--text-principal);
}

/* ---------- Cartes génériques ---------- */

.carte {
    background: var(--bg-card);
    border: 1px solid var(--ligne);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 12px;
}

.carte h3 {
    margin-bottom: 4px;
}

.grille-cartes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

/* Pastille couleur de matière */
.pastille {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

/* Priorités de tâches — une couleur de bordure gauche, pas de badge criard */
.tache {
    border-left: 4px solid var(--ligne);
}
.tache[data-priorite="haute"] { border-left-color: #c98a2e; }
.tache[data-priorite="urgente"] { border-left-color: var(--alerte); }
.tache[data-priorite="basse"] { border-left-color: var(--succes); }

.tache.fait {
    opacity: 0.55;
    text-decoration: line-through;
}

/* Formulaires */
input, textarea, select {
    font-family: inherit;
    font-size: 0.92rem;
    padding: 8px 10px;
    border-radius: 7px;
    border: 1px solid var(--ligne);
    background: var(--bg-card);
    color: var(--text-principal);
    width: 100%;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-discret);
    margin-bottom: 4px;
}

.champ {
    margin-bottom: 12px;
}

/* Chronomètre */
.chrono-affichage {
    font-family: Georgia, serif;
    font-size: 3.2rem;
    text-align: center;
    margin: 30px 0;
}

/* Mémos type post-it */
.memo {
    padding: 14px;
    border-radius: 8px;
    color: #262421;
    box-shadow: 0 2px 6px var(--ombre);
    min-height: 100px;
}

@media (max-width: 720px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .content { padding: 20px; }
}
