/* ============================================================
   redesign-v2 — PRIMITIVES  (Step 1: design-system mapping)
   ------------------------------------------------------------
   Reusable component classes, all built on tokens.css.
   No literal colors except #fff / transparent for fills that
   are intentionally pure white / clear.
   Prefix `rd-` avoids any clash with existing panel.css.
   ============================================================ */

/* ---------------- BASE RESET ----------------
   Form elements (button/input/textarea/select) do NOT inherit
   font-family by default → browsers use a system font. Force
   inheritance so the whole UI renders in Geist (body font). */
button, input, textarea, select { font-family: inherit; }

/* ---------------- KEYFRAMES ---------------- */
@keyframes rd-sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes rd-fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes rd-popIn   { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
@keyframes rd-spin    { to { transform: rotate(360deg); } }
@keyframes rd-pulse   { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------------- SHELL ---------------- */
.rd-app {
  position: relative;
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--rd-bg);
  color: var(--rd-text-1);
  overflow: hidden;
}
.rd-screen {
  min-height: 100%;
  padding: var(--rd-screen-top) var(--rd-gutter) var(--rd-screen-bottom);
}
.rd-screen--lg { padding-top: var(--rd-screen-top-lg); }

.rd-header {
  padding: var(--rd-screen-top) var(--rd-gutter) var(--rd-s-5);
  background: var(--rd-surface);
  border-bottom: 1px solid var(--rd-border);
}
.rd-title    { font-size: var(--rd-fs-24); font-weight: var(--rd-fw-700); letter-spacing: -.4px; }
.rd-subtitle { font-size: var(--rd-fs-13); color: var(--rd-text-3); margin-top: 3px; }
.rd-section-label {
  font-size: var(--rd-fs-12); font-weight: var(--rd-fw-600);
  color: var(--rd-text-4); letter-spacing: .6px; text-transform: uppercase;
  margin: 0 4px 8px;
}

/* back / icon button */
.rd-iconbtn {
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1px solid var(--rd-border); background: var(--rd-surface-2);
  border-radius: var(--rd-r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--rd-text-2); cursor: pointer;
}

/* ---------------- BOTTOM NAV + FAB ---------------- */
.rd-bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--rd-z-nav);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--rd-track);
  padding: 8px 12px 26px;
  display: flex; align-items: flex-end; justify-content: space-around;
}
.rd-navbtn {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--rd-text-4); font-size: 10.5px; font-weight: var(--rd-fw-600);
}
.rd-navbtn.is-active { color: var(--rd-accent); }
.rd-fab {
  width: 58px; height: 58px; margin-top: -26px;
  border: none; border-radius: 19px; cursor: pointer;
  background: var(--rd-accent); color: var(--rd-on-accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--rd-shadow-fab);
}

/* ---------------- BOTTOM SHEET ---------------- */
.rd-sheet-overlay {
  position: fixed; inset: 0; z-index: var(--rd-z-sheet);
  background: var(--rd-overlay); animation: rd-fadeIn .2s ease;
}
.rd-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--rd-z-sheet);
  max-height: 92%;
  display: flex; flex-direction: column;
  background: var(--rd-bg);
  border-radius: var(--rd-r-sheet) var(--rd-r-sheet) 0 0;
  box-shadow: var(--rd-shadow-sheet);
  animation: rd-sheetUp .28s cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}
.rd-sheet--hi { z-index: var(--rd-z-sheet-hi); }
.rd-sheet__head {
  padding: 10px 18px 14px; flex-shrink: 0;
  background: var(--rd-surface);
  border-radius: var(--rd-r-sheet) var(--rd-r-sheet) 0 0;
  display: flex; flex-direction: column; align-items: center;
}
.rd-sheet__body { overflow-y: auto; padding: 18px; }
.rd-sheet__foot {
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: var(--rd-surface); border-top: 1px solid var(--rd-border);
}
.rd-grabber { width: 38px; height: 5px; border-radius: var(--rd-r-bar); background: var(--rd-hairline); }

/* ---------------- SURFACES ---------------- */
.rd-card {
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  border-radius: var(--rd-r-lg);
  padding: 14px 15px;
}
.rd-statcard {
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  border-radius: var(--rd-r-lg);
  padding: 14px 15px;
}
.rd-statcard__num {
  font-size: var(--rd-fs-26); font-weight: var(--rd-fw-700);
  letter-spacing: -.5px; font-variant-numeric: tabular-nums;
}
.rd-statcard__lbl { font-size: var(--rd-fs-13); color: var(--rd-text-3); margin-top: 2px; }
.rd-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--rd-s-3); }

/* grouped list (iOS-style rows) */
.rd-list {
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  border-radius: var(--rd-r-lg);
  overflow: hidden;
}
.rd-row {
  width: 100%; text-align: left; background: none; cursor: pointer;
  font-family: inherit; border: none;
  padding: 13px 15px;
  display: flex; align-items: center; gap: var(--rd-s-4);
  border-bottom: 1px solid var(--rd-border-subtle);
}
.rd-row:last-child { border-bottom: none; }
.rd-row__icon { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; }
.rd-row__label { flex: 1; font-size: var(--rd-fs-15); font-weight: var(--rd-fw-500); }
.rd-row__detail { font-size: var(--rd-fs-14); color: var(--rd-text-4); }
.rd-chevron { width: 8px; height: 14px; flex-shrink: 0; color: var(--rd-text-5); }

/* ---------------- BUTTONS ---------------- */
.rd-btn {
  width: 100%; height: 52px; border: none; cursor: pointer;
  border-radius: var(--rd-r-md); font-family: inherit;
  font-size: var(--rd-fs-16); font-weight: var(--rd-fw-600);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.rd-btn--primary { background: var(--rd-accent); color: var(--rd-on-accent); }
.rd-btn--primary:hover { background: var(--rd-accent-hover); }
.rd-btn--ghost   { background: var(--rd-surface); color: var(--rd-text-2); border: 1px solid var(--rd-border); }
.rd-btn--success { background: var(--rd-success); color: var(--rd-on-accent); }
.rd-btn--danger  { background: var(--rd-surface); color: var(--rd-danger); border: 1px solid var(--rd-danger-border); }
.rd-btn--sm { height: 38px; padding: 0 14px; width: auto; font-size: var(--rd-fs-14); border-radius: var(--rd-r-md); }
.rd-btn:disabled, .rd-btn[aria-disabled="true"] { background: var(--rd-disabled); color: #fff; cursor: default; }

/* ---------------- SEGMENTED CONTROL ---------------- */
.rd-segmented {
  display: flex; background: var(--rd-track);
  border-radius: var(--rd-r-md); padding: 3px;
}
.rd-seg-btn {
  flex: 1; height: 36px; border: none; cursor: pointer;
  border-radius: 10px; font-family: inherit;
  font-size: var(--rd-fs-14); font-weight: var(--rd-fw-600);
  background: transparent; color: var(--rd-text-2);
}
.rd-seg-btn.is-active {
  background: var(--rd-surface); color: var(--rd-text-1);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.rd-seg-btn--dark.is-active { background: var(--rd-text-1); color: #fff; }

/* ---------------- TOGGLE ---------------- */
.rd-toggle {
  width: 50px; height: 30px; flex-shrink: 0;
  border: none; border-radius: 15px; padding: 3px; cursor: pointer;
  background: var(--rd-switch-off); display: flex; justify-content: flex-start;
  transition: background .2s, justify-content .2s;
}
.rd-toggle__knob { width: 24px; height: 24px; border-radius: 50%; background: #fff; }
.rd-toggle.is-on { background: var(--rd-success); justify-content: flex-end; }
.rd-toggle.is-on--accent { background: var(--rd-accent); justify-content: flex-end; }
.rd-toggle--sm { width: 44px; height: 26px; }
.rd-toggle--sm .rd-toggle__knob { width: 20px; height: 20px; }

/* ---------------- FIELDS ---------------- */
.rd-field-label { font-size: var(--rd-fs-13); font-weight: var(--rd-fw-600); color: var(--rd-text-2); margin-bottom: 8px; }
.rd-input, .rd-textarea, .rd-select {
  width: 100%; font-family: inherit;
  background: var(--rd-surface); border: 1.5px solid var(--rd-border);
  border-radius: var(--rd-r-md); padding: 13px 14px;
  font-size: 15.5px; color: var(--rd-text-1); outline: none;
}
.rd-input:focus, .rd-textarea:focus, .rd-select:focus { border-color: var(--rd-accent); }
.rd-textarea { min-height: 130px; resize: none; line-height: 1.55; font-size: 14.5px; }
.rd-field-err { font-size: 12.5px; color: var(--rd-danger); margin-top: 7px; font-weight: var(--rd-fw-500); }
/* phone input group (+90 prefix) */
.rd-phone {
  display: flex; align-items: center; gap: 9px;
  background: var(--rd-surface); border: 1.5px solid var(--rd-border);
  border-radius: var(--rd-r-md); padding: 0 14px; height: 50px;
}
.rd-phone__cc { font-size: 15.5px; font-weight: var(--rd-fw-600); color: var(--rd-text-2); }
.rd-phone__sep { width: 1px; height: 22px; background: var(--rd-hairline); }
.rd-phone input { flex: 1; border: none; background: none; outline: none; font-family: inherit; font-size: 15.5px; color: var(--rd-text-1); }

/* ---------------- DATE CHIPS / SLOTS ---------------- */
.rd-day-chip {
  flex-shrink: 0; width: 52px; height: 62px;
  border: 1px solid var(--rd-border); background: var(--rd-surface);
  border-radius: var(--rd-r-lg); color: var(--rd-text-1); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.rd-day-chip__d { font-size: var(--rd-fs-12); color: var(--rd-text-4); }
.rd-day-chip__n { font-size: 18px; font-weight: var(--rd-fw-700); font-variant-numeric: tabular-nums; }
.rd-day-chip.is-active { border-color: var(--rd-accent); background: var(--rd-accent-tint); color: var(--rd-accent); }
.rd-day-chip.is-busy   { background: var(--rd-warn-tint); }
.rd-day-chip.is-full   { background: var(--rd-danger-tint); color: var(--rd-danger); cursor: default; }
.rd-day-chip.is-disabled { opacity: .4; cursor: default; }

.rd-slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--rd-s-2); }
.rd-slot {
  height: 46px; border: 1.5px solid var(--rd-border); background: var(--rd-surface);
  border-radius: var(--rd-r-md); color: var(--rd-text-1); cursor: pointer;
  font-family: inherit; font-size: var(--rd-fs-14); font-weight: var(--rd-fw-600);
  font-variant-numeric: tabular-nums;
}
.rd-slot.is-active { background: var(--rd-accent); color: var(--rd-on-accent); border-color: var(--rd-accent); }
.rd-slot.is-busy { background: var(--rd-border-subtle); color: var(--rd-text-5); border-color: var(--rd-border-subtle); opacity: .6; cursor: default; }

/* ---------------- CHIPS / BADGES / AVATARS ---------------- */
.rd-chip {
  height: 38px; padding: 0 14px; cursor: pointer; font-family: inherit;
  border: 1.5px solid var(--rd-border); background: var(--rd-surface);
  border-radius: var(--rd-r-sm); color: var(--rd-text-2);
  font-size: 13.5px; font-weight: var(--rd-fw-600);
}
.rd-chip.is-active { border-color: var(--rd-accent); background: var(--rd-accent-tint); color: var(--rd-accent); }

.rd-badge {
  font-size: 11px; font-weight: var(--rd-fw-600);
  padding: 5px 9px; border-radius: var(--rd-r-pill); white-space: nowrap;
}
.rd-badge--beklemede  { background: var(--rd-warn-tint);    color: var(--rd-warn); }
.rd-badge--onaylandi  { background: var(--rd-accent-tint);  color: var(--rd-accent); }
.rd-badge--tamamlandi { background: var(--rd-success-tint); color: var(--rd-success); }
.rd-badge--iptal      { background: var(--rd-danger-tint);  color: var(--rd-danger); }

.rd-pro-badge {
  font-family: var(--rd-font-mono);
  font-size: 10px; font-weight: var(--rd-fw-700); letter-spacing: .4px;
  padding: 2px 7px; border-radius: 6px;
  background: var(--rd-accent-tint); color: var(--rd-accent);
  border: 1px solid var(--rd-accent-border);
}

.rd-avatar {
  border-radius: var(--rd-r-md);
  background: var(--rd-accent-tint); color: var(--rd-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--rd-fw-600); flex-shrink: 0;
}
.rd-avatar--sm { width: 38px; height: 38px; font-size: 14px; }
.rd-avatar--md { width: 48px; height: 48px; font-size: 17px; border-radius: var(--rd-r-lg); }
.rd-avatar--lg { width: 62px; height: 62px; font-size: 21px; border-radius: 19px; }
/* solid accent variant (e.g. staff color overrides via inline style) */
.rd-avatar--solid { background: var(--rd-accent); color: var(--rd-on-accent); }

/* ---------------- FEEDBACK ---------------- */
.rd-spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 4px solid var(--rd-track); border-top-color: var(--rd-accent);
  animation: rd-spin .8s linear infinite;
}
.rd-success-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--rd-success-tint);
  display: flex; align-items: center; justify-content: center;
  animation: rd-popIn .4s cubic-bezier(.32,.72,0,1);
}
.rd-toast {
  background: var(--rd-text-1); color: #fff;
  border-radius: var(--rd-r-md); padding: 12px 16px;
  font-size: var(--rd-fs-14); font-weight: var(--rd-fw-500);
}
.rd-toast--success { background: var(--rd-success); }
.rd-toast--error   { background: var(--rd-danger); }

/* ---------------- UTILITIES ---------------- */
.rd-num { font-variant-numeric: tabular-nums; }
.rd-mono { font-family: var(--rd-font-mono); }
.rd-scroll-x { display: flex; gap: var(--rd-s-2); overflow-x: auto; }
.rd-scroll-x::-webkit-scrollbar { display: none; }
