/* ═══════════════════════════════════════════════════════════════
   THEME.CSS — Thème unifié partagé par tous les sites Equans PE
   Variables, reset, composants communs, responsive
   ═══════════════════════════════════════════════════════════════ */

/* ───── Variables CSS (identiques au projet étiquettes) ───── */
:root {
  --primary: #70BD95;
  --primary-dim: #5a9a7a;
  --primary-glow: rgba(112,189,149,.15);
  --primary-rgb: 112,189,149;
  --secondary: #1e3a8a;

  --bg-dark: #0f1923;
  --bg-sidebar: #1e2a38;
  --bg-panel: #253446;
  --bg-canvas: #2a3648;

  --text-light: #e8ecf1;
  --text-dim: #8899aa;

  --border: #2e4058;
  --border-light: #3a5068;

  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  --success: #27ae60;

  --font: 'Segoe UI', system-ui, sans-serif;
  --radius: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,.3);
  --tr: .15s ease;
}

/* ───── Thème clair ───── */
[data-theme="light"] {
  --bg-dark: #f0f2f5;
  --bg-sidebar: #ffffff;
  --bg-panel: #e8ecf1;
  --bg-canvas: #dde3ea;

  --text-light: #1a2332;
  --text-dim: #4a5568;

  --border: #cbd5e0;
  --border-light: #a0aec0;

  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --primary-glow: rgba(112,189,149,.12);
}

/* ───── Reset ───── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 50% at 15% 0%, rgba(112,189,149,.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 45% at 85% 100%, rgba(30,58,138,.07) 0%, transparent 55%);
}
[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 80% 50% at 15% 0%, rgba(112,189,149,.1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 45% at 85% 100%, rgba(30,58,138,.06) 0%, transparent 55%);
}

/* ───── Scrollbar ───── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ───── Liens ───── */
a { color: var(--primary); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--primary-dim); text-decoration: underline; }

/* ───── Header commun ───── */
.pe-header {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.pe-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-light);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.pe-header .logo img { height: 40px; transition: filter var(--tr); }

/* Dark : logo tout en blanc */
.pe-header .logo img { filter: brightness(0) invert(1); }
/* Light : couleurs originales du SVG */
[data-theme="light"] .pe-header .logo img { filter: brightness(1); }
.pe-header .logo span { color: var(--primary); }

.pe-header nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.pe-header nav a {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  transition: all var(--tr);
}
.pe-header nav a:hover { background: var(--primary-glow); color: var(--primary); text-decoration: none; }
.pe-header nav a.active { background: var(--primary-glow); color: var(--primary); font-weight: 600; }

/* ───── Barre de recherche (header) ───── */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap .search-box { padding-right: 28px; }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-dim); font-size: 15px;
  cursor: pointer; padding: 2px 4px; line-height: 1; display: none;
  border-radius: 3px; transition: color var(--tr);
}
.search-clear:hover { color: var(--danger, #e74c3c); }

.pe-header .search-box {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  color: var(--text-light);
  font-family: var(--font);
  font-size: 12px;
  width: 200px;
  transition: border-color var(--tr);
}
.pe-header .search-box:focus { border-color: var(--primary); outline: none; }

/* ───── Container principal ───── */
.pe-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

.pe-main > h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.pe-main > .subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 28px;
}

/* ───── Grille de cartes URL ───── */
.url-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.url-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  transition: all var(--tr);
  opacity: 1;
  transform: translateY(0) scale(1);
  position: relative;
}

.url-card:hover {
  border-color: var(--primary);
  transform: translateY(-6px) scale(1.02);
  box-shadow:
    0 16px 48px rgba(0,0,0,.35),
    0 0 0 1px rgba(112,189,149,.25),
    0 0 80px -15px rgba(112,189,149,.2);
  backdrop-filter: blur(20px) saturate(180%);
  background: rgba(30, 42, 56, .55);
}
/* Light : pas de blur, pas de fond transparent */
[data-theme="light"] .url-card:hover {
  background: var(--bg-sidebar);
  backdrop-filter: none;
  box-shadow:
    0 12px 36px rgba(0,0,0,.10),
    0 0 0 1px rgba(112,189,149,.3),
    0 0 60px -15px rgba(112,189,149,.12);
}

.url-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.url-card .url-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
}

.url-card .url-item img { width: 20px; height: 20px; flex-shrink: 0; }

.url-card .url-item a {
  color: var(--primary);
  text-decoration: none;
}
.url-card .url-item a:hover { text-decoration: underline; }

.url-card .url-detail {
  font-size: 12px;
  color: var(--text-dim);
  padding-left: 28px;
  word-break: break-all;
  user-select: all;
  cursor: help;
}

.url-card .url-label {
  font-size: 13px;
  color: var(--text-dim);
}

/* ───── Boutons ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 12px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--tr);
  text-decoration: none;
}
.btn:hover { background: var(--bg-panel); color: var(--text-light); text-decoration: none; }
.btn.primary { background: var(--primary); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--primary-dim); }

/* ───── Sections repliables (applications) ───── */
.pe-section {
  margin-bottom: 16px;
}

.pe-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--tr);
  user-select: none;
}

.pe-section-title:hover { border-color: var(--primary); }

.pe-section-title::after {
  content: '\25BC';
  font-size: 10px;
  color: var(--text-dim);
  transition: transform .3s;
}

.pe-section.open .pe-section-title::after { transform: rotate(180deg); }
.pe-section.open .pe-section-title { border-color: var(--primary); background: var(--primary-glow); color: var(--primary); }

.pe-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s ease-out;
}

.pe-section.open .pe-section-content { max-height: 9999px; }

/* ───── App items (applications) ───── */
.app-item {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.app-item:hover { border-color: var(--border-light); }

.app-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-light);
}

.app-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.app-buttons button,
.app-buttons select {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 600;
  transition: all var(--tr);
  min-width: 60px;
}

.app-buttons button:hover,
.app-buttons select:hover { background: var(--primary-dim); }

.app-buttons select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='18' viewBox='0 0 24 24' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 26px;
}

.app-buttons select option {
  color: var(--text-light);
  background: var(--bg-sidebar);
  padding: 6px;
}

/* ───── Deux colonnes (applications) ───── */
.pe-two-cols {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.pe-col-left {
  flex: 1;
  min-width: 300px;
}

.pe-col-right {
  flex: 2;
  min-width: 400px;
  position: sticky;
  top: 76px;
  align-self: flex-start;
  height: fit-content;
}

.pe-card {
  background: var(--bg-sidebar);
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.pe-card img { width: 100%; border-radius: 8px; }

.pe-card .description {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-top: 10px;
}

/* ───── Sidebar (maj_it-pe) ───── */
.pe-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
}

.pe-sidebar-title {
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 0 20px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.pe-sidebar a {
  display: block;
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 20px;
  font-size: 12px;
  border-left: 3px solid transparent;
  transition: all var(--tr);
  line-height: 1.4;
}
.pe-sidebar a:hover,
.pe-sidebar a.active {
  color: var(--text-light);
  background: var(--primary-glow);
  border-left-color: var(--primary);
  text-decoration: none;
}

.pe-sidebar-main {
  margin-left: 240px;
  padding: 32px 40px 60px;
  max-width: 1100px;
}

/* ───── Blocs de code (maj_it-pe) ───── */
.code-wrapper {
  position: relative;
  background: #282c34;
  border-radius: 8px;
  margin-bottom: 16px;
}

.code-wrapper pre {
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  padding: 16px 18px !important;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #ccc;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--tr);
  font-family: var(--font);
  z-index: 10;
}
.copy-btn:hover { background: rgba(255,255,255,.25); color: #fff; }
.copy-btn.copied { background: rgba(112,189,149,.35); color: var(--primary); border-color: var(--primary); }

/* ───── Sections documentées (maj_it-pe) ───── */
.doc-section {
  margin-bottom: 48px;
  scroll-margin-top: 80px;
}

.doc-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.doc-section h2 {
  font-size: 16px;
  font-weight: 700;
}

.doc-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.doc-steps {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.9;
}

.doc-steps .warn {
  display: inline-block;
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.3);
  color: var(--warning);
  border-radius: var(--radius);
  padding: 3px 10px;
  font-size: 12px;
}

.doc-tag {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(112,189,149,.3);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
}
.doc-tag.danger  { background: rgba(231,76,60,.1);  color: var(--danger);  border-color: rgba(231,76,60,.3); }
.doc-tag.warning { background: rgba(243,156,18,.1); color: var(--warning); border-color: rgba(243,156,18,.3); }

code:not(.hljs) {
  background: var(--primary-glow);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Consolas', monospace;
}

/* ───── Modal (PDF viewer) ───── */
.pe-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.pe-modal-overlay.active { opacity: 1; pointer-events: all; }

.pe-modal {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 90%;
  height: 90%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  transform: scale(.9);
  transition: transform .3s;
}
.pe-modal-overlay.active .pe-modal { transform: scale(1); }

.pe-modal .close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 28px;
  color: var(--text-dim);
  cursor: pointer;
  background: none;
  border: none;
  transition: color var(--tr);
  z-index: 10;
}
.pe-modal .close-btn:hover { color: var(--danger); }

.pe-modal iframe { flex: 1; width: 100%; border: none; border-radius: 0 0 10px 10px; }

/* ───── Encadré rouge (bordure alerte) ───── */
.red-bordered {
  border: 2px solid var(--danger);
  padding: 10px;
  border-radius: 10px;
  margin-top: 16px;
}

/* ───── Titres de page ───── */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 32px;
}

#date-du-jour { color: var(--warning); font-weight: bold; }

/* ───── Footer ───── */
.pe-footer {
  margin-top: auto;
  padding: 20px;
  text-align: center;
  font-size: 10px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* ───── Etoiles favoris ───── */
.fav-star { margin-left: auto; cursor: pointer; font-size: 14px; opacity: 0; transition: opacity .15s, transform .2s, color .15s; color: var(--text-dim); background: none; border: none; padding: 0 2px; flex-shrink: 0; line-height: 1; }
.draggable-line:hover .fav-star, .fav-star.active { opacity: 1; }
.fav-star.active { color: #ffd700; }
.fav-star:hover { transform: scale(1.3); color: #ffd700; }

/* ───── Section favoris ───── */
#favorites-section { background: var(--bg-sidebar); border: 2px solid #ffd700; border-radius: 10px; padding: 16px 18px; box-shadow: 0 0 24px rgba(255,215,0,.08); order: -1; transition: all var(--tr); }
#favorites-section .fav-header { font-size: 13px; font-weight: 700; color: #ffd700; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid rgba(255,215,0,.3); display: flex; align-items: center; gap: 8px; }
#favorites-section .fav-trash-all { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 14px; color: var(--danger, #e74c3c); opacity: .7; transition: opacity .15s, transform .15s; }
#favorites-section .fav-trash-all:hover { opacity: 1; transform: scale(1.15); }
#favorites-section .fav-item { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; }
#favorites-section .fav-item a { color: var(--primary); text-decoration: none; }
#favorites-section .fav-item a:hover { text-decoration: underline; }
#favorites-section .fav-item img { width: 16px; height: 16px; flex-shrink: 0; }
#favorites-section .fav-trash { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 12px; opacity: 0; color: var(--text-dim); transition: opacity .15s, color .15s; }
#favorites-section .fav-item:hover .fav-trash { opacity: 1; color: var(--danger, #e74c3c); }
#favorites-section .fav-origin { font-size: 10px; color: var(--text-dim); margin-left: 4px; white-space: nowrap; }

/* ───── Responsive ───── */
@media (max-width: 768px) {
  .pe-sidebar { display: none; }
  .pe-sidebar-main { margin-left: 0; padding: 20px; }
  .pe-two-cols { flex-direction: column; }
  .pe-col-right { position: static; min-width: 0; }
  .pe-header nav { display: none; }
}

@media (max-width: 600px) {
  .url-grid { grid-template-columns: 1fr; }
  .app-item { flex-direction: column; align-items: flex-start; }
}
