/*
 * PGM — Custom UI bileşen kütüphanesi (Plan 9.4 / 16.1)
 * Vanilla CSS — Bootstrap/Tailwind YOK.
 * components.js içinde toast/tab/tooltip event handler'ları çalışır.
 */

/* ===== Toast ===== */
.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #1a1614;
  color: #fff;
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: 14px;
  min-width: 240px;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transform: translateY(8px);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  border-left: 3px solid #B98968;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast-success { border-left-color: #4ade80; }
.toast.toast-error   { border-left-color: #ef4444; }
.toast.toast-info    { border-left-color: #38bdf8; }
.toast .toast-close { float: right; background: none; border: 0; color: rgba(255,255,255,.55); cursor: pointer; font-size: 16px; padding: 0 4px; }

/* ===== Custom Checkbox / Radio ===== */
.cc-check {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}
.cc-check input { display: none; }
.cc-check .cc-box {
  width: 18px; height: 18px;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  display: inline-block;
  position: relative;
  background: #fff;
  transition: all .15s ease;
}
.cc-check input[type=radio] + .cc-box { border-radius: 50%; }
.cc-check input:checked + .cc-box {
  border-color: #B98968;
  background: #B98968;
}
.cc-check input:checked + .cc-box::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: #fff;
  border-radius: inherit;
}
.cc-check input[type=checkbox]:checked + .cc-box::after {
  content: '✓';
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ===== Tabs ===== */
.cc-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0,0,0,.08);
  gap: 0;
  flex-wrap: wrap;
}
.cc-tabs > [data-tab] {
  padding: .75rem 1rem;
  cursor: pointer;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: rgba(0,0,0,.6);
  font-size: 14px;
  transition: color .15s ease, border-color .15s ease;
}
.cc-tabs > [data-tab].active {
  color: #B98968;
  border-bottom-color: #B98968;
  font-weight: 600;
}
.cc-tab-panel { display: none; padding: 1rem 0; }
.cc-tab-panel.active { display: block; }

/* ===== Tooltip ===== */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1a1614;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 100;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Datepicker (native polish) ===== */
.cc-datepicker {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  padding: .65rem .9rem;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'><rect x='3' y='4' width='18' height='18' rx='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>") no-repeat right .75rem center;
  padding-right: 2.5rem;
}

/* ===== Magnetic cursor (desktop only, prefers-reduced-motion saygılı) ===== */
@media (hover: hover) and (pointer: fine) {
  .has-magnetic-cursor { cursor: none; }
  .magnetic-cursor {
    position: fixed;
    top: 0; left: 0;
    width: 18px; height: 18px;
    border: 2px solid #B98968;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: transform .12s ease-out, width .15s ease, height .15s ease, background .15s ease;
    z-index: 9998;
    mix-blend-mode: difference;
  }
  .magnetic-cursor.hovering {
    width: 38px; height: 38px;
    background: rgba(185,137,104,.18);
  }
}
@media (prefers-reduced-motion: reduce) {
  .magnetic-cursor { display: none !important; }
}

/* ===== Ink underline shortcode style ===== */
.ink-underline {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='12' viewBox='0 0 200 12'><path d='M2,8 Q50,2 100,7 T200,5' stroke='%23B98968' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 8px;
  padding-bottom: 4px;
  text-decoration: none;
}

/* ===== Noise grain (data-uri) ===== */
.has-grain { position: relative; }
.has-grain::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAGFBMVEUAAAD///+lpaWfn5+srKyZmZmgoKD///8t+0bcAAAAB3RSTlOlpaWnpqaqxdIVRgAAANxJREFUWMPV1ssRgyAQReHcDFRtsbAB0iI9swc4QwxyJU/JIuPHKtR1+u67ZxOXIu+8z67tZbAfBfAfBfgg5Q6w3wPwGwT8nQB+T8H8XwH8GxC/B/wA8B0Ev3Pgu0H/h+E7CHwH8H8M+G/g/yQAvgFAvAOAvgGgvgEgewKovwGgvgGAvgKAvgKAfgGAfgGAvgFAvAGAvgGAvAGAvgGAvAGAvgGAvAGAvgGgPgEgvwEgvwEgvwEgvAEgvAEgPwEgPwEgPwEgPwEgPwEgvgEgPwEgPwEgPwEgvgGgvgEgvgGgvAGAvAFA+wIgRwOQHQ4nawAAAABJRU5ErkJggg==");
}
