/* TaskMaster CSS */

:root {
    --tm-primary: #4a90e2;
    --tm-secondary: #50e3c2;
    --tm-bg-block: #f8f9fa;
    --tm-sidebar-width: 260px;
    --tm-border-radius: 12px;
}

[data-theme="dark"] {
    --tm-bg-block: #2d3436;
}

/* --- Layout --- */
.tm-app-wrapper {
    display: flex;
    min-height: calc(100vh - 150px);
    /* Ajuster selon header/footer site */
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Sidebar --- */
.tm-sidebar {
    width: var(--tm-sidebar-width);
    flex-shrink: 0;
    background: #fff;
    border-radius: var(--tm-border-radius);
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .tm-sidebar {
    background: #1e272e;
}

.tm-sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.tm-nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
}

.tm-nav-separator {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #b2bec3;
    margin: 15px 0 5px 10px;
    font-weight: bold;
}

.tm-nav-item {
    padding: 10px 15px;
    border-radius: 8px;
    color: #636e72;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    cursor: pointer;
}

[data-theme="dark"] .tm-nav-item {
    color: #dfe6e9;
}

.tm-nav-item:hover {
    background: var(--tm-bg-block);
    color: var(--tm-primary);
}

.tm-nav-item.active {
    background: rgba(74, 144, 226, 0.1);
    color: var(--tm-primary);
    font-weight: bold;
}

/* --- Main Content --- */
.tm-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: #fff;
    padding: 15px 25px;
    border-radius: var(--tm-border-radius);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .tm-header {
    background: #1e272e;
}

/* --- Gamification Bar --- */
.tm-xp-bar-container {
    flex-grow: 1;
    margin: 0 30px;
    background: #dfe6e9;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    max-width: 400px;
}

.tm-xp-bar-fill {
    background: linear-gradient(90deg, var(--tm-primary), var(--tm-secondary));
    height: 100%;
    width: 0%;
    /* JS updated */
    transition: width 0.5s ease;
}

.tm-xp-text {
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 0.8rem;
    font-weight: bold;
    color: #636e72;
}

/* --- Timeline / Blocks --- */
.tm-timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tm-block {
    background: #fff;
    border-radius: var(--tm-border-radius);
    padding: 20px;
    border-left: 5px solid var(--tm-primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

[data-theme="dark"] .tm-block {
    background: #1e272e;
    color: #dfe6e9;
}

.tm-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.tm-block-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.1rem;
}

.tm-block-time {
    color: #636e72;
    font-size: 0.9rem;
    background: var(--tm-bg-block);
    padding: 2px 8px;
    border-radius: 4px;
}

/* --- Tasks within Block --- */
.tm-task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tm-task-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.tm-task-item:last-child {
    border-bottom: none;
}

.tm-task-checkbox {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--tm-primary);
}

.tm-task-title {
    flex-grow: 1;
}

.tm-task-done .tm-task-title {
    text-decoration: line-through;
    color: #b2bec3;
}

/* --- FAB (Floating Action Button) --- */
.tm-fab {
    position: fixed;
    bottom: 80px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--tm-primary);
    color: white;
    font-size: 24px;
    border: none;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    z-index: 1000;
}

.tm-fab:hover {
    transform: scale(1.1);
}

/* --- Chatbot Overlay --- */
.tm-chatbot-overlay {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: var(--tm-border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .tm-chatbot-overlay {
    background: #2d3436;
    border: 1px solid #636e72;
}

.tm-chatbot-header {
    background: var(--tm-primary);
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tm-chatbot-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f1f2f6;
}

[data-theme="dark"] .tm-chatbot-messages {
    background: #1e272e;
}

.tm-chatbot-input-area {
    padding: 15px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
}

[data-theme="dark"] .tm-chatbot-input-area {
    background: #2d3436;
    border-top: 1px solid #636e72;
}

/* --- Modals Dark Mode --- */
[data-theme="dark"] .modal-content {
    background-color: #2d3436;
    color: #dfe6e9;
    border: 1px solid #636e72;
}

[data-theme="dark"] .modal-header {
    border-bottom: 1px solid #636e72;
}

[data-theme="dark"] .modal-footer {
    border-top: 1px solid #636e72;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* --- Block Actions --- */
.tm-btn-action {
    color: #636e72;
    transition: color 0.2s;
}

[data-theme="dark"] .tm-btn-action {
    color: #b2bec3;
}

.tm-btn-action:hover {
    color: var(--tm-primary);
}