/* ============================================================
   Frema Web App — Components (button, card, badge, hero, ...)
   ============================================================ */

/* ─── BUTTON ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  letter-spacing: -0.1px;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--shadow-glow-brand);
}
.btn-primary:hover { box-shadow: 0 0 40px rgba(103,80,164,0.4); }

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover { background: var(--bg-elevated); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-gold {
  background: var(--gold);
  color: #0a0a14;
  box-shadow: var(--shadow-glow-gold);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(239,68,68,0.3);
}
.btn-danger:hover { background: var(--red-bg); }

.btn-sm { padding: 7px 12px; font-size: var(--text-xs); }
.btn-lg { padding: 14px 24px; font-size: var(--text-md); }
.btn-icon { padding: 8px; gap: 0; }

/* ─── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  padding: var(--s-5);
  transition: border-color var(--t-fast);
}

.card.hoverable { cursor: pointer; }
.card.hoverable:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.card-title {
  font-size: var(--text-md);
  font-weight: var(--fw-extra);
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--s-4);
}

/* ─── BADGE ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: var(--fw-black);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.badge-live {
  background: var(--green-bg);
  color: var(--status-live);
}
.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-live);
  animation: pulse 1.6s ease-in-out infinite;
}

.badge-pending { background: rgba(255,184,0,0.15); color: var(--status-pending); }
.badge-pro     { background: var(--brand-bg-strong); color: var(--brand-light); }
.badge-gold    { background: rgba(255,210,63,0.15); color: var(--gold); }
.badge-info    { background: var(--blue-bg); color: var(--blue); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ─── ICON KUTUSU (action card içinde) ───────────────────── */
.icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.icon-box svg { width: 20px; height: 20px; }
.icon-box.brand { background: var(--brand-bg); color: var(--brand-light); }
.icon-box.gold  { background: rgba(255,210,63,0.12); color: var(--gold); }
.icon-box.green { background: var(--green-bg); color: var(--green); }
.icon-box.red   { background: var(--red-bg); color: var(--red); }
.icon-box.blue  { background: var(--blue-bg); color: var(--blue); }
.icon-box.pink  { background: var(--pink-bg); color: var(--pink); }

/* ─── ACTION CARD (Fotify-style quick action) ────────────── */
.action-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.action-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.action-card .label {
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  letter-spacing: -0.1px;
}

.action-card .sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.action-card .body { flex: 1; min-width: 0; }

.action-card .arrow {
  color: var(--text-muted);
  transition: transform var(--t-fast), color var(--t-fast);
}
.action-card:hover .arrow {
  color: var(--text-secondary);
  transform: translateX(2px);
}

/* ─── KPI CARD ────────────────────────────────────────────── */
.kpi-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  padding: var(--s-5) var(--s-5) var(--s-5);
  position: relative;
  overflow: hidden;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.kpi-card.accent-green::before { background: var(--green); opacity: 1; }
.kpi-card.accent-gold::before  { background: var(--gold); opacity: 1; }
.kpi-card.accent-blue::before  { background: var(--blue); opacity: 1; }
.kpi-card.accent-pink::before  { background: var(--pink); opacity: 1; }
.kpi-card.accent-brand::before { background: var(--brand-gradient); opacity: 1; }

.kpi-card .head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--s-4);
}

.kpi-card .value {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: var(--fw-black);
  letter-spacing: -2px;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.kpi-card .label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: 6px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.1px;
}

/* Mini sparkline inside KPI cards (SVG) */
.kpi-card .sparkline {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 88px;
  height: 28px;
  opacity: 0.55;
  pointer-events: none;
  transition: opacity var(--t-fast);
}
.kpi-card:hover .sparkline { opacity: 0.95; }
.kpi-card .sparkline path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kpi-card .sparkline .fill {
  fill: currentColor;
  opacity: 0.12;
  stroke: none;
}
.kpi-card.accent-green .sparkline { color: var(--green); }
.kpi-card.accent-gold .sparkline  { color: var(--gold); }
.kpi-card.accent-brand .sparkline { color: var(--brand-light); }

/* ─── HERO CARD (üst banner) ─────────────────────────────── */
.hero-card {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--r-2xl);
  padding: 32px 36px;
  display: flex;
  align-items: center;
  gap: var(--s-5);
  overflow: hidden;
  isolation: isolate;
}

/* Aurora background — Frema signature gradient (mor + altın spotlight) */
.hero-card::before {
  content: '';
  position: absolute;
  inset: -40%;
  background: var(--aurora-conic);
  opacity: 0.55;
  z-index: -2;
  filter: blur(50px);
  animation: aurora-drift 18s ease-in-out infinite;
}
.hero-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--aurora-radial);
  z-index: -1;
}

@keyframes aurora-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%      { transform: translate(-4%, 2%) rotate(8deg); }
  66%      { transform: translate(3%, -3%) rotate(-6deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-card::before { animation: none; }
}

.hero-card .left { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero-card .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-card .eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  font-weight: var(--fw-black);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.hero-card .title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: var(--fw-extra);
  letter-spacing: -1.4px;
  line-height: 1.05;
  margin-bottom: 10px;
}

.hero-card .meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}

.hero-card .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  padding: 5px 11px;
  border-radius: var(--r-pill);
}

.hero-card .meta-item svg { width: 13px; height: 13px; opacity: 0.7; }

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: var(--s-12) var(--s-6);
}

.empty .icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--s-4);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-raised);
  color: var(--text-tertiary);
}

/* Distinctive empty illustrations — büyük SVG line art (icon yerine kullanılır) */
.empty .illustration {
  width: 220px;
  height: 180px;
  margin: 0 auto var(--s-5);
  display: block;
  color: var(--text-tertiary);
}
.empty .illustration .stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.empty .illustration .accent {
  fill: none;
  stroke: var(--brand-light);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}
.empty .illustration .gold-accent {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.empty .illustration .fill-soft {
  fill: rgba(103,80,164,0.08);
  stroke: none;
}
.empty .illustration .dashed {
  stroke-dasharray: 3 4;
  opacity: 0.5;
}
.empty .illustration .grain-dot {
  fill: var(--text-muted);
  opacity: 0.5;
}

.empty .empty-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  margin-bottom: 6px;
}

.empty .empty-sub {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  max-width: 380px;
  margin: 0 auto var(--s-5);
  line-height: var(--lh-base);
}

/* ─── SKELETON LOADER ────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -800px 0; }
  100% { background-position: 800px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-raised) 0%,
    var(--bg-elevated) 50%,
    var(--bg-raised) 100%
  );
  background-size: 1600px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: var(--r-sm);
  color: transparent;
}

/* ─── SECTION TITLE ──────────────────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-4);
}

.section-title h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--fw-extra);
  letter-spacing: -0.6px;
}

/* ─── LIVE DOT (canlı badge yanına/eyebrow içine) ───────── */
.live-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-live);
  box-shadow: 0 0 8px var(--status-live);
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--status-live);
  opacity: 0.35;
  animation: live-ring 1.8s ease-out infinite;
}
@keyframes live-ring {
  0%   { transform: scale(0.7); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ─── GLOBAL TOAST (window.Toast.show()) ──────────────────── */
#__toast_container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast-msg {
  pointer-events: auto;
  min-width: 240px;
  max-width: 380px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.25s ease-out;
}
.toast-msg.ok  { border-color: rgba(110,231,183,0.4); color: #6ee7b7; }
.toast-msg.err { border-color: rgba(248,113,113,0.4); color: #fca5a5; }
.toast-msg.info{ border-color: rgba(167,139,250,0.4); color: var(--brand-light); }
.toast-msg.leaving { animation: toast-out 0.22s ease-in forwards; }
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateY(-8px); opacity: 0; }
}

/* ─── EVENT CHIPS (dashboard etkinlik seçici) ─────────────── */
.event-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.event-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--r-pill);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: all var(--t-fast);
  max-width: 280px;
}
.event-chip:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.event-chip.active {
  border-color: var(--brand);
  background: var(--brand-bg-strong);
  color: var(--brand-light);
  box-shadow: 0 0 16px rgba(103,80,164,0.20);
}
.event-chip .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.event-chip .dot.live { background: var(--status-live); box-shadow: 0 0 6px var(--status-live); }
.event-chip .dot.up   { background: var(--gold); }
.event-chip .dot.past { background: var(--text-muted); }
.event-chip .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.event-chip .count {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.event-chip.more {
  background: transparent;
  color: var(--text-tertiary);
  border-style: dashed;
}

/* ─── PAGE TITLE (her sayfanın <h1>'i) — Fraunces karakter ─ */
.page-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: var(--fw-extra);
  letter-spacing: -1.3px;
  line-height: 1.1;
  margin-bottom: 6px;
}
.page-subtitle {
  color: var(--text-tertiary);
  font-size: 14px;
  margin-bottom: 24px;
}

.section-title .link {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--brand-light);
  transition: color var(--t-fast);
}
.section-title .link:hover { color: white; }

/* ─── GRID UTILS ─────────────────────────────────────────── */
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.row { display: flex; gap: var(--s-4); }
.row.center { align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }

.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-tight { gap: var(--s-2); }
.stack-loose { gap: var(--s-6); }

.spacer { flex: 1; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ─── Mobile UX iyileştirmeleri ────────────────────────────── */
@media (max-width: 768px) {
  /* Touch hitbox: tüm butonlar min 44px */
  .btn { min-height: 44px; padding: 11px 18px; }
  .btn-sm { min-height: 38px; padding: 9px 14px; font-size: var(--text-xs); }
  .btn-icon { min-height: 40px; min-width: 40px; padding: 10px; }

  /* KPI card mobil typography */
  .kpi-card .value { font-size: 32px; letter-spacing: -1.3px; }
  .kpi-card { padding: 18px 20px; }

  /* Hero card padding mobil */
  .hero-card { padding: 22px 20px; gap: var(--s-4); }
  .hero-card .title { font-size: 26px; letter-spacing: -1px; }
  .hero-card .eyebrow { font-size: 10px; letter-spacing: 1.4px; }

  /* Action card daha kompakt */
  .action-card { padding: 14px; }
  .action-card .label { font-size: 13px; }
  .action-card .sub { font-size: 11.5px; }

  /* Card padding */
  .card { padding: var(--s-4); }

  /* Page title responsive */
  .page-title { font-size: 28px; letter-spacing: -1px; }

  /* Section title */
  .section-title h2 { font-size: var(--text-lg); }

  /* Empty state — küçük ekranda padding az */
  .empty { padding: var(--s-8) var(--s-4); }
  .empty .illustration { width: 160px; height: 130px; }
}

@media (max-width: 480px) {
  /* Daha sıkı mobile için */
  .kpi-card .value { font-size: 28px; }
  .hero-card { padding: 18px; }
  .hero-card .title { font-size: 22px; }
  .page-title { font-size: 24px; }
  .card { padding: 14px; }
  .empty .illustration { width: 140px; height: 110px; }
}
