/* ================= DEPARTMENTS ================= */

.departments-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 20px;
}

/* CARD */

.department-item {
    background: linear-gradient(145deg, #182542, #111a30);
    padding: 24px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.25s ease;
    position: relative;
    overflow: hidden;
}

.department-item:hover {
    transform: translateY(-3px);
    border-color: rgba(59,130,246,0.5);
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
}

/* HEADER */

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

.department-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* LOGO */

.department-logo {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    object-fit: cover;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.08);
}

/* TEXT */

.department-label {
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
}

.department-category {
    font-size: 12px;
    color: #3b82f6;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.department-role {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
}

/* BUTTON */

.department-header .btn-primary {
    padding: 8px 14px;
    font-size: 13px;
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    border-radius: 10px;
    transition: 0.2s;
}

.department-header .btn-primary:hover {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

/* GRADES SECTION */

.department-grades {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* GRADE BADGE */

.grade-item {
    background: #0f172a;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    min-width: 200px;
    transition: 0.2s;
}

.grade-item:hover {
    background: #1e293b;
    border-color: rgba(59,130,246,0.4);
}

.grade-item strong {
    font-size: 13px;
    color: white;
}

.grade-discord-id {
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
}

/* EMPTY */

.roles-empty {
    font-size: 13px;
    color: #64748b;
    margin-top: 10px;
}

.department-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #3b82f6, transparent);
    opacity: 0.6;
}

/* ACTIONS */

.department-actions {
    display: flex;
    gap: 10px;
}

.btn-danger {
    background: #7f1d1d;
    border: 1px solid #dc2626;
    padding: 8px 14px;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
}

/* GRADE DELETE */

.grade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grade-delete {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: #64748b;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    transition: 0.2s;
}

.grade-delete:hover {
    background: #7f1d1d;
    color: white;
    border-color: #dc2626;
}

/* ================= CONFIRM MODAL ================= */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(8px);
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.confirm-overlay.active {
    display: flex !important;
}

.confirm-box {
    width: 420px;
    background: linear-gradient(145deg, #1b1f2a, #161a23);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.05);
    animation: confirmFade 0.2s ease;
}

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

.confirm-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.confirm-close {
    cursor: pointer;
    font-size: 18px;
    opacity: 0.6;
    transition: 0.2s;
}

.confirm-close:hover {
    opacity: 1;
}

.confirm-body {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 25px;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.08);
    padding: 8px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #334155;
}

@keyframes confirmFade {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 30, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    background: linear-gradient(145deg, #1b2235, #141c2c);
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 40px 100px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.05);
    animation: confirmFade 0.25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(180deg, rgba(245,158,11,0.6), transparent);
    pointer-events: none; /* 🔥 IMPORTANT */
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.modal-header {
    display: flex;
    align-items: center;
    padding: 22px 28px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 16px;
}

.modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1; /* 🔥 important */
}

.modal-close {
    margin-left: auto; /* pousse le X à droite */
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: none;
    color: #cbd5e1;
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s;
}

.modal-close:hover {
    background: #dc2626;
    color: white;
}

.modal-body {
    padding: 25px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* FORM */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: #94a3b8;
}

.form-group input,
.form-group select {
    background: #0f172a;
    border: 1px solid #2a2f3d;
    border-radius: 10px;
    padding: 10px 14px;
    color: white;
    transition: 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #3b82f6;
    outline: none;
}

#gradesContainer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.grade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 44px;
    gap: 12px;
    align-items: center;
}

.grade-row input {
    background: #0f172a;
    border: 1px solid #2a2f3d;
    border-radius: 10px;
    padding: 10px 14px;
    color: white;
    transition: 0.2s;
}

.grade-row input:focus {
    border-color: #3b82f6;
    outline: none;
}

.grade-remove {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
}

.grade-remove:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
    transform: scale(1.05);
}

.btn-success {
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    color: black;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-success:hover {
    background: linear-gradient(90deg, #4ade80, #22c55e);
}

.btn-primary {
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: 0.2s;
}

/* ================= EDIT MODE ================= */

.edit-badge {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    color: black;
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    animation: pulseEdit 1.5s infinite;
    display: inline-flex;
    align-items: center;
    height: 26px;
}

.edit-badge.hidden {
    display: none;
}

.modal.edit-mode {
    border: 1px solid rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

@keyframes pulseEdit {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* TITLE WRAPPER */

.modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hidden {
    display: none;
}