/*
Theme Name: Village Breizhix Hub
Theme URI: https://village.breizhix.fr
Author: Breizhix
Author URI: https://breizhix.fr
Description: Hub central Village Breizhix — plateforme membre avec Copilotix, formations et features extensibles.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: breizhix-village
*/

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --color-bg:        #F5F0E8;
  --color-sidebar:   #3D2B1F;
  --color-accent:    #C8622A;
  --color-accent-hover: #A84F20;
  --color-text:      #2C1F14;
  --color-card:      #FDFAF5;
  --color-border:    #E8E0D0;
  --color-muted:     #8C7B6E;
  --color-sidebar-text: #E8DDD4;
  --color-sidebar-active: rgba(200,98,42,0.18);
  --color-sidebar-hover:  rgba(255,255,255,0.07);

  --sidebar-width:   240px;
  --topbar-height:   56px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card: 0 1px 4px rgba(44,31,20,0.07), 0 4px 16px rgba(44,31,20,0.05);
  --shadow-card-hover: 0 4px 16px rgba(44,31,20,0.12), 0 8px 32px rgba(44,31,20,0.08);

  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  --transition: 180ms ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

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

img { max-width: 100%; height: auto; display: block; }

/* ============================================================
   LAYOUT HUB : sidebar + main
   ============================================================ */
.hub-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.hub-sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
}

.hub-sidebar__logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.hub-sidebar__logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-card);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hub-sidebar__logo img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.hub-sidebar__logo-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--color-accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
}

/* Nav groups */
.hub-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.hub-nav__group {
  margin-bottom: 4px;
}

.hub-nav__group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232,221,212,0.4);
  padding: 10px 20px 4px;
}

.hub-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--color-sidebar-text);
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
  position: relative;
}

.hub-nav__item:hover {
  background: var(--color-sidebar-hover);
  color: white;
}

.hub-nav__item.active {
  background: var(--color-sidebar-active);
  color: white;
  font-weight: 600;
}

.hub-nav__item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-accent);
  border-radius: 0 2px 2px 0;
}

.hub-nav__item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.hub-nav__item.locked:hover {
  background: transparent;
  color: var(--color-sidebar-text);
}

.hub-nav__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.hub-nav__lock {
  margin-left: auto;
  width: 12px;
  height: 12px;
  opacity: 0.5;
}

/* Sidebar footer : profil */
.hub-sidebar__footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.hub-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.hub-sidebar__user:hover { background: var(--color-sidebar-hover); }

.hub-sidebar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.hub-sidebar__user-info { flex: 1; min-width: 0; }

.hub-sidebar__user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-card);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-sidebar__user-role {
  font-size: 11px;
  color: rgba(232,221,212,0.5);
  margin-top: 1px;
}

/* ---- MAIN AREA ---- */
.hub-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.hub-topbar {
  height: var(--topbar-height);
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.hub-topbar__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
}

.hub-topbar__breadcrumb {
  font-size: 12px;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hub-topbar__breadcrumb span { opacity: 0.5; }

.hub-topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hub-topbar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.hub-topbar__btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-text);
}

/* Menu toggle mobile */
.hub-topbar__menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  padding: 4px;
}

/* Content area */
.hub-content {
  flex: 1;
  padding: 28px;
  max-width: 1200px;
  width: 100%;
}

/* ============================================================
   COMPOSANTS CARTES
   ============================================================ */
.bv-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 24px;
  transition: box-shadow var(--transition);
}

.bv-card:hover { box-shadow: var(--shadow-card-hover); }

.bv-card--flat { box-shadow: none; }

.bv-card--accent {
  border-left: 3px solid var(--color-accent);
}

/* Feature cards (hub dashboard) */
.bv-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.bv-feature-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.bv-feature-card:hover:not(.bv-feature-card--locked) {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-color: rgba(200,98,42,0.25);
}

.bv-feature-card--locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.bv-feature-card__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(200,98,42,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}

.bv-feature-card__icon svg { width: 22px; height: 22px; }

.bv-feature-card__title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--color-text);
}

.bv-feature-card__desc {
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.5;
  flex: 1;
}

.bv-feature-card__badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  width: fit-content;
}

.bv-feature-card__badge--available {
  background: rgba(200,98,42,0.12);
  color: var(--color-accent);
}

.bv-feature-card__badge--locked {
  background: rgba(44,31,20,0.07);
  color: var(--color-muted);
}

.bv-feature-card__badge--soon {
  background: rgba(44,31,20,0.05);
  color: var(--color-muted);
}

.bv-feature-card__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}

.bv-feature-card__link:hover { color: var(--color-accent-hover); }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.bv-section-header {
  margin-bottom: 20px;
}

.bv-section-header__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 4px;
}

.bv-section-header__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.bv-section-header__sub {
  font-size: 14px;
  color: var(--color-muted);
  margin-top: 6px;
}

/* ============================================================
   STATS STRIP (dashboard)
   ============================================================ */
.bv-stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.bv-stat {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.bv-stat__value {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.03em;
  line-height: 1;
}

.bv-stat__label {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 5px;
}

.bv-stat__accent { color: var(--color-accent); }

/* ============================================================
   ACCÈS RESTREINT — UPGRADE BLOCK
   ============================================================ */
.bv-upgrade-block {
  text-align: center;
  padding: 52px 28px;
  max-width: 480px;
  margin: 0 auto;
}

.bv-upgrade-block__icon {
  width: 56px;
  height: 56px;
  background: rgba(200,98,42,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--color-accent);
}

.bv-upgrade-block__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 10px;
}

.bv-upgrade-block__text {
  font-size: 14px;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.bv-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
}

.bv-btn--primary {
  background: var(--color-accent);
  color: white;
}
.bv-btn--primary:hover {
  background: var(--color-accent-hover);
  color: white;
  transform: translateY(-1px);
}

.bv-btn--outline {
  background: transparent;
  border: 1.5px solid var(--color-accent);
  color: var(--color-accent);
}
.bv-btn--outline:hover {
  background: rgba(200,98,42,0.07);
  color: var(--color-accent);
}

.bv-btn--ghost {
  background: transparent;
  color: var(--color-muted);
}
.bv-btn--ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

/* ============================================================
   FORMATIONS — LIST
   ============================================================ */
.bv-formations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.bv-formation-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}

.bv-formation-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.bv-formation-card__thumb {
  height: 140px;
  background: linear-gradient(135deg, #3D2B1F 0%, #5A3D2B 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.bv-formation-card__thumb-icon {
  width: 48px;
  height: 48px;
  color: rgba(200,98,42,0.7);
}

.bv-formation-card__body { padding: 18px; }

.bv-formation-card__category {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 6px;
}

.bv-formation-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: 8px;
}

.bv-formation-card__meta {
  font-size: 12px;
  color: var(--color-muted);
  display: flex;
  gap: 12px;
}

/* Progress bar */
.bv-progress {
  margin-top: 14px;
}

.bv-progress__bar-bg {
  height: 4px;
  background: var(--color-bg);
  border-radius: 2px;
  overflow: hidden;
}

.bv-progress__bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.bv-progress__label {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
}

/* ============================================================
   COPILOTIX WRAPPER (pleine largeur)
   ============================================================ */
.bv-copilotix-wrap {
  width: 100%;
  min-height: calc(100vh - var(--topbar-height) - 56px);
}

/* ============================================================
   NOTICES & ALERTS
   ============================================================ */
.bv-notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.bv-notice--info {
  background: rgba(200,98,42,0.07);
  border: 1px solid rgba(200,98,42,0.2);
  color: var(--color-text);
}

.bv-notice--success {
  background: rgba(34,139,34,0.07);
  border: 1px solid rgba(34,139,34,0.2);
  color: #1A5C1A;
}

.bv-notice--warn {
  background: rgba(200,98,42,0.1);
  border: 1px solid rgba(200,98,42,0.3);
  color: #7A3C10;
}

/* ============================================================
   FOOTER
   ============================================================ */
.hub-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hub-sidebar {
    transform: translateX(-100%);
  }

  .hub-sidebar.is-open {
    transform: translateX(0);
  }

  .hub-main {
    margin-left: 0;
  }

  .hub-topbar__menu-toggle {
    display: flex;
  }

  .hub-content {
    padding: 20px 16px;
  }

  .bv-feature-grid {
    grid-template-columns: 1fr 1fr;
  }

  .bv-stats-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .bv-feature-grid,
  .bv-formations-grid {
    grid-template-columns: 1fr;
  }

  .bv-stats-strip {
    grid-template-columns: 1fr 1fr;
  }
}

/* Overlay mobile sidebar */
.hub-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,31,20,0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

.hub-overlay.is-open {
  display: block;
}

/* ============================================================
   ADMIN BAR COMPENSATION
   ============================================================ */
.admin-bar .hub-sidebar { top: 32px; }
.admin-bar .hub-topbar  { top: 32px; }

@media (max-width: 782px) {
  .admin-bar .hub-sidebar { top: 46px; }
  .admin-bar .hub-topbar  { top: 46px; }
}

/* ============================================================
   WP NATIVE OVERRIDES (éviter que WP casse le layout)
   ============================================================ */
.hub-content .wp-block-group { margin: 0; }
.hub-content img              { border-radius: var(--radius-sm); }
