
/* ==========================================
   🧱 BASE RESET & TYPOGRAPHIE
========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background-color: #f8f9fa;
    color: #333;
    height: 100%;
}

a {
    color: #0066cc;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    color: #003366;
}

/* ==========================================
   🎨 STRUCTURE GLOBALE
========================================== */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
}

.card {
    background-color: #fff;
    border: 1px solid #dde1e6;
    border-radius: 0.75rem;
    padding: 2rem;
    margin: 1rem 0;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.card.message {
    max-width: 80%;
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 12px;
    background: #eee;
    position: relative;
}

.card.message.self {
    margin-left: auto;
    background: #cce5ff;
    text-align: right;
}

.card.thread-item {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: background 0.2s ease-in-out;
}
.card.thread-item:hover {
    background: #f9f9f9;
}

/* ==========================================
   🧾 FORMULAIRES & INPUTS
========================================== */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
button {
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    font-size: 1rem;
}

input:focus,
button:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}

button {
    background-color: #0066cc;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background-color: #004c99;
}

/* ==========================================
   ✅ MESSAGES & ALERTES
========================================== */
.message.success {
    color: green;
    background: #e6ffed;
    border-left: 5px solid green;
    padding: 1rem;
    border-radius: 0.5rem;
}

.message.error {
    color: #a10000;
    background: #ffe6e6;
    border-left: 5px solid red;
    padding: 1rem;
    border-radius: 0.5rem;
}

/* ==========================================
   📱 RESPONSIVE
========================================== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    .card {
        padding: 1.5rem;
    }
}

/* ==========================================
   🔝 HEADER & FOOTER
========================================== */
.site-header, .site-footer {
    background-color: #003366;
    color: white;
    padding: 1rem 0;
}

.site-header h1, .site-title {
    font-size: 1.5rem;
    margin: 0;
    color: #d1dbe6;
}

.site-header nav a {
    margin-right: 1rem;
    color: #cce6ff;
    font-weight: bold;
}
.site-header nav a:hover {
    color: white;
}

.site-footer {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 2rem;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-img {
    height: 80px;
    width: auto;
}

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


/* ==========================================
   🧑‍💼 TABLEAUX ADMIN (USERS & RIGHTS)
========================================== */
.rights-table tbody tr:nth-child(odd),
.user-table tbody tr:nth-child(odd) {
    background-color: #d9d2d2;
}

.rights-table tbody tr:nth-child(even),
.user-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

.rights-table thead tr,
.user-table thead tr {
    background-color: #e0e0e0;
    font-weight: bold;
}

.rights-table td:not(:first-child) {
    text-align: center;
    vertical-align: middle;
}

.rights-table td,
.rights-table th,
.user-table td,
.user-table th {
    padding: 0.5rem 0.75rem;
}

.rights-table input[type="checkbox"] {
    transform: scale(1.1);
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

/* ==========================================
   💬 MESSAGERIE PRIVÉE (MP)
========================================== */
.message-row {
    display: flex;
    margin-bottom: 1rem;
}
.message-row.own {
    justify-content: flex-end;
}
.message-bubble {
    max-width: 70%;
    padding: 1rem;
    border-radius: 1rem;
    background: #f0f0f0;
    position: relative;
}
.message-row.own .message-bubble {
    background: #cce5ff;
    color: #000;
    text-align: right;
}
.message-avatar,
.card.message img.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0.5rem;
    background: #eee;
}

.message-meta {
    font-size: 0.8em;
    margin-bottom: 0.5rem;
    color: #666;
}

.badge-unread,
.card.message .badge.unread,
.unread-badge {
    background: red;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 0.1rem 0.5rem;
    border-radius: 1rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.skeleton-message {
    height: 70px;
    width: 60%;
    background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.2s infinite;
    border-radius: 10px;
    margin-bottom: 1rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.card.message .badge {
    font-size: 0.75em;
    padding: 0.15em 0.5em;
    background: #999;
    border-radius: 5px;
    color: #fff;
}

.message-wrapper {
    display: flex;
    align-items: flex-start;
}
.message-wrapper.self {
    flex-direction: row-reverse;
}

/* ==========================================
   🔔 NOTIFICATIONS & MP HEADER
========================================== */
.mp-link {
    position: relative;
    font-weight: bold;
    text-decoration: none;
}

.mp-icon {
    font-weight: bold;
    margin-right: 0.3rem;
    transition: color 0.3s ease;
}

.mp-icon.has-unread {
    color: red;
}

.mp-count,
.mp-badge {
    font-weight: bold;
    margin-left: 4px;
    color: red;
}

/* ==========================================
   🧵 LISTE DES DISCUSSIONS
========================================== */
.unread-thread h3 a,
.thread-item .unread h3 a {
    font-weight: bold;
    color: #c00;
}

#thread-list {
    margin-top: 1.5rem;
}

#new-thread-btn {
    background-color: #007BFF;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background 0.2s ease-in-out;
}

#new-thread-btn:hover {
    background-color: #0056b3;
}

#search-threads {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

/* ==========================================
   🔍 AUTOCOMPLETE (MP NOUVEAU)
========================================== */
.autocomplete-box {
    border: 1px solid #ccc;
    background: white;
    position: absolute;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    width: 250px;
}

.autocomplete-box div {
    padding: 0.5rem;
    cursor: pointer;
}

.autocomplete-box div:hover {
    background-color: #f0f0f0;
}

/* ==========================================
   🖼️ AVATAR GLOBAL
========================================== */
.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

/* ==========================================
   🖼️ SEO
========================================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.3rem;
}
input[type="text"], textarea, select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}
