/* =========================================================
   FF9 Templates Module
   Canonical stylesheet
   Version: 1.3.0
========================================================= */

#ff9-templates-root{
  display:block !important;
  position:relative;
  z-index:1;
  margin-top:14px;
  padding-top:6px;
}

#ff9-templates-root .ef-ff9-templates{
  position:relative;
  z-index:1;
  width:100%;
}

#ff9-templates-root .ef-ff9-toolbar{
  margin:0 0 12px 0;
}

#ff9-templates-root .ef-ff9-filters{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-end;
}

#ff9-templates-root .ef-ff9-filter{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:rgba(255,242,198,.85);
}

#ff9-templates-root .ef-ff9-filter select{
  min-width:160px;
  padding:8px 10px;
  border-radius:10px;
  outline:none;
  background:rgba(0,0,0,.22);
  border:1px solid rgba(255,242,198,.18);
  color:rgba(255,242,198,.92);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}

#ff9-templates-root .ef-ff9-grid{
  display:grid;
  grid-template-columns:repeat(6, minmax(0, 1fr));
  gap:12px;
  min-height:320px;
}

@media (max-width:1400px){
  #ff9-templates-root .ef-ff9-grid{
    grid-template-columns:repeat(4, minmax(0, 1fr));
  }
}
@media (max-width:980px){
  #ff9-templates-root .ef-ff9-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}
@media (max-width:560px){
  #ff9-templates-root .ef-ff9-grid{
    grid-template-columns:1fr;
  }
}

#ff9-templates-root .ef-ff9-tile{
  position:relative;
  overflow:hidden;
  border-radius:16px;
  border:1px solid rgba(255,242,198,.14);
  background:rgba(0,0,0,.18);
  box-shadow:0 14px 34px rgba(0,0,0,.35);
  min-height:210px;
  display:flex;
  flex-direction:column;
  transition:transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

#ff9-templates-root .ef-ff9-tile:hover{
  transform:translateY(-1px);
  border-color:rgba(255,242,198,.28);
  box-shadow:0 16px 40px rgba(0,0,0,.40), 0 0 14px rgba(255,242,198,.12);
}

#ff9-templates-root .ef-ff9-tile.is-selected{
  border-color:rgba(255,242,198,.60);
  box-shadow:0 18px 46px rgba(0,0,0,.45), 0 0 18px rgba(255,242,198,.20);
}

#ff9-templates-root .ef-ff9-thumb{
  width:100%;
  aspect-ratio:17 / 22;
  background:rgba(255,255,255,.03);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

#ff9-templates-root .ef-ff9-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

#ff9-templates-root .ef-ff9-meta{
  padding:10px 10px 10px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

#ff9-templates-root .ef-ff9-title{
  font-size:13px;
  font-weight:700;
  color:rgba(255,242,198,.95);
}

#ff9-templates-root .ef-ff9-actions{
  margin-top:auto;
  padding:0 10px 12px;
  display:flex;
  gap:8px;
}

#ff9-templates-root .ef-ff9-btn{
  appearance:none;
  border:1px solid rgba(255,242,198,.22);
  background:rgba(0,0,0,.20);
  color:rgba(255,242,198,.92);
  font-size:12px;
  line-height:1;
  padding:8px 12px;
  border-radius:999px;
  cursor:pointer;
  white-space:nowrap;
  transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}

#ff9-templates-root .ef-ff9-btn:hover{
  background:rgba(255,242,198,.10);
  border-color:rgba(255,242,198,.40);
  box-shadow:0 10px 22px rgba(0,0,0,.32), 0 0 10px rgba(255,242,198,.14);
  transform:translateY(-1px);
}

#ff9-templates-root .ef-ff9-btn.is-primary{
  background:linear-gradient(135deg, #c2a96a 0%, #9a814a 100%);
  color:#090b10;
  border-color:rgba(255,242,198,.22);
  font-weight:800;
}

#ff9-templates-root .ef-ff9-empty,
#ff9-templates-root .ef-ff9-no-preview{
  padding:12px;
  color:rgba(255,242,198,.78);
  font-size:12px;
}

/* =========================
   Compact modal
========================= */

html.ef-ff9-modal-open,
body.ef-ff9-modal-open{
  overflow:hidden;
}

#ff9-templates-root .ef-ff9-modal[hidden]{
  display:none !important;
}

#ff9-templates-root .ef-ff9-modal{
  position:fixed;
  inset:0;
  z-index:999999;
}

#ff9-templates-root .ef-ff9-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(5px);
}

#ff9-templates-root .ef-ff9-modal-dialog{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%, -50%);
  width:min(560px, calc(100vw - 36px));
  max-height:calc(100vh - 48px);
  overflow:hidden;
  border-radius:18px;
  border:1px solid rgba(255,242,198,.20);
  background:
    linear-gradient(180deg, rgba(20,20,24,.96), rgba(10,10,14,.95));
  box-shadow:0 28px 80px rgba(0,0,0,.65);
}

#ff9-templates-root .ef-ff9-modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding:14px 16px 12px;
  border-bottom:1px solid rgba(255,255,255,.06);
}

#ff9-templates-root .ef-ff9-modal-titlewrap{
  min-width:0;
  flex:1 1 auto;
}

#ff9-templates-root .ef-ff9-modal-title{
  font-size:15px;
  font-weight:900;
  color:rgba(255,242,198,.96);
  line-height:1.2;
}

#ff9-templates-root .ef-ff9-modal-sub{
  margin-top:4px;
  font-size:12px;
  color:rgba(255,255,255,.66);
}

#ff9-templates-root .ef-ff9-modal-close{
  flex:0 0 auto;
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid rgba(255,242,198,.24);
  background:rgba(0,0,0,.30);
  color:rgba(255,242,198,.95);
  font-size:24px;
  line-height:1;
  cursor:pointer;
  transition:background .12s ease, border-color .12s ease, transform .12s ease;
}

#ff9-templates-root .ef-ff9-modal-close:hover{
  background:rgba(255,242,198,.08);
  border-color:rgba(255,242,198,.40);
  transform:translateY(-1px);
}

#ff9-templates-root .ef-ff9-modal-body{
  padding:14px 16px 18px;
  overflow:auto;
  max-height:calc(100vh - 130px);
}

#ff9-templates-root .ef-ff9-modal-img{
  width:100%;
  max-width:420px;
  height:auto;
  display:block;
  margin:0 auto;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 16px 36px rgba(0,0,0,.40);
}