/*
  Custom CSS layer for the Kashan Guild Union panel.
  Tailwind (CDN) covers almost everything; this file only holds what
  Tailwind's utility classes can't express: autofill/focus fixes, custom
  form controls, safe-area insets, small animations and RTL notes.

  RTL NOTE: always prefer logical utilities (ms-/me-/ps-/pe-/text-start/
  text-end) or the `rtl:` variant over physical `left-`/`right-` classes
  in markup, since this whole app runs dir="rtl".
*/

html {
  font-family: 'Vazirmatn', system-ui, sans-serif;
}

body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* ---------- Chrome autofill fix ---------- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #111827 !important;
  caret-color: #111827;
  transition: background-color 9999s ease-in-out 0s;
}
.dark input:-webkit-autofill,
.surface-dark input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #1f2937 inset !important;
  -webkit-text-fill-color: #f9fafb !important;
  caret-color: #f9fafb;
}

/* ---------- Consistent focus ring ---------- */
input, textarea, select, button, a {
  outline: none;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.focus-ring:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 129, 111, 0.35);
  border-color: #10816f !important;
}
button:focus-visible, a:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 129, 111, 0.35);
  border-radius: 0.5rem;
}

/* ---------- Custom checkbox ---------- */
.chk {
  appearance: none;
  -webkit-appearance: none;
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid #cbd5e1;
  border-radius: 0.4rem;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.chk:checked {
  background-color: #10816f;
  border-color: #10816f;
}
.chk:checked::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.4rem;
  height: 0.7rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

/* ---------- Custom switch (active/inactive toggles) ---------- */
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 2.75rem;
  height: 1.55rem;
  background: #d1d5db;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background-color .2s;
  flex-shrink: 0;
}
.switch:checked {
  background: #10816f;
}
.switch::before {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 1.25rem;
  height: 1.25rem;
  background: white;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform .2s;
}
.switch:checked::before {
  transform: translateX(-1.2rem);
}

/* ---------- Custom range ---------- */
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  height: 0.35rem;
  border-radius: 999px;
  background: #e2e8f0;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: #10816f;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}

/* ---------- Native select suppression (when wrapped by a custom control) ---------- */
select.plain {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
}

/* ---------- Safe-area insets (app-like on notched phones) ---------- */
.safe-top {
  padding-top: env(safe-area-inset-top);
}
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- Scrollbar hiding (chip rows / photo galleries) ---------- */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ---------- Animations for Modal / Sheet / Toast ---------- */
@keyframes kgu-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes kgu-sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes kgu-pop-in {
  from { opacity: 0; transform: scale(.95) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes kgu-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.anim-fade { animation: kgu-fade-in .18s ease-out; }
.anim-sheet-up { animation: kgu-sheet-up .25s cubic-bezier(.2,.8,.3,1); }
.anim-pop-in { animation: kgu-pop-in .16s ease-out; }
.anim-toast-in { animation: kgu-toast-in .18s ease-out; }

/* ---------- Skeleton loader ---------- */
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 37%, #e5e7eb 63%);
  background-size: 400% 100%;
  animation: kgu-skeleton 1.4s ease infinite;
}
@keyframes kgu-skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- App-shell helpers ---------- */
.bottom-nav-shadow {
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}
.card-shadow {
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
