/* ============================================================
   ESPACE COURS UAMDD - styles partagés (type Canvas)
   ============================================================ */
:root{
  --e-primary:#005A9C; --e-primary-dark:#003d6b;
  --e-red:#DA0434; --e-bg:#f4f6f9; --e-border:#e5e8ee;
  --e-text:#1f2937; --e-muted:#6b7280;
}
*{box-sizing:border-box}
body{margin:0;font-family:'Segoe UI',Arial,sans-serif;background:var(--e-bg);color:var(--e-text)}
a{color:var(--e-primary);text-decoration:none}
.e-container{max-width:1180px;margin:0 auto;padding:0 18px}

/* Barre supérieure */
.e-topbar{background:#fff;border-bottom:1px solid var(--e-border);position:sticky;top:0;z-index:100}
.e-topbar-inner{display:flex;align-items:center;gap:16px;height:60px}
.e-brand{display:flex;align-items:center;gap:10px;font-weight:700;color:var(--e-primary)}
.e-brand img{height:34px;border-radius:6px}
.e-topbar .spacer{flex:1}
.e-navlink{color:var(--e-muted);font-size:.9rem;padding:.4rem .6rem;border-radius:6px}
.e-navlink:hover,.e-navlink.active{background:#eef2f7;color:var(--e-primary)}
.e-badge-count{background:var(--e-red);color:#fff;border-radius:10px;font-size:.7rem;padding:1px 6px;margin-left:4px}

/* Boutons */
.e-btn{display:inline-flex;align-items:center;gap:6px;border:none;border-radius:8px;padding:.55rem .95rem;
  font-size:.9rem;font-weight:600;cursor:pointer;transition:.15s}
.e-btn-primary{background:var(--e-primary);color:#fff}
.e-btn-primary:hover{background:var(--e-primary-dark)}
.e-btn-light{background:#eef2f7;color:var(--e-primary)}
.e-btn-danger{background:#fef2f2;color:#dc2626}
.e-btn-sm{padding:.35rem .6rem;font-size:.82rem}
.e-btn:disabled{opacity:.5;cursor:not-allowed}

/* Cartes */
.e-card{background:#fff;border:1px solid var(--e-border);border-radius:12px;padding:18px;box-shadow:0 1px 3px rgba(0,0,0,.04)}
.e-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}

/* Carte cours */
.course-card{border:1px solid var(--e-border);border-radius:12px;overflow:hidden;background:#fff;cursor:pointer;transition:.15s}
.course-card:hover{box-shadow:0 6px 20px rgba(0,0,0,.1);transform:translateY(-2px)}
.course-card .cc-banner{height:90px}
.course-card .cc-body{padding:14px 16px}
.course-card .cc-title{font-weight:700;margin:0 0 4px}
.course-card .cc-meta{font-size:.8rem;color:var(--e-muted)}
.cc-role{display:inline-block;font-size:.7rem;font-weight:700;text-transform:uppercase;padding:2px 8px;border-radius:10px}
.cc-role.enseignant{background:#e0f2fe;color:#0369a1}
.cc-role.etudiant{background:#dcfce7;color:#166534}

/* Onglets */
.e-tabs{display:flex;gap:2px;border-bottom:2px solid var(--e-border);overflow-x:auto;margin-bottom:18px}
.e-tab{padding:.7rem 1rem;border:none;background:none;font-size:.9rem;font-weight:600;color:var(--e-muted);
  cursor:pointer;border-bottom:3px solid transparent;margin-bottom:-2px;white-space:nowrap}
.e-tab:hover{color:var(--e-primary)}
.e-tab.active{color:var(--e-primary);border-bottom-color:var(--e-primary)}

/* Formulaires */
.e-field{margin-bottom:14px}
.e-field label{display:block;font-size:.82rem;font-weight:600;margin-bottom:5px;color:#374151}
.e-input,.e-textarea,.e-select{width:100%;padding:.6rem .75rem;border:1px solid #d1d5db;border-radius:8px;font-size:.9rem;font-family:inherit}
.e-textarea{min-height:90px;resize:vertical}
.e-input:focus,.e-textarea:focus,.e-select:focus{outline:none;border-color:var(--e-primary);box-shadow:0 0 0 3px rgba(0,90,156,.12)}

/* Divers */
.e-empty{text-align:center;color:var(--e-muted);padding:40px 20px}
.e-pill{display:inline-block;font-size:.72rem;font-weight:700;padding:2px 9px;border-radius:10px}
.pill-remis{background:#dbeafe;color:#1e40af}.pill-note{background:#dcfce7;color:#166534}
.pill-retard{background:#fef3c7;color:#92400e}.pill-attente{background:#f3f4f6;color:#6b7280}
.e-table{width:100%;border-collapse:collapse;font-size:.88rem}
.e-table th,.e-table td{padding:.6rem .7rem;border-bottom:1px solid var(--e-border);text-align:left}
.e-table th{background:#f9fafb;font-size:.78rem;text-transform:uppercase;color:var(--e-muted)}

/* Modale */
.e-modal-bg{position:fixed;inset:0;background:rgba(15,23,42,.55);display:none;align-items:center;justify-content:center;z-index:1000;padding:18px}
.e-modal-bg.open{display:flex}
.e-modal{background:#fff;border-radius:14px;max-width:620px;width:100%;max-height:90vh;overflow-y:auto;padding:22px}
.e-modal h3{margin:0 0 16px}

/* Toast */
.e-toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);background:#1e293b;color:#fff;
  padding:.7rem 1.3rem;border-radius:10px;font-size:.85rem;z-index:2000;box-shadow:0 6px 24px rgba(0,0,0,.3)}

/* ---------- RESPONSIVE ---------- */
img,video,iframe{max-width:100%}
/* Tous les tableaux larges deviennent défilables horizontalement */
.e-tablewrap{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
.e-tablewrap .e-table{min-width:520px}

/* Tablette : la barre du haut s'empile proprement */
@media (max-width:860px){
  .e-topbar-inner{flex-wrap:wrap;height:auto;padding:10px 0;gap:6px 10px}
  .e-topbar-inner .spacer{display:none}
  .e-brand{font-size:.95rem;margin-right:auto}
  .e-navlink{font-size:.82rem;padding:.3rem .45rem}
}

/* Mobile */
@media (max-width:600px){
  .e-container{padding:0 12px}
  .e-grid{grid-template-columns:1fr;gap:12px}

  /* En-têtes de page : titre + actions s'empilent */
  .e-container > div[style*="justify-content:space-between"]{flex-wrap:wrap;gap:10px}
  .e-btn{font-size:.85rem;padding:.5rem .8rem}

  /* Page cours */
  .course-head{padding:18px 0}
  .course-head h1{font-size:1.2rem}
  .e-tabs{gap:0;margin-bottom:14px}
  .e-tab{padding:.55rem .7rem;font-size:.82rem}

  /* Lignes (devoirs, modules, quiz…) : passent en colonne, boutons en bas */
  .item-row{flex-wrap:wrap}
  .item-row > div[style*="flex:1"]{flex-basis:100%;margin-bottom:6px}

  /* Modales : largeur + grilles internes 2 colonnes -> 1 colonne */
  .e-modal{padding:16px;border-radius:12px}
  .e-modal div[style*="grid-template-columns"]{grid-template-columns:1fr !important}

  /* Tableaux compacts */
  .e-table{font-size:.82rem}
  .e-table th,.e-table td{padding:.45rem .55rem}

  /* Cartes cours plus aérées */
  .course-card .cc-banner{height:70px}
}
