/* Layout */

.split-view {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.side-panel {
    width: 210px;
    flex-shrink: 0;
    background: white;
    border-radius: 3px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.side-panel h3 {
    color: #55AB26;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* Sidebar course buttons */

.course-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    margin-bottom: 6px;
    border: 2px solid #E0E0E0;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: #363636;
}

.course-btn:hover {
    border-color: #55AB26;
    color: #55AB26;
}

.course-btn.active {
    background: #55AB26;
    color: white;
    border-color: #55AB26;
}

.course-count {
    float: right;
    background: rgba(0,0,0,0.10);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 13px;
}

/* crayon pour renommer un cours, visible que pour l'admin */
.course-edit {
    float: right;
    margin-right: 8px;
    font-size: 12px;
    opacity: 0.5;
}

.course-edit:hover { opacity: 1; }

.course-btn-add {
    border-style: dashed;
    color: #55AB26;
    text-align: center;
}

.course-progress {
    height: 4px;
    background: #E0E0E0;
    border-radius: 1px;
    margin-top: 5px;
    overflow: hidden;
    clear: both;
}

.course-bar {
    height: 100%;
    background: #55AB26;
    border-radius: 1px;
    transition: width 0.3s;
}

/* Main content */

.content {
    flex: 1;
    min-width: 0;
}

.concepts-box {
    background: white;
    border-radius: 3px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    margin-bottom: 20px;
}

/* Search & filters */

.filters {
    margin-bottom: 16px;
}


.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    margin-bottom: 7px;
}

.tag-label {
    font-size: 13px;
    color: #888;
}

.chip {
    padding: 5px 13px;
    border-radius: 7px;
    border: 2px solid #E0E0E0;
    background: white;
    font-size: 13px;
    cursor: pointer;
    color: #555;
}

.chip:hover { border-color: #55AB26; }

.chip-definition.active { background: #1976d2; color: white; border-color: #1976d2; }
.chip-theoreme.active   { background: #7b1fa2; color: white; border-color: #7b1fa2; }
.chip-mastery-0.active  { background: #888;    color: white; border-color: #888; }
.chip-mastery-1.active  { background: #f57c00; color: white; border-color: #f57c00; }
.chip-mastery-2.active  { background: #388e3c; color: white; border-color: #388e3c; }

.sub-row {
    display: none;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    padding-left: 20px;
    margin-bottom: 7px;
}

.sub-row.visible { display: flex; }

.sub-label {
    color: #aaa;
    font-size: 13px;
}

.chip-sub {
    padding: 4px 11px;
    border-radius: 7px;
    border: 2px solid #E0E0E0;
    background: white;
    font-size: 12px;
    cursor: pointer;
    color: #777;
    opacity: 0.5;
}

.chip-sub.active { opacity: 1; }

.chip-sub-definition.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.chip-sub-theoreme.active {
    background: #7b1fa2;
    color: white;
    border-color: #7b1fa2;
}

.chip-definition-label { color: #1976d2; }
.chip-theoreme-label   { color: #7b1fa2; }

/* Bulk action bar */

.action-bar {
    background: #55AB26;
    color: white;
    padding: 12px 18px;
    border-radius: 3px;
    margin-bottom: 16px;
    display: none;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.action-bar.visible { display: flex; }

.action-bar span { font-weight: 600; }

.bulk-select {
    padding: 6px 10px;
    border-radius: 2px;
    border: none;
    background: white;
    color: #363636;
    cursor: pointer;
}

.btn-primary {
    padding: 7px 16px;
    background: white;
    color: #55AB26;
    border: none;
    border-radius: 2px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary {
    padding: 7px 16px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid white;
    border-radius: 2px;
    font-weight: 600;
    cursor: pointer;
}

/* Toolbar */

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.count-label {
    font-size: 14px;
    color: #888;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-selectionner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1.5px solid #55AB26;
    border-radius: 6px;
    background: white;
    color: #55AB26;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-selectionner:hover {
    background: #f0fbe8;
}

.btn-selectionner.actif {
    background: #55AB26;
    color: white;
}

.view-switch {
    display: flex;
    gap: 4px;
    background: #F0F0F0;
    padding: 4px;
    border-radius: 3px;
}

.view-btn {
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-radius: 2px;
    cursor: pointer;
    color: #888;
    font-size: 16px;
}

.view-btn.active {
    background: white;
    color: #363636;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* Concept cards grid/list */

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

.concepts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.concepts-list .concept-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    border-top: 2px solid #E0E0E0 !important;
}


.concepts-list .concept-card.type-Definition { border-left: 4px solid #1976d2 !important; }
.concepts-list .concept-card.type-Theoreme   { border-left: 4px solid #7b1fa2 !important; }

.concepts-list .card-top    { flex: 1; margin-bottom: 0; align-items: center; }
.concepts-list .card-desc   { display: none; }
.concepts-list .card-footer { flex-shrink: 0; }

.concept-card {
    display: flex;
    flex-direction: column;
    border: 6px solid #E0E0E0;
    border-radius: 3px;
    padding: 14px;
    cursor: pointer;
    background: white;
    position: relative;
    transition: border-color 0.2s;
}

.concept-card:hover { border-color: #55AB26; }

.concept-card.type-Definition { border-top: 8px solid #1976d2; }
.concept-card.type-Theoreme   { border-top: 8px solid #7b1fa2; }

.concepts-list .concept-card:hover { border-color: #E0E0E0; }


.card-top {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 9px;
}


.type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 2px;
    font-size: 16px;
    flex-shrink: 0;
}

.type-icon.type-Definition { background: #e3f2fd; color: #1976d2; }
.type-icon.type-Theoreme   { background: #f3e5f5; color: #7b1fa2; }

.card-title {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    color: #222;
    line-height: 20px;
}

.mastery-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 14px;
    flex-shrink: 0;
}

.mastery-dot.m0 { background: #E0E0E0; color: #888; }
.mastery-dot.m1 { background: #fff3e0; color: #f57c00; }
.mastery-dot.m2 { background: #e8f5e9; color: #388e3c; }

.card-desc {
    font-size: 13px;
    color: #777;
    line-height: 20px;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 7px;
}

.course-tag {
    font-size: 12px;
    padding: 2px 7px;
    border-radius: 2px;
    background: #F0F0F0;
    color: #555;
}

.card-link {
    margin-left: auto;
    font-size: 12px;
    color: #55AB26;
}

.concept-card.selectionne {
    border-color: #55AB26;
    background: #f0fbe8;
}

.concepts-grid.en-selection .concept-card,
.concepts-list.en-selection .concept-card {
    cursor: pointer;
}

.empty-msg, .loading-msg {
    text-align: center;
    padding: 40px;
    color: #888;
}

/* Modal */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 40px 20px;
}

.modal-overlay.open { display: block; }

.modal-box {
    background: white;
    border-radius: 3px;
    padding: 28px;
    width: 560px;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.20);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #F0F0F0;
    border: none;
    border-radius: 2px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    color: #555;
}

.modal-close:hover { background: #E0E0E0; }

.modal-title {
    font-size: 19px;
    font-weight: 700;
    color: #222;
    margin-bottom: 4px;
    padding-right: 30px;
}

.modal-subtitle {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
}

.modal-cours-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.cours-tag-modal {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    background: #f1f8e9;
    color: #388e3c;
    border: 1px solid #c5e1a5;
    font-size: 12px;
    font-weight: 500;
}

.statut-cours-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #e8f5e9;
    color: #388e3c;
    font-size: 12px;
    font-weight: 600;
}

.modal-section {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #aaa;
    margin: 16px 0 8px;
}

.mastery-btns { display: flex; gap: 8px; }

.mastery-btn {
    flex: 1;
    padding: 9px;
    border: 2px solid #E0E0E0;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
}

.mastery-btn:hover      { border-color: #55AB26; }
.mastery-btn.active-0    { border-color: #888;    background: #F0F0F0; color: #555; }
.mastery-btn.active-1    { border-color: #f57c00; background: #fff3e0; color: #e65100; }
.mastery-btn.active-2    { border-color: #388e3c; background: #e8f5e9; color: #1b5e20; }

.modal-desc {
    background: #F9F9F9;
    border: 1px solid #E0E0E0;
    border-radius: 3px;
    padding: 16px;
    font-size: 15px;
    line-height: 26px;
    color: #333;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    background: #F9F9F9;
    border: 1px solid #E0E0E0;
    border-radius: 3px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    margin-bottom: 6px;
}

.resource-item:hover { background: #f0fbe8; }

/* Notification toast */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 22px;
    border-radius: 3px;
    color: white;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.20);
    z-index: 2000;
    opacity: 0;
    transform: translateX(300px);
    transition: all 0.3s;
}

.notification.show        { opacity: 1; transform: translateX(0); }
.notification-success     { background: #55AB26; }
.notification-error       { background: #e53935; }

/* Search bar top */

.search-bar-top {
    display: block;
    margin-bottom: 16px;
}

/* Notes personnelles dans le modal */
.note-textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid #E0E0E0;
    border-radius: 3px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: #fafafa;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.note-textarea:focus { outline: none; border-color: #55AB26; background: white; }
.note-status { font-size: 11px; color: #aaa; display: block; text-align: right; margin-top: 3px; min-height: 14px; }

/* Add concept button */

.add-btn {
    display: none;
    margin-left: auto;
    padding: 6px 14px;
    background: #55AB26;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.add-btn:hover { background: #489e1f; }

/* Admin fields inside modal */

.admin-btns {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.btn-edit {
    width: 30px;
    height: 30px;
    padding: 0;
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #1976d2;
    border-radius: 2px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete {
    width: 30px;
    height: 30px;
    padding: 0;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #c62828;
    border-radius: 2px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-confirm {
    padding: 7px 16px;
    background: #c62828;
    color: white;
    border: none;
    border-radius: 2px;
    font-weight: 600;
    cursor: pointer;
}

.admin-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E0E0E0;
    border-radius: 3px;
    font-size: 14px;
    margin-bottom: 6px;
    font-family: inherit;
}

.admin-input:focus {
    outline: none;
    border-color: #55AB26;
}

.course-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 150px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #E0E0E0;
    border-radius: 3px;
    margin-bottom: 6px;
}

.course-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.resource-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.resource-row button {
    padding: 4px 8px;
    background: #ffebee;
    color: #c62828;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-add-resource {
    padding: 6px 12px;
    background: #e8f5e9;
    color: #388e3c;
    border: 1px solid #388e3c;
    border-radius: 2px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 12px;
}

.admin-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #E0E0E0;
}

.admin-footer .btn-secondary {
    background: white;
    color: #55AB26;
    border: 2px solid #55AB26;
}

.admin-footer .btn-primary {
    background: #55AB26;
    color: white;
    padding: 8px 20px;
}

/* Admin: mastery hidden */

body.role-admin #mastery-filter-row { display: none; }
body.role-admin #bulk-actions-bar   { display: none !important; }

/* Responsive */

@media (max-width: 768px) {
    .split-view { flex-direction: column; }
    .side-panel  { width: 100%; position: static; max-height: 300px; }
    .concepts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .modal-overlay { padding: 12px; }
    .modal-box { padding: 18px; }
}
