/* ===========================================================================
   CautMateriale — sistemul vizual comun (tokens + componente)
   ---------------------------------------------------------------------------
   Un singur fisier pentru toate paginile, ca sa nu duplicam stilul in fiecare
   sablon. Se include prin partialul web/templates/_ui_head.html, care aduce si
   filtrul SVG (sticla sablata) + JS-ul de efecte.

   Efectele (picaturi pe foldere, fum sub butoane, sclipire la apasare) asculta
   de ACELASI intrerupator ca apa+fumul din pagina principala: cheia
   localStorage 'cm_fx_off'. Oprit acolo = oprit peste tot (body.cm-fx-off).
   =========================================================================== */

:root {
  --cm-page: #FFFFFF;
  --cm-bg: #F4F6F7;
  --cm-surface: #F6F9FA;
  --cm-surface-2: #EDF3F5;
  --cm-ink: #0B0F14;
  --cm-muted: #63707A;
  --cm-line: #E4EAED;
  --cm-line-soft: #EDF1F3;
  --cm-acc: #04695A;
  --cm-pos: #047857;
  --cm-nav: #0B0F14;
  --cm-nav-ink: #FFFFFF;
  --cm-nav-mute: #C3CDD3;
  --cm-danger: #A93226;
  --cm-shadow: 0 1px 2px rgba(11,15,20,.05), 0 10px 30px -16px rgba(11,15,20,.18);
  /* culorile fumului de pe pagina principala, in varianta stearsa */
  --cm-smoke-1: rgba(224, 72, 158, .34);
  --cm-smoke-2: rgba(53, 198, 232, .34);
  --cm-smoke-3: rgba(242, 167, 59, .30);
  --cm-smoke-4: rgba(138, 92, 246, .30);
}

/* ---------------------------------------------------------------------------
   FILTRUL DE STICLA (definit in _ui_head.html ca <svg><filter id="cm-frost">)
   --------------------------------------------------------------------------- */

/* ===========================================================================
   BARA DE SUS
   =========================================================================== */
.cm-topbar {
  background: var(--cm-nav); color: var(--cm-nav-ink);
  border-radius: 15px; padding: 12px 15px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.cm-brand {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-weight: 800;
  font-size: 17px; letter-spacing: -.025em; color: var(--cm-nav-ink);
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
/* logo-ul din bara de sus -- flex-shrink:0 ca sa nu se turteasca pe ecran mic */
.cm-logo { flex-shrink: 0; display: block; }
.cm-navlinks { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.cm-navlinks a, .cm-navlinks button {
  color: var(--cm-nav-mute); text-decoration: none; font-size: 13.5px; font-weight: 600;
  font-family: inherit; background: none; border: none; cursor: pointer;
  padding: 7px 14px; border-radius: 999px;
  transition: background .16s ease, color .16s ease;
}
.cm-navlinks a:hover, .cm-navlinks a:focus-visible,
.cm-navlinks button:hover, .cm-navlinks button:focus-visible {
  background: rgba(255,255,255,.13); color: var(--cm-nav-ink);
}
.cm-navlinks a.on { background: rgba(255,255,255,.17); color: var(--cm-nav-ink); }

/* ===========================================================================
   BUTOANE DE STICLA
   =========================================================================== */
.gb {
  position: relative; isolation: isolate; overflow: hidden;
  font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1.2;
  color: var(--cm-ink); cursor: pointer; text-decoration: none;
  padding: 10px 20px; border-radius: 999px;
  border: 1px solid rgba(120,140,150,.30);
  background: rgba(255,255,255,.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 1px 2px rgba(11,15,20,.06);
  /* sablat: intai varianta simpla (orice browser), apoi cea cu turbulenta */
  backdrop-filter: blur(9px) saturate(1.35);
  -webkit-backdrop-filter: blur(9px) saturate(1.35);
  backdrop-filter: blur(5px) saturate(1.35) url(#cm-frost);
  -webkit-backdrop-filter: blur(5px) saturate(1.35) url(#cm-frost);
  transition: border-color .18s ease, box-shadow .18s ease, color .18s ease;
  display: inline-flex; align-items: center; gap: 7px;
  --flash: var(--cm-acc);
  --flash-glow: rgba(4,105,90,.5);
}

/* fumul colorat, sters, sub sticla la hover */
.gb::before {
  content: ''; position: absolute; inset: -30%; z-index: -1; pointer-events: none;
  opacity: 0; transition: opacity .26s ease, transform .5s ease;
  transform: scale(.85) rotate(0deg);
  background:
    radial-gradient(60% 80% at 22% 30%, var(--cm-smoke-1), transparent 62%),
    radial-gradient(55% 75% at 78% 26%, var(--cm-smoke-2), transparent 60%),
    radial-gradient(65% 70% at 62% 82%, var(--cm-smoke-3), transparent 62%),
    radial-gradient(50% 70% at 18% 80%, var(--cm-smoke-4), transparent 60%);
  filter: blur(10px);
}
.gb:hover::before, .gb:focus-visible::before { opacity: 1; transform: scale(1.06) rotate(7deg); }
.gb:hover {
  border-color: rgba(120,140,150,.46);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 6px 18px -8px rgba(11,15,20,.28);
}

/* apasat: culoare intensa -- feedback imediat, ramane si cu efectele oprite */
.gb:active {
  background: var(--flash); color: #fff; border-color: var(--flash);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.22);
}
.gb:active::before { opacity: .25; }

/* sclipirea la click -- strat propriu, ca sa arate identic pe orice varianta */
.gb::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-radius: inherit; background: var(--flash); opacity: 0;
}
.gb.cm-flash::after { animation: cmFlashFill 460ms cubic-bezier(.2,.72,.3,1); }
.gb.cm-flash { animation: cmFlashInk 460ms cubic-bezier(.2,.72,.3,1); }
@keyframes cmFlashFill {
  0%   { opacity: 1; }
  32%  { opacity: .9; }
  100% { opacity: 0; }
}
/* fara cadru la 100% -> revine singur la stilul de baza al fiecarei variante */
@keyframes cmFlashInk {
  0%  { color: #fff; box-shadow: 0 0 0 0 var(--flash-glow), inset 0 0 14px rgba(255,255,255,.5); }
  32% { color: #fff; box-shadow: 0 0 0 9px rgba(0,0,0,0), inset 0 0 4px rgba(255,255,255,.15); }
}

/* variante */
.gb.primary {
  background: rgba(4,105,90,.16); border-color: rgba(4,105,90,.38);
  color: var(--cm-acc); font-weight: 700;
}
.gb.primary:hover { border-color: rgba(4,105,90,.6); }
.gb.danger {
  color: var(--cm-danger); border-color: rgba(169,50,38,.28);
  --flash: var(--cm-danger); --flash-glow: rgba(169,50,38,.5);
}
.gb.sm { padding: 7px 14px; font-size: 12.5px; }
.gb.xs { padding: 5px 11px; font-size: 11.5px; }
/* pe fundal inchis (bara de sus, header colorat) */
.gb.on-dark {
  color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.gb.on-dark:hover { background: rgba(255,255,255,.26); border-color: rgba(255,255,255,.45); }

/* ===========================================================================
   FOLDERE (cu picaturi la hover)
   =========================================================================== */
.cm-folders {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 12px;
}
.cm-folder {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--cm-surface); border-radius: 16px; padding: 17px 18px;
  display: flex; flex-direction: column; gap: 3px;
  cursor: pointer; border: 1px solid transparent; text-align: left;
  font-family: inherit; color: var(--cm-ink);
  transition: border-color .18s ease, transform .18s ease;
}
.cm-folder:hover, .cm-folder:focus-visible { border-color: var(--cm-line); transform: translateY(-2px); }
/* lumina care urmareste cursorul -- suprafata de apa */
.cm-folder::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0; transition: opacity .22s ease;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
              rgba(79,194,172,.30), rgba(53,198,232,.14) 42%, transparent 68%);
}
.cm-folder:hover::before { opacity: 1; }
.cm-ripple {
  position: absolute; z-index: -1; pointer-events: none; border-radius: 50%;
  border: 1.5px solid rgba(53,198,232,.55);
  transform: translate(-50%, -50%);
  animation: cmDropRing 900ms cubic-bezier(.22,.61,.36,1) forwards;
}
@keyframes cmDropRing {
  0%   { width: 8px;   height: 8px;   opacity: .85; }
  100% { width: 190px; height: 190px; opacity: 0; }
}
.cm-folder .f-icon { font-size: 21px; line-height: 1; margin-bottom: 5px; }
.cm-folder .f-name {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-weight: 700; font-size: 16px; letter-spacing: -.018em;
}
.cm-folder .f-meta { color: var(--cm-muted); font-size: 12.5px; font-weight: 600; }

/* ===========================================================================
   LISTA CARE SE PLIAZA (stil „fisa”)
   =========================================================================== */
.cm-fold { margin-top: 6px; }
.cm-fold > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  font-family: 'Fraunces', Georgia, serif; font-style: italic;
  font-size: 15.5px; font-weight: 500; color: var(--cm-ink);
  padding: 11px 0; border-bottom: 1px solid var(--cm-line);
}
.cm-fold > summary::-webkit-details-marker { display: none; }
.cm-fold .chev {
  color: var(--cm-acc); font-size: 11px; font-style: normal;
  transition: transform .2s ease; display: inline-block;
}
.cm-fold[open] > summary .chev { transform: rotate(90deg); }
.cm-fold .count {
  margin-left: auto; font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px; font-style: normal; color: var(--cm-muted);
}

.cm-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding-bottom: 9px;
  border-bottom: 2px solid var(--cm-ink);
}
.cm-sheet-title {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600;
  font-size: 18px; letter-spacing: -.012em;
}
.cm-sheet-when { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--cm-muted); }

.cm-mat {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; padding: 13px 2px;
  border-bottom: 1px solid var(--cm-line-soft);
}
.cm-mat-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.cm-mat-name { font-family: 'Fraunces', Georgia, serif; font-size: 15.5px; font-weight: 500; }
.cm-mat-paid { color: var(--cm-muted); font-size: 12.5px; }
.cm-mat-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cm-kind {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--cm-acc); border-bottom: 1.5px solid var(--cm-acc); padding-bottom: 1px;
}
.cm-kind.eq { color: #8A5A1A; border-bottom-color: #8A5A1A; }
.cm-kind.manual { color: #1B4965; border-bottom-color: #1B4965; }
.cm-price {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-weight: 800;
  font-size: 18px; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.cm-save {
  background: var(--cm-pos); color: #fff; font-weight: 700; font-size: 11.5px;
  padding: 3px 10px; border-radius: 999px; font-variant-numeric: tabular-nums;
}
.cm-unmatched-head {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--cm-muted);
  margin: 22px 0 2px; padding-top: 14px; border-top: 1px dashed var(--cm-line);
}

/* ===========================================================================
   TITLURI DE SECTIUNE
   =========================================================================== */
.cm-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 26px 0 13px;
}
.cm-section-head h2, .cm-section-head h3 {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-weight: 700;
  font-size: 20px; letter-spacing: -.022em; margin: 0;
}

/* ===========================================================================
   EFECTE OPRITE (intrerupatorul din pagina principala)
   =========================================================================== */
body.cm-fx-off .cm-folder::before { opacity: 0 !important; }
body.cm-fx-off .gb::before { opacity: 0 !important; }
body.cm-fx-off .gb.cm-flash,
body.cm-fx-off .gb.cm-flash::after { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  .gb, .gb::before, .gb::after,
  .cm-folder, .cm-folder::before, .cm-ripple, .cm-fold .chev {
    animation: none !important; transition: none !important;
  }
}
