/* ===========================================================================
   ARMELEC — Feuille de style globale
   =========================================================================== */

:root {
  --bg:           #f4f3ef;
  --bg-card:     #ffffff;
  --text:        #1a1a1a;
  --text-muted:  #6b6b6b;
  --border:      #e0ddd5;
  --accent:      #313294;
  --accent-dark: #262470;
  --success:     #2e7d3a;
  --warning:     #d97706;
  --error:       #c8402a;
  --radius:      6px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.04);
  --shadow:      0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* === HEADER ============================================================== */

.armelec-header {
  background: var(--bg-card);
  color: var(--text);
  border-bottom: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }

.main-nav {
  display: flex;
  gap: 24px;
  flex: 1;
}
.main-nav a {
  color: #475467;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.main-nav a:hover {
  color: var(--accent);
  text-decoration: none;
  border-bottom-color: var(--accent);
}
.main-nav a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.main-nav .nav-admin {
  color: var(--text);
}

/* ── Groupe déroulant dans la nav (ex. « Carnet » → Clients / Utilisateurs) ── */
.nav-group {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-group-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text);
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: all 0.15s;
}
.nav-group-btn:hover { text-decoration: none; }
.nav-group-btn .caret { font-size: 10px; opacity: 0.7; }
.nav-group:hover .nav-group-btn,
.nav-group:focus-within .nav-group-btn,
.nav-group-btn.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.nav-group-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 0;
  display: none;
  z-index: 200;
}
.nav-group:hover .nav-group-menu,
.nav-group:focus-within .nav-group-menu {
  display: block;
}
.nav-group-menu a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  font-weight: 500;
  border: none;
}
.nav-group-menu a:hover {
  background: var(--bg);
  color: var(--accent);
  text-decoration: none;
}

/* ── Bascule de vue admin : menu Armelec ⇄ menu Client (test) ── */
.menu-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--accent);
  background: rgba(49, 50, 148, 0.06);
  white-space: nowrap;
}
.menu-view-toggle:hover {
  background: rgba(49, 50, 148, 0.12);
  text-decoration: none;
}
.menu-view-toggle.is-client {
  color: var(--warning);
  border-color: #f0d8a8;
  background: #fdf6e9;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.lang-switch {
  display: flex;
  gap: 4px;
  font-size: 12px;
}
.lang-switch a {
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 3px;
  font-weight: 500;
}
.lang-switch a.is-active {
  color: var(--accent);
  background: rgba(49,50,148,0.08);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.user-name {
  color: var(--text);
  font-weight: 600;
}
.user-link {
  color: var(--text-muted);
}
.user-link:hover { color: var(--accent); text-decoration: none; }
.user-logout { color: var(--text-muted); }
.user-logout:hover { color: var(--error); }

/* === MAIN ================================================================ */

.armelec-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
  min-height: calc(100vh - 180px);
}

/* === FOOTER ============================================================== */

.armelec-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-links a { color: var(--text-muted); }
.footer-links .sep { margin: 0 6px; opacity: 0.5; }

/* === CARTES & CONTENEURS ================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

/* === FORMULAIRES ======================================================== */

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text);
}
.field .req {
  color: var(--accent);
  font-weight: 700;
}

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49,50,148,0.12);
}

/* === BOUTONS ============================================================ */

.btn {
  display: inline-block;
  padding: 10px 22px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--text-muted);
  background: #fafaf8;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* === ALERTES ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid;
}
.alert-error {
  background: #fdf0ed;
  border-color: #f4cabf;
  color: #8a2b1c;
}
.alert-success {
  background: #e8f4ea;
  border-color: #b8d9be;
  color: #1f5128;
}
.alert-info {
  background: #eef3fa;
  border-color: #c5d5ec;
  color: #1d3a6b;
}
.alert-warning {
  background: #fef6e7;
  border-color: #f5d9a0;
  color: #7a4a0a;
}

/* === PAGE LOGIN ========================================================= */

body.page-auth {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.page-auth .armelec-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px 0;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 24px 0;
}
.auth-actions {
  margin-top: 22px;
}
.auth-extra {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
}

/* === DASHBOARD (cartes) ================================================= */

.dashboard-welcome {
  margin-bottom: 24px;
}
.dashboard-welcome h1 {
  font-size: 26px;
  margin: 0 0 4px 0;
  font-weight: 700;
}
.dashboard-welcome p {
  margin: 0;
  color: var(--text-muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.15s;
  display: block;
  color: var(--text);
}
.dashboard-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.dashboard-card h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: var(--accent);
}
.dashboard-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* === PAGE MON COMPTE ==================================================== */

.account-page {
  max-width: 720px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 26px;
  margin: 0 0 4px 0;
  font-weight: 700;
}

.account-section {
  margin-bottom: 20px;
}
.account-section-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.account-section-head .card-title {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.account-form .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 540px) {
  .account-form .grid-2 { grid-template-columns: 1fr; }
}

.form-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.account-meta .meta-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.meta-row:last-child { border-bottom: none; }
.meta-label {
  font-size: 13px;
  color: var(--text-muted);
}
.meta-value {
  font-size: 13px;
  font-weight: 500;
}
.meta-value code {
  font-family: 'DM Mono', monospace;
  background: #f4f3ef;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
}

/* === UTILITAIRES ======================================================== */

.text-muted { color: var(--text-muted); }
.text-small { font-size: 12px; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* === RESPONSIVE ========================================================= */

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
  }
  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  /* Le menu déroulant serait coupé par le scroll horizontal : on éclate le
     groupe « Carnet » et on affiche ses liens en ligne sur mobile. */
  .nav-group { display: contents; }
  .nav-group-btn { display: none; }
  .nav-group-menu {
    position: static;
    display: flex;
    gap: 24px;
    border: none;
    box-shadow: none;
    padding: 0;
    background: none;
  }
  .nav-group-menu a { padding: 6px 0; }
  .user-menu { font-size: 12px; }
  .armelec-main { padding: 20px 16px; }
  .footer-inner { flex-direction: column; gap: 6px; text-align: center; }
}
