:root {
    --bg: #303030;
    --bg-card: #3A3A3A;
    --accent: #ED7F10;
    --text: #FFFFFF;
    --text-muted: #B5B5B5;
    --radius: 14px;
    --shadow: 0 8px 20px rgba(0,0,0,0.4);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", sans-serif;
    display: flex;
}

/* SIDEBAR */

.sidebar {
    width: 240px;
    background: #262626;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    box-shadow: var(--shadow);
    transition: width 0.3s ease;
    position: relative;
}

.sidebar.collapsed {
    width: 80px;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
    text-align: center;
    transition: opacity 0.3s;
}

.sidebar.collapsed .logo {
    opacity: 0;
}

.toggle-btn {
    position: absolute;
    top: 20px;
    right: -15px;
    background: var(--accent);
    border: none;
    color: #111;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

.sidebar nav .icon {
    font-size: 1.4rem;
}

.sidebar nav .label {
    transition: opacity 0.3s;
}

.sidebar.collapsed nav .label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* DASHBOARD */

.dashboard {
    flex: 1;
    padding: 40px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

/* CARTES */

.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.card h2 {
    margin-top: 0;
    color: var(--accent);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sub-title {
    margin: 10px 0 5px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* LISTES */

.todo-list,
.habits-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    flex: 1;
    overflow-y: auto;
}

.todo-item,
.habit-item {
    background: #2A2A2A;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.todo-main {
    flex: 1;
}

.todo-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.todo-title {
    font-weight: 500;
}

.todo-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.todo-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.done-list .todo-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-item input[type="checkbox"],
.habit-item input[type="checkbox"] {
    transform: scale(1.2);
    accent-color: var(--accent);
    margin-top: 3px;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.1rem;
    cursor: pointer;
    margin-left: 4px;
}

/* DRAG & DROP */

.todo-item.dragging {
    opacity: 0.5;
}

/* BOUTON + */

.add-btn {
    background: var(--accent);
    border: none;
    color: #111;
    font-size: 1.6rem;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    align-self: flex-end;
    margin-top: 10px;
}

/* MODAL */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius);
    width: 340px;
    box-shadow: var(--shadow);
}

.modal-content h2 {
    margin-top: 0;
    color: var(--accent);
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: none;
    margin-bottom: 10px;
    background: #2A2A2A;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
}

.modal-content label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.modal-content textarea {
    min-height: 60px;
    resize: vertical;
}

.save-btn,
.close-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    margin-top: 8px;
    cursor: pointer;
}

.save-btn {
    background: var(--accent);
    color: #111;
}

.close-btn {
    background: #555;
    color: var(--text);
}

/* HABITS SCORE + STATS */

.habit-score {
    color: var(--accent);
    font-weight: bold;
    margin: 8px 0;
}

.habit-stats p {
    margin: 2px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* RESPONSIVE */

@media (max-width: 1000px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .dashboard {
        padding: 20px;
        gap: 15px;
    }

    .add-btn {
        font-size: 1.4rem;
        padding: 8px 14px;
    }
}
