/* ============================================
   Finly Analytica — REPORT & GLOBAL THEME
   Tekilleştirilmiş (son eklenen davranışlar korunur)
   ============================================ */

/* =========================================================
   1) ROOT TOKENS — Tema değişkenleri (tüm sayfa)
   ========================================================= */
:root {
  --bg: #F3F2EC;
  --panel: #ffffff;
  --border: #cccccc;
  --txt: #202124;
  --muted: #4a4a4a;
  --brand: #1D3E2F;
  --shadow: 0 8px 24px rgba(0, 0, 0, .12);
  --topbar: 64px;
  --chip: #e7e9e5;
  --ls-footer: 30px;
}

/* =========================================================
   2) GLOBAL — Sayfa genel tipografi ve arka plan
   ========================================================= */
html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

body {
  opacity: 1;
  transition: opacity .25s ease-out;
}

body.fa-report-mode {
  overflow: hidden;
  background: var(--bg);
}

/* =========================================================
   3) REPORT SHELL — Report görünümü container’ları
   ========================================================= */
#fa-reportShell {
  position: fixed;
  inset: 0;
  display: none;
  background: var(--bg);
  box-sizing: border-box;
  z-index: 5;
}

#fa-reportShell.visible {
  display: flex;
}

/* Ana satır: SOL (top+rapor) + SAĞ (banner) */
#fa-reportRow {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  padding: 0 10px 10px 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding-top: 7px;
  /* Header üstü boşluk (son istek) */
}

/* SOL SÜTUN: top bar + altında rapor */
#fa-reportLeft {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* =========================================================
   4) TOP BAR — Header (desktop + mobile unified color)
   ========================================================= */
#fa-top {
  flex: 0 0 var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;

  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;

  /* YENİ: Koyu gri ana yazı rengi */
  color: #666666;

  padding: 0 12px;
  padding-top: calc(env(safe-area-inset-top, 0));
  box-sizing: border-box;
}

#fa-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#fa-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   5) REPORT MAIN — Iframe, loader, footer mask (Looker)
   ========================================================= */
#fa-reportMain {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  background: var(--bg);
}

/* İframe sadece bu alanı kaplasın */
#fa-reportMain iframe#fa-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
  z-index: 1;
}


@keyframes fa-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Looker Studio footer mask */
#fa-lsMask {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ls-footer);
  background: var(--bg);
  z-index: 2;
  pointer-events: auto;
  cursor: default;
  display: none;

  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

body.fa-report-mode #fa-lsMask,
body.fs #fa-lsMask,
body.pfs #fa-lsMask {
  display: block;
}

/* =========================================================
   6) RIGHT PROMO — Sağ sabit banner (desktop)
   ========================================================= */
#fa-reportPromoRight {
  flex: 0 0 125px;
  width: 125px;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  box-sizing: border-box;
}

.fa-report-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* =========================================================
   7) HEADER RIGHT AREA — Actions (FS + User + Menu)
   ========================================================= */
#fa-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
}

/* pageMenu wrapper (mobilde ikon gibi; desktopta gizlenecek) */
.fa-select-wrap {
  display: block;
  position: relative;
  order: 3;
}

/* Select base (desktopta menu gizli olduğundan çoğunlukla mobil için) */
.fa-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: 26px;
  border-radius: 9px;
  border: 1px solid #E5F2D2;
  color: #E5F2D2;
  background: transparent;
  padding: 0 24px 0 8px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  line-height: 26px;
  min-width: 100px;
  max-width: 40vw;
  width: auto;
}

.fa-select:focus {
  outline: 2px solid rgba(255, 255, 255, .5);
  outline-offset: 2px;
}

/* =========================================================
   8) FULLSCREEN BUTTON — Tam ekran ikonu + tooltip
   ========================================================= */
.fa-top-btn {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;

  /* YENİ: İkon rengi koyu gri */
  color: #666666;

  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  align-self: flex-end;
  margin-bottom: 4px;
}

.fa-top-btn::before {
  content: "⛶";
  font-size: 18px;
  line-height: 1;
}

.fa-top-btn:hover {
  /* YENİ: Açık zemin için koyu şeffaf hover efekti */
  background: rgba(0, 0, 0, .05);
}

/* Tooltip (default): desktop override aşağıda sola taşınıyor */
.fa-top-btn::after {
  content: "Tam Ekran";
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .8);
  color: #ffffff;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

.fa-top-btn:hover::after {
  opacity: 1;
  transform: translateY(2px);
}

/* =========================================================
   9) USER CHIP — Avatar + Plan (desktop + mobile standard)
   ========================================================= */

/* İsim satırı her yerde kapalı (standard) */
.fa-user-name-row {
  display: none !important;
}

.fa-user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  max-width: none;
  box-sizing: border-box;
  cursor: pointer;
}

.fa-user-info:hover {
  /* YENİ: Hover gri */
  background: rgba(0, 0, 0, .05);
  border-radius: 6px;
}

.fa-user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;

  /* YENİ: Koyu zemin yerine açık gri zemin ve koyu yazı */
  background: rgba(0, 0, 0, 0.08);
  color: #666666;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  opacity: 0.95;
}

.fa-user-plan-row {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 11px;

  /* YENİ: Yazı rengi */
  color: #666666;
}

.fa-user-plan {
  padding: 2px 8px;

  /* YENİ: Şık gri border ve şeffaf zemin */
  border: 1px solid #cbd5e1;
  background: transparent;

  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  color: inherit;
}

/* =========================================================
   10) ACCOUNT / LOGOUT MODAL — Hesap pencereleri
   ========================================================= */
.fa-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  display: none;
  align-items: flex-start;
  justify-content: flex-end;
  z-index: 9998;
}

.fa-modal-inner {
  min-width: 280px;
  max-width: 300px;
  background: #f6f4ee;
  color: #1D3E2F;
  border-radius: 22px;
  padding: 24px 24px 20px;
  border: 1px solid #d7ded5;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  box-sizing: border-box;
  margin-top: 70px;
  margin-right: 165px;
}

.fa-modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #1D3E2F;
}

.fa-modal-text {
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0 18px;
  color: #35463b;
}

.fa-modal-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  margin: 6px 0;
}

.fa-modal-label {
  color: #425347;
}

.fa-modal-value {
  font-weight: 600;
  text-align: right;
  color: #1D3E2F;
}

.fa-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.fa-modal-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
}

.fa-modal-btn-primary {
  background: #1D3E2F;
  border-color: #1D3E2F;
  color: #ffffff;
}

.fa-modal-btn-primary:hover {
  background: #173225;
}

.fa-modal-btn-secondary {
  background: transparent;
  border-color: #9fb1a4;
  color: #1D3E2F;
}

.fa-modal-btn-secondary:hover {
  background: rgba(157, 179, 165, .15);
}

/* =========================================================
   11) FULLSCREEN MODES — fs / pfs davranışları
   ========================================================= */
body.pfs {
  overflow: hidden;
}

body.pfs #fa-reportPromoRight {
  display: none;
}

body.pfs #fa-top {
  display: none;
}

body.pfs #fa-reportRow {
  padding: 0;
}

body.pfs #fa-reportMain iframe#fa-frame {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

/* Fullscreen exit */
#fa-fsExit {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 10000;
  display: none;
  padding: 10px 12px;
  line-height: 1;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid #ffffff;
  color: #ffffff;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#fa-fsExit:active {
  transform: scale(.98);
}

body.fs #fa-fsExit {
  display: block;
}

/* =========================================================
   12) pageMenu ICON — Vertical Dots (JS aynı kalsın)
   Wix hamburger ile çakışmasın diye (mobilde görünen ikon)
   ========================================================= */
#pageMenu.fa-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 28px;
  min-width: 28px;
  height: 28px;

  padding: 0;
  border: none;
  border-radius: 6px;
  background-color: transparent;

  cursor: pointer;

  color: transparent;
  -webkit-text-fill-color: transparent;

  /* YENİ: Dikey 3 nokta (Koyu Gri) */
  background-image:
    radial-gradient(circle, #666666 2px, transparent 2.2px),
    radial-gradient(circle, #666666 2px, transparent 2.2px),
    radial-gradient(circle, #666666 2px, transparent 2.2px);
  background-repeat: no-repeat;
  background-size: 4px 4px, 4px 4px, 4px 4px;
  background-position: center 8px, center 14px, center 20px;
}

#pageMenu.fa-select:hover {
  /* YENİ: Hover gri */
  background-color: rgba(0, 0, 0, .05);
}

#pageMenu.fa-select:focus {
  outline: none;
}

/* =========================================================
   13) DESKTOP LAYOUT — Menü gizli + User chip FS altında
   Etkiler: desktop header sağ alan yerleşimi
   ========================================================= */
@media (min-width: 821px) {

  /* Desktop: hamburger menü gizli */
  .fa-select-wrap {
    display: none !important;
  }

  /* Sağ blok: daha ferah */
  #fa-actions {
    position: relative;
    height: var(--topbar);
    padding-right: 52px;
  }

  /* Tam ekran: sağ üst (biraz yukarı) */
  #full.fa-top-btn {
    position: absolute;
    right: 10px;
    top: 8px;
    margin: 0;
    align-self: auto;
  }

  /* User chip: FS altında (sağ hizalı) */
  #fa-userInfo.fa-user-info {
    position: absolute;
    right: 10px;
    top: 38px;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 240px;
  }

  /* Tooltip: sola aç + brand renk (siyah yerine) */
  #full.fa-top-btn::after {
    top: 50%;
    right: calc(100% + 12px);
    transform: translateY(-50%);

    background: rgba(18, 39, 31, 0.92);
    color: #E5F2D2;
    border: 1px solid rgba(229, 242, 210, 0.18);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);

    padding: 6px 10px;
    border-radius: 999px;
    font-size: 10px;
  }

  #full.fa-top-btn:hover::after {
    opacity: 1;
    transform: translateY(-50%);
  }
}

/* =========================================================
   14) MOBILE LAYOUT — Header compact + chip solda
   Etkiler: mobil header boyutları, ikonlar, chip konumu, modal
   ========================================================= */
@media (max-width: 820px) {

  /* Mobilde daha kısa header (%20 küçültülmüş son değer) */
  :root {
    --topbar: 48px;
  }

  /* Mobilde sağ banner gizli */
  #fa-reportPromoRight {
    display: none;
  }

  /* Row padding: mobil sağ padding sıfır + üst boşluk sabit */
  #fa-reportRow {
    padding-right: 0;
  }

  /* Modal: mobilde ortalı */
  .fa-modal {
    align-items: center;
    justify-content: center;
  }

  .fa-modal-inner {
    margin-top: 0;
    margin-right: 0;
    max-width: calc(100% - 32px);
  }

  /* Header: chip satırı için ikinci satır (daha az nefes) */
  #fa-top {
    position: relative;
    padding-bottom: 18px;
  }

  /* Başlık %20 küçült */
  #fa-title {
    font-size: 12px;
    line-height: 1.10;
    letter-spacing: 0.12px;
  }

  /* Actions: top referans olsun */
  #fa-actions {
    position: static !important;
    height: var(--topbar);
    flex-shrink: 0;
  }

  /* Menü en sağ, FS onun solunda (dikey ortalı) */
  .fa-select-wrap {
    position: absolute;
    top: 50% !important;
    right: 8px;
    transform: translateY(-50%);
  }

  #full.fa-top-btn {
    position: absolute;
    top: 50% !important;
    right: 36px;
    transform: translateY(-50%);
    margin: 0;
  }

  /* İkonlar %20 küçült */
  .fa-top-btn,
  #pageMenu.fa-select {
    width: 22px;
    height: 22px;
    border-radius: 6px;
  }

  #pageMenu.fa-select {
    background-size: 14px 2px, 14px 2px, 14px 2px;
    background-position: center 6px, center 10px, center 14px;
  }

  /* User chip: solda, başlığın altında */
  #fa-userInfo.fa-user-info {
    position: absolute;
    left: 10px;
    bottom: 6px;
    right: auto;
    top: auto;

    margin: 0 !important;
    padding: 0 !important;

    max-width: calc(100vw - 100px);
    background: transparent;
    gap: 6px;
  }

  /* Avatar/plan %20 küçült */
  .fa-user-avatar {
    width: 16px;
    height: 16px;
    font-size: 9px;
  }

  .fa-user-plan-row {
    font-size: 9px;
  }

  .fa-user-plan {
    padding: 2px 6px;
    font-size: 9px;
  }

  /* Mobilde tooltip kapalı */
  #full.fa-top-btn::after {
    display: none !important;
    content: "" !important;
  }
}