/* ==========================================================================
   Portail Outils — Cellule CAO
   Design épuré, sobre et technique (inspiration Clean-Dense / juplab.app)
   Mise en page deux colonnes + filigrane SOPREMA
   ========================================================================== */

:root {
  /* Surfaces & Neutres */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f8fafc;

  /* Bordures */
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Textes */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Accents (sobre + bleu SOPREMA) */
  --accent: #0f172a;
  --accent-hover: #1e293b;
  --brand-blue: #0072ce;
  --brand-blue-soft: #eff6ff;
  --brand-blue-border: #bfdbfe;

  /* Filigrane arrière-plan */
  --watermark-opacity: 0.25;

  /* Statuts */
  --online-bg: #ecfdf5;
  --online-text: #047857;
  --online-border: #a7f3d0;
  --online-dot: #10b981;

  --upcoming-bg: #f1f5f9;
  --upcoming-text: #475569;
  --upcoming-border: #e2e8f0;
  --upcoming-dot: #94a3b8;

  /* Ombres */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  --shadow-card-hover: 0 4px 12px rgba(15, 23, 42, 0.06), 0 12px 24px rgba(15, 23, 42, 0.05);

  /* Rayons & Espacements */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Typographie */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Transitions */
  --transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Reset minimal & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  background-color: var(--bg-page);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

/* ==========================================================================
   Filigrane SOPREMA en arrière-plan
   ========================================================================== */
.bg-watermark {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  opacity: var(--watermark-opacity);
  mix-blend-mode: multiply;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}

.bg-watermark__img {
  width: min(68vw, 740px);
  max-height: 76vh;
  object-fit: contain;
  filter: url(#watermark-enhance);
  pointer-events: none;
  user-select: none;
}

/* Conteneur principal */
.container {
  width: 100%;
  max-width: 1220px;
  margin-inline: auto;
  padding-inline: 24px;
}

/* ==========================================================================
   En-tête (Topbar)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar__inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand__logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background-color: var(--accent);
  color: #38bdf8;
  box-shadow: var(--shadow-xs);
}

.brand__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Zone principale & Disposition deux colonnes (35 % / 65 %)
   ========================================================================== */
.main {
  position: relative;
  z-index: 1;
  flex: 1;
  padding-top: 32px;
  padding-bottom: 64px;
}

/* Grille principale 35 % / 65 % */
.portal-layout {
  display: grid;
  grid-template-columns: minmax(290px, 35%) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* ==========================================================================
   Colonne de gauche : Carte de présentation personnelle
   ========================================================================== */
.profile-column {
  position: sticky;
  top: 88px;
}

.profile-card {
  padding: 26px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-card__media {
  width: 100%;
  max-width: 196px;
}

.profile-card__photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 20%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  background-color: var(--bg-subtle);
}

.profile-card__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-card__title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-card__title::after {
  content: '';
  display: block;
  width: 32px;
  height: 3px;
  border-radius: var(--radius-full);
  background-color: var(--brand-blue);
}

.profile-card__lead {
  margin: 2px 0 0;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text-primary);
}

.profile-card__text {
  margin: 0;
  font-size: 0.8875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.profile-card__contact {
  margin: 4px 0 0;
  padding: 12px 14px;
  font-size: 0.8375rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

/* ==========================================================================
   Colonne de droite : Applications métiers
   ========================================================================== */
.apps-column {
  min-width: 0;
}

/* Intro de section */
.portal-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--brand-blue);
}

.portal-intro__heading {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text-primary);
}

.portal-intro__description {
  margin: 8px 0 0;
  max-width: 540px;
  font-size: 0.925rem;
  color: var(--text-secondary);
}

.portal-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
}

.stat-chip strong {
  color: var(--text-primary);
  font-weight: 600;
}

.stat-chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.stat-chip__dot--online {
  background-color: var(--online-dot);
}

.stat-chip__dot--upcoming {
  background-color: var(--upcoming-dot);
}

/* ==========================================================================
   Grille et Cartes d'applications
   ========================================================================== */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.app-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.app-card--active:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card-hover);
}

.app-card--upcoming {
  background-color: var(--bg-surface);
  border-style: dashed;
  border-color: var(--border-strong);
  box-shadow: none;
}

.app-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.app-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.app-icon--active {
  background-color: var(--brand-blue-soft);
  border-color: var(--brand-blue-border);
  color: var(--brand-blue);
}

.app-icon--muted {
  background-color: var(--bg-subtle);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.app-card__body {
  flex: 1;
  margin-bottom: 22px;
}

.app-card__title {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.app-card--upcoming .app-card__title {
  color: var(--text-secondary);
}

.app-card__description {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.app-card--upcoming .app-card__description {
  color: var(--text-muted);
}

.app-card__footer {
  padding-top: 16px;
  border-top: 1px solid var(--bg-subtle);
}

/* Badges de statut */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge--online {
  background-color: var(--online-bg);
  color: var(--online-text);
  border-color: var(--online-border);
}

.badge--online .badge__dot {
  background-color: var(--online-dot);
}

.badge--upcoming {
  background-color: var(--upcoming-bg);
  color: var(--upcoming-text);
  border-color: var(--upcoming-border);
}

.badge--upcoming .badge__dot {
  background-color: var(--upcoming-dot);
}

/* ==========================================================================
   Boutons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn--full {
  width: 100%;
}

.btn--primary {
  background-color: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-xs);
}

.btn--primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
}

.btn--disabled,
.btn:disabled {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  border-color: var(--border-subtle);
  cursor: not-allowed;
  opacity: 0.75;
}

/* ==========================================================================
   Pied de page
   ========================================================================== */
.footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.footer__inner {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer__copy,
.footer__meta {
  margin: 0;
}

.footer__meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablettes & petits écrans : empilement propre des deux colonnes */
@media (max-width: 960px) {
  .portal-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .profile-column {
    position: static;
  }

  .profile-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
  }

  .profile-card__media {
    flex-shrink: 0;
    width: 156px;
    max-width: 156px;
  }
}

@media (max-width: 720px) {
  .container {
    padding-inline: 16px;
  }

  .profile-card {
    flex-direction: column;
    padding: 22px;
    gap: 18px;
  }

  .profile-card__media {
    width: 136px;
    max-width: 136px;
  }

  .portal-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  .apps-grid {
    grid-template-columns: 1fr;
  }

  .bg-watermark__img {
    width: 88vw;
  }

  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
