/* PROFILAGE PROFILSUCCESS - styles */
:root {
  --vert: #1a472a;
  --vert-clair: #6A9D51;
  --vert-fonce: #0d2818;
  --orange: #e8913a;
  --creme: #fdf8f0;
  --gris-texte: #444;
  --gris-clair: #f5f5f5;
  --gris-border: #e0e0e0;
  --rouge: #e53935;
  --bleu: #2196F3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: 'Segoe UI', 'Work Sans', Arial, sans-serif; color: var(--gris-texte); background: var(--creme); }
a { color: var(--vert); text-decoration: none; }
a:hover { color: var(--orange); }

/* Header */
.header {
  background: linear-gradient(135deg, var(--vert) 0%, var(--vert-fonce) 100%);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header .brand { font-weight: 900; letter-spacing: 3px; color: var(--orange); font-size: 18px; }
.header .brand small { color: #fff; letter-spacing: 2px; font-size: 12px; margin-left: 8px; font-weight: 600; }
.header nav { display: flex; gap: 16px; align-items: center; }
.header nav a { color: #fff; font-weight: 700; font-size: 12.5px; padding: 6px 12px; border-radius: 6px; text-transform: uppercase; letter-spacing: 1px; }
.header nav a:hover, .header nav a.active { background: rgba(255,255,255,0.15); color: var(--orange); }
.header .user-badge { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #fff; }
.header .user-badge .chip { background: var(--orange); color: #fff; padding: 4px 10px; border-radius: 12px; font-weight: 700; font-size: 12px; }

/* Main */
main { max-width: 1400px; margin: 0 auto; padding: 24px; }
h1, h2, h3 { color: var(--vert); font-weight: 800; }
h1 { font-size: 1.8em; margin-top: 0; }
h2 { font-size: 1.3em; }

/* Cards / tuiles */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); border-left: 4px solid var(--vert-clair); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.card h3 { margin: 0 0 6px 0; font-size: 1.1em; }
.card p { margin: 0 0 12px 0; font-size: 13px; color: #666; line-height: 1.5; }
.card .actions { display: flex; gap: 8px; }

/* Boutons */
.btn { display: inline-block; background: var(--vert); color: #fff; padding: 10px 20px; border: none; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer; transition: background 0.15s; text-decoration: none; text-transform: uppercase; letter-spacing: 0.5px; }
.btn:hover { background: #2a5a3a; color: #fff; }
.btn-orange { background: var(--orange); }
.btn-orange:hover { background: #d47c25; }
.btn-danger { background: var(--rouge); }
.btn-danger:hover { background: #c62828; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--vert); border: 2px solid var(--vert); }
.btn-ghost:hover { background: var(--vert); color: #fff; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 700; font-size: 13px; color: var(--vert); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gris-border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--vert-clair); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Password eye */
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 44px; }
.pwd-eye {
  position: absolute;
  right: 8px;
  bottom: 6px;
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #888;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.pwd-eye:hover { color: var(--vert); background: rgba(26,71,42,0.08); }
.pwd-eye:focus { outline: 2px solid var(--vert-clair); outline-offset: 2px; }

/* Login card */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--vert) 0%, var(--vert-fonce) 100%); padding: 20px; }
.login-card { background: #fff; padding: 34px 40px; border-radius: 16px; box-shadow: 0 15px 60px rgba(0,0,0,0.25); max-width: 400px; width: 100%; }
.login-card .brand { text-align: center; margin-bottom: 22px; }
.login-card .brand-name { font-size: 22px; font-weight: 900; letter-spacing: 4px; color: var(--vert); }
.login-card .brand-sub { font-size: 11px; letter-spacing: 3px; color: var(--orange); font-weight: 700; margin-top: 4px; }
.login-card h2 { text-align: center; margin: 8px 0 22px 0; color: var(--vert); font-size: 1.2em; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fce4ec; color: #c62828; border-left: 4px solid var(--rouge); }
.alert-ok { background: #e8f5e9; color: var(--vert); border-left: 4px solid var(--vert-clair); }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.table th { background: var(--vert); color: #fff; text-align: left; padding: 12px 16px; font-size: 13px; letter-spacing: 0.5px; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--gris-border); font-size: 14px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: var(--gris-clair); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.badge-ok { background: #e8f5e9; color: var(--vert); }
.badge-off { background: #f5f5f5; color: #999; }
.badge-orange { background: #fff3e0; color: var(--orange); }
.badge-locked { background: #ede7f6; color: #7E57C2; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 28px 32px; max-width: 640px; width: 92%; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 80px rgba(0,0,0,0.4); }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.checkbox-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checkbox-list label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    background: var(--gris-clair);
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--gris-texte);
    transition: background 0.15s ease;
    justify-content: flex-start;
    text-align: left;
    margin: 0;
}
.checkbox-list label:hover { background: #eef4e8; }
.checkbox-list label input[type=checkbox] {
    accent-color: var(--vert);
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}
.checkbox-list label span,
.checkbox-list label .cb-label { flex: 1; }

/* Liste verticale de droits (Parametres, Edition, Actif) */
.rights-list { display: flex; flex-direction: column; gap: 8px; }
.rights-list label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    background: var(--gris-clair);
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--gris-texte);
    transition: background 0.15s ease;
    justify-content: flex-start;
    text-align: left;
    margin: 0;
}
.rights-list label:hover { background: #eef4e8; }
.rights-list label input[type=checkbox] {
    accent-color: var(--vert);
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}
.rights-list label input[type=checkbox]:disabled + span { color: #999; }

/* Footer */
footer { text-align: center; padding: 24px; color: #999; font-size: 12px; }

/* Section titre + bouton "+" */
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-head h1 { margin: 0; }

.small { font-size: 12px; color: #888; }
.mono { font-family: 'Courier New', monospace; }

/* ============================================================
 * MEGA MODERN - Command Palette + AI Widget + Prefs modal
 * ============================================================ */

/* -- Command Palette -- */
.cmdp-wrap { position: fixed; inset: 0; background: rgba(15,25,20,0.5); backdrop-filter: blur(6px); z-index: 9999; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdp-wrap.open { display: flex; animation: cmdpFadeIn 0.15s ease; }
@keyframes cmdpFadeIn { from { opacity: 0; } to { opacity: 1; } }
.cmdp-modal {
    background: #fff;
    border-radius: 16px;
    width: 620px; max-width: 92%;
    box-shadow: 0 25px 80px rgba(0,0,0,0.35);
    overflow: hidden;
    animation: cmdpSlideDown 0.25s cubic-bezier(.4,.2,.2,1);
}
@keyframes cmdpSlideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.cmdp-inp-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    color: #999;
}
.cmdp-inp-wrap input {
    flex: 1; border: none; outline: none; font-size: 16px; background: transparent; font-family: inherit; color: #333;
}
.cmdp-esc {
    background: #f0f0f0; color: #999; font-size: 10px; padding: 3px 8px; border-radius: 6px; font-weight: 700; letter-spacing: 1px;
}
.cmdp-results { max-height: 420px; overflow-y: auto; padding: 6px 0; }
.cmdp-item {
    padding: 12px 20px; cursor: pointer; transition: background 0.1s ease;
    border-left: 3px solid transparent;
}
.cmdp-item.active { background: #f1f8e9; border-left-color: var(--vert-clair); }
.cmdp-title { font-weight: 700; color: #1a472a; font-size: 14px; margin-bottom: 2px; }
.cmdp-desc { font-size: 12px; color: #888; }
.cmdp-empty { padding: 40px 20px; text-align: center; color: #999; }
.cmdp-footer {
    padding: 10px 18px; background: #fafafa; border-top: 1px solid #eee;
    display: flex; gap: 18px; font-size: 11px; color: #999;
}
.cmdp-footer kbd {
    background: #fff; border: 1px solid #ddd; border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; font-family: monospace; font-size: 10px; margin-right: 4px; color: #666;
}

/* -- Preferences UI list -- */
.prefs-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.prefs-row {
    display: flex; justify-content: space-between; align-items: center;
    background: #f8f9fa; padding: 12px 14px; border-radius: 10px; cursor: pointer;
    transition: background 0.15s;
}
.prefs-row:hover { background: #eef4e8; }
.prefs-label { font-weight: 700; color: #1a472a; font-size: 14px; }
.prefs-desc { font-size: 12px; color: #666; margin-top: 2px; }
.prefs-row input[type=checkbox] { accent-color: var(--vert); width: 20px; height: 20px; cursor: pointer; }

/* -- AI Widget bouton flottant -- */
.ai-fab {
    position: fixed; bottom: 24px; right: 24px;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7E57C2, #5E35B1);
    color: #fff; border: none; cursor: pointer;
    box-shadow: 0 12px 30px rgba(94,53,177,0.5), 0 0 0 4px rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 9997;
    transition: transform 0.25s cubic-bezier(.4,.2,.2,1), box-shadow 0.25s;
    animation: aiFloat 4s ease-in-out infinite;
}
@keyframes aiFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.ai-fab:hover { transform: scale(1.08); box-shadow: 0 18px 40px rgba(94,53,177,0.6); }
.ai-fab.open { transform: rotate(90deg) scale(0.9); animation: none; }
.ai-fab-glow {
    position: absolute; inset: -6px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.4), transparent 70%);
    animation: aiPulse 2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes aiPulse { 0%, 100% { opacity: 0.3; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.1); } }

/* -- AI Widget chat panel -- */
.ai-widget {
    position: fixed; bottom: 100px; right: 24px;
    width: 380px; max-width: calc(100vw - 40px);
    height: 540px; max-height: calc(100vh - 140px);
    background: #fff; border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
    display: flex; flex-direction: column;
    z-index: 9997;
    transform: translateY(20px) scale(0.95);
    opacity: 0; pointer-events: none;
    transition: transform 0.28s cubic-bezier(.4,.2,.2,1), opacity 0.22s;
    overflow: hidden;
}
.ai-widget.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.ai-head {
    padding: 16px 20px; background: linear-gradient(135deg, #7E57C2, #5E35B1); color: #fff;
    display: flex; align-items: center; justify-content: space-between;
}
.ai-title { display: flex; align-items: center; gap: 12px; }
.ai-dot { width: 10px; height: 10px; border-radius: 50%; background: #4CAF50; box-shadow: 0 0 0 4px rgba(76,175,80,0.3); animation: aiPulse 2s ease-in-out infinite; }
.ai-sub { font-size: 11px; opacity: 0.85; }
.ai-close { background: rgba(255,255,255,0.15); color: #fff; border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ai-close:hover { background: rgba(255,255,255,0.25); }
.ai-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #faf5ff 0%, #fff 100%); }
.ai-msg { display: flex; }
.ai-msg.ai-user { justify-content: flex-end; }
.ai-msg.ai-assistant { justify-content: flex-start; }
.ai-bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 13px; line-height: 1.5; word-wrap: break-word; animation: aiMsgIn 0.25s ease-out; }
@keyframes aiMsgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.ai-msg.ai-user .ai-bubble { background: linear-gradient(135deg, #7E57C2, #5E35B1); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.ai-assistant .ai-bubble { background: #fff; color: #333; border: 1px solid #ede7f6; border-bottom-left-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.ai-typing { display: flex; gap: 4px; padding: 12px 16px; }
.ai-typing span { width: 8px; height: 8px; background: #7E57C2; border-radius: 50%; animation: aiTyping 1.4s ease-in-out infinite; }
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiTyping { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-6px); opacity: 1; } }
.ai-input-wrap { padding: 12px 14px; border-top: 1px solid #ede7f6; display: flex; gap: 8px; align-items: center; background: #fff; }
.ai-input-wrap input { flex: 1; padding: 10px 14px; border: 2px solid #ede7f6; border-radius: 22px; font-size: 13px; outline: none; font-family: inherit; transition: border-color 0.15s; }
.ai-input-wrap input:focus { border-color: #7E57C2; }
.ai-input-wrap button { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #7E57C2, #5E35B1); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(94,53,177,0.35); transition: transform 0.15s; }
.ai-input-wrap button:hover { transform: scale(1.08); }
