/* =========================================================
   Borelli Premium Glass Theme (Homepage v1.8.x)
   - cohérent + lisible + cartes premium
   - brandbar avec logo inline (agrandi)
   - loader conservé (no regression)
   ========================================================= */

:root{
  --borelli-accent: rgba(94,234,212,.85);

  --borelli-text: rgba(255,255,255,.92);
  --borelli-muted: rgba(255,255,255,.70);

  --borelli-glass: rgba(18,22,28,.62);
  --borelli-glass-2: rgba(12,14,18,.62);
  --borelli-hover: rgba(40,48,58,.66);

  --borelli-stroke: rgba(255,255,255,.10);
  --borelli-stroke-2: rgba(255,255,255,.16);

  --borelli-radius: 18px;
  --borelli-radius-sm: 14px;

  --borelli-shadow: 0 10px 26px rgba(0,0,0,.30);
  --borelli-shadow-2: 0 18px 44px rgba(0,0,0,.42);

  /* ✅ Taille du logo dans la brandbar (desktop) */
  --brand-h: 54px;
  --brand-w: 320px;
}

/* Force un fond cohérent (override possible du background inline Homepage) */
body{
  color: var(--borelli-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background-image:
    linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.55)),
    url("/icons/homepage-wallpaper.jpg") !important;
  background-size: cover !important;
  background-position: center center !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

/* Vignette douce sur les bords */
body::after{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 260px rgba(0,0,0,.55);
}

/* Légère couche pour homogénéiser le contenu par-dessus l’image */
#inner_wrapper{
  background: linear-gradient(180deg, rgba(0,0,0,.10), rgba(0,0,0,.32)) !important;
  backdrop-filter: blur(10px) brightness(.88) saturate(1.05) !important;
  -webkit-backdrop-filter: blur(10px) brightness(.88) saturate(1.05) !important;
}

/* =========================================================
   Brand bar
   ========================================================= */
#borelli-brandbar{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap: 14px;

  margin: 18px 20px 0;
  padding: 16px 18px;

  border-radius: var(--borelli-radius);
  background: linear-gradient(
    180deg,
    rgba(255,255,255,.06),
    rgba(255,255,255,.02)
  );
  border: 1px solid var(--borelli-stroke);
  box-shadow: var(--borelli-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  position: relative;
  overflow: hidden;
}

#borelli-brandbar::before{
  content:"";
  position:absolute;
  inset:-1px;
  pointer-events:none;
  border-radius: inherit;
  background:
    radial-gradient(680px 150px at 18% 0%, rgba(94,234,212,.18), transparent 55%),
    radial-gradient(560px 150px at 82% 0%, rgba(255,255,255,.10), transparent 55%);
  opacity:.9;
}

#borelli-brandbar .brand-left{
  display:flex;
  align-items:center;
  gap: 18px; /* ✅ un peu plus d’air entre logo & texte */
  min-width: 0;
  position: relative;
  z-index: 1;
}

/* Logo container */
#borelli-brandbar .brand-logo{
  width: var(--brand-w);
  height: var(--brand-h);
  display:flex;
  align-items:center;
  justify-content:flex-start;
  color: #fff;
  opacity: .98;
  filter: drop-shadow(0 12px 26px rgba(0,0,0,.50));
  flex: 0 0 auto;
}

#borelli-brandbar .brand-logo-slot{
  width: 100%;
  height: 100%;
}

/* SVG inline sizing */
#borelli-brandbar .brand-logo-slot svg{
  width: 100%;
  height: 100%;
  display:block;
}

/* On évite de rejouer l’anim du loader si le SVG porte des classes reveal */
#borelli-brandbar .brand-logo-slot .reveal-x,
#borelli-brandbar .brand-logo-slot .reveal-y,
#borelli-brandbar .brand-logo-slot .float{
  animation: none !important;
  transform: none !important;
}

#borelli-brandbar .brand-title{
  display:flex;
  flex-direction:column;
  line-height:1.10;
  min-width: 0;
}

#borelli-brandbar .brand-title .name{
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 26px; /* ✅ un peu plus grand pour matcher le logo */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#borelli-brandbar .brand-title .tagline{
  font-size: 14px;
  color: var(--borelli-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Si le logo échoue, on garde une bar jolie */
#borelli-brandbar.brand-logo-failed .brand-logo{
  width: auto;
  height: auto;
}
#borelli-brandbar.brand-logo-failed .brand-logo::before{
  content:"B";
  display:inline-grid;
  place-items:center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  margin-right: 6px;
  font-weight: 800;
}

/* Responsive brand bar */
@media (max-width: 640px){
  #borelli-brandbar{
    margin: 14px 12px 0;
    padding: 12px 12px;
  }

  /* ✅ Taille du logo dans la brandbar (mobile) */
  :root{ --brand-w: 240px; --brand-h: 40px; }

  #borelli-brandbar .brand-title .name{ font-size: 18px; }
  #borelli-brandbar .brand-title .tagline{ font-size: 12px; }
}

/* =========================================================
   Info widgets bar (resources + search)
   ========================================================= */
#information-widgets{
  border-bottom: 1px solid rgba(255,255,255,.18) !important;
  padding-bottom: 16px !important;
}

/* Petites “chips” glass pour chaque widget (y compris erreurs API) */
.information-widget-resource{
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: var(--borelli-radius-sm) !important;
  padding: 8px 10px !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Barres de progression plus clean */
.resource-usage{
  background: rgba(255,255,255,.14) !important;
}
.resource-usage > div{
  background: rgba(255,255,255,.55) !important;
}

/* Search input */
.information-widget-search input{
  border-radius: var(--borelli-radius-sm) !important;
  background: rgba(255,255,255,.10) !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  box-shadow: none !important;
}
.information-widget-search input:focus{
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(94,234,212,.18) !important;
}

/* =========================================================
   Services + Bookmarks cards (selectors réels)
   ========================================================= */
.service-card,
.bookmark a{
  background: var(--borelli-glass) !important;
  border: 1px solid var(--borelli-stroke) !important;
  border-radius: var(--borelli-radius) !important;
  box-shadow: var(--borelli-shadow) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}

.service-card:hover,
.bookmark a:hover{
  transform: translateY(-2px);
  background: var(--borelli-hover) !important;
  border-color: var(--borelli-stroke-2) !important;
  box-shadow: var(--borelli-shadow-2) !important;
}

/* Group headers */
.service-group-name,
.bookmark-group-name{
  font-weight: 800 !important;
  letter-spacing: .25px;
  opacity: .96;
}

/* Service icons: relief */
.service-icon img{
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.35));
}

/* Textes secondaires mieux lisibles */
.service-description,
.bookmark-description,
.text-theme-500,
.dark .text-theme-300,
.dark .text-theme-400{
  color: var(--borelli-muted) !important;
}

/* Bookmark left badge */
.bookmark-icon{
  background: rgba(255,255,255,.08) !important;
  border-right: 1px solid rgba(255,255,255,.10);
  border-top-left-radius: var(--borelli-radius) !important;
  border-bottom-left-radius: var(--borelli-radius) !important;
}

/* Docker status badge */
.docker-status{
  border-radius: 10px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
}

/* Focus clavier clean */
:focus-visible{
  outline: 2px solid rgba(94,234,212,.35);
  outline-offset: 2px;
  border-radius: 12px;
}

/* Footer icons un poil plus discrets */
#footer svg{
  opacity: .85;
  transition: opacity .2s ease, transform .2s ease;
}
#footer svg:hover{
  opacity: 1;
  transform: translateY(-1px);
}

/* =========================================================
   Loader overlay (conservé)
   ========================================================= */
:root{
  --borelli-loader-bg:#000;
  --borelli-loader-fg:#fff;
  --borelli-loader-max-w:520px;
}

body.is-loading { overflow: hidden; }

#app-loader{
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  background: var(--borelli-loader-bg);
  color: var(--borelli-loader-fg);
}

#app-loader .loader__inner{
  display: grid;
  place-items: center;
  gap: 18px;
}

#app-loader .logo{
  width: min(86vw, var(--borelli-loader-max-w));
  height: auto;
  display: block;
}

/* Reveal (fiabilisé pour SVG masks) */
#app-loader .reveal-x,
#app-loader .reveal-y{
  transform-box: view-box;
  will-change: transform;
}

#app-loader .reveal-x{ transform: scaleX(0); transform-origin: 0% 50%; }
#app-loader .reveal-y{ transform: scaleY(0); transform-origin: 50% 100%; }

#app-loader .reveal-x{ animation: revealX .9s ease forwards; }
#app-loader .reveal-y{ animation: revealY .95s ease forwards; }

#app-loader .d1{animation-delay:.14s}
#app-loader .d2{animation-delay:.32s}
#app-loader .d3{animation-delay:.56s}
#app-loader .d4{animation-delay:.82s}
#app-loader .d5{animation-delay:.98s}

@keyframes revealX{ to{ transform: scaleX(1) } }
@keyframes revealY{ to{ transform: scaleY(1) } }

#app-loader .float{
  transform-origin: center;
  animation: float 1.6s ease-in-out infinite;
  animation-delay: 1.2s;
}
@keyframes float{
  0%,100%{ transform: translateY(0) }
  50%{ transform: translateY(-3px) }
}

#app-loader .dots{
  display: inline-flex;
  gap: 8px;
  height: 14px;
  align-items: center;
  justify-content: center;
}
#app-loader .dots span{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--borelli-loader-fg);
  opacity: .25;
  animation: dot .9s ease-in-out infinite;
}
#app-loader .dots span:nth-child(2){ animation-delay: .15s }
#app-loader .dots span:nth-child(3){ animation-delay: .3s }

@keyframes dot{
  0%,100%{ transform: translateY(0); opacity: .25 }
  50%{ transform: translateY(-3px); opacity: .9 }
}

@media (prefers-reduced-motion: reduce){
  #app-loader .reveal-x,
  #app-loader .reveal-y,
  #app-loader .float,
  #app-loader .dots span{ animation: none !important; }
  #app-loader .reveal-x{ transform: none !important; }
  #app-loader .reveal-y{ transform: none !important; }
}

/* Anti-flash (avant custom.js) : NOIR immédiat */
body:not(.borelli-loader-mounted)::before{
  content:"";
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 999998;
}

/* Retire le cache dès que le loader est monté */
body.borelli-loader-mounted::before{
  content: none;
}

/* Fallback: si rendu SVG cassé dans le loader */
#app-loader.force-static .reveal-x,
#app-loader.force-static .reveal-y{
  animation: none !important;
  transform: none !important;
}

/* Quand la page est prête, on force la fin de tous overlays */
body.page-ready::before { content: none !important; }
body.page-ready #app-loader { display: none !important; }

/* =========================================
   Fix icons "noir sur noir" (OpenWebUI + Picoshare)
   ========================================= */
.service[data-name="Intelligence Artificielle (AI)"] .service-icon img,
.service[data-name="Picoshare"] .service-icon img{
  filter: invert(1) brightness(1.35) contrast(1.05) !important;
  opacity: .98;
}

/* Fallback si jamais data-name change : cible par URL */
.service-icon img[src*="openwebui.com/logo.png"],
.service-icon img[src*="picoshare"],
.service-icon img[src*="share.borellimmo.com"]{
  filter: invert(1) brightness(1.35) contrast(1.05) !important;
  opacity: .98;
}
