/* =====================================================================
   NEZAPP Demo · Common styles (shared)
   ---------------------------------------------------------------------
   - Minimal reset (Josh Comeau-ish) so demo pages don't inherit browser
     defaults and don't need a full reset.scss.
   - Layout helpers, buttons, chips, cards that biz AND admin demos
     both use.
   - IMPORTANT: applies to .demo-theme-biz and .demo-theme-admin bodies;
     relies on the neutral --demo-* aliases from tokens.css (load that
     file BEFORE this one).
   ===================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

/* HTML hidden 속성을 display:flex/grid 등 컴포넌트 CSS가 덮어쓰는 케이스 방지 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--demo-font-sans);
  font-size: var(--demo-font-base);
  line-height: 1.5;
  background: var(--demo-bg);
  color: var(--demo-text);
  /* iOS Safari: prevent focus zoom (matches real biz behavior) */
  -webkit-text-size-adjust: 100%;
}

img, svg, video, canvas, picture { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* iOS Safari focus-zoom guard (biz pattern) */
input, textarea, select { font-size: 16px; font-family: inherit; }

ul, ol { list-style: none; padding: 0; margin: 0; }

h1, h2, h3, h4, h5, h6, p, figure { margin: 0; }

/* ---------- Accessibility helpers ---------- */
.demo-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ---------- Layout helpers ---------- */
.demo-container {
  width: 100%;
  max-width: 480px;             /* mobile-first biz shell */
  margin: 0 auto;
  padding: 0 var(--demo-content-padding);
}

.demo-container--wide {
  max-width: 1200px;            /* admin / landing */
}

.demo-stack { display: flex; flex-direction: column; gap: var(--demo-space-4); }
.demo-stack--sm { gap: var(--demo-space-2); }
.demo-stack--lg { gap: var(--demo-space-6); }

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

.demo-grid { display: grid; gap: var(--demo-space-3); }
.demo-grid--2 { grid-template-columns: repeat(2, 1fr); }
.demo-grid--3 { grid-template-columns: repeat(3, 1fr); }
.demo-grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) {
  .demo-grid--3, .demo-grid--4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Typography utilities ---------- */
.demo-h1 { font-size: var(--demo-font-3xl); font-weight: var(--demo-weight-bold); color: var(--demo-text-strong); }
.demo-h2 { font-size: var(--demo-font-2xl); font-weight: var(--demo-weight-semibold); color: var(--demo-text-strong); }
.demo-h3 { font-size: var(--demo-font-xl);  font-weight: var(--demo-weight-semibold); color: var(--demo-text-strong); }
.demo-muted   { color: var(--demo-text-muted); }
.demo-subtle  { color: var(--demo-text-subtle); }
.demo-strong  { color: var(--demo-text-strong); font-weight: var(--demo-weight-semibold); }
.demo-accent  { color: var(--demo-primary); }
.demo-center  { text-align: center; }

/* ---------- Buttons ---------- */
.demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--demo-space-2);
  height: 40px;
  padding: 0 var(--demo-space-4);
  border-radius: var(--demo-radius-sm);
  border: 1px solid var(--demo-border);
  background: var(--demo-surface);
  color: var(--demo-text);
  font-size: var(--demo-font-base);
  font-weight: var(--demo-weight-medium);
  transition: background var(--demo-transition-fast),
              border-color var(--demo-transition-fast),
              color var(--demo-transition-fast),
              transform var(--demo-transition-fast);
  white-space: nowrap;
}
.demo-btn:hover { background: var(--demo-surface-alt); }
.demo-btn:active { transform: translateY(1px); }
.demo-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.demo-btn--primary {
  background: var(--demo-primary);
  border-color: var(--demo-primary);
  color: #fff;
}
.demo-btn--primary:hover { background: var(--demo-primary-dark); border-color: var(--demo-primary-dark); }

.demo-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--demo-text-muted);
}
.demo-btn--ghost:hover { color: var(--demo-primary); background: var(--demo-primary-50); }

.demo-btn--sm { height: 32px; padding: 0 var(--demo-space-3); font-size: var(--demo-font-sm); }
.demo-btn--lg { height: 48px; padding: 0 var(--demo-space-5); font-size: var(--demo-font-lg); }
.demo-btn--full { width: 100%; }

/* ---------- Inputs ---------- */
.demo-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--demo-space-3);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-sm);
  background: var(--demo-surface);
  color: var(--demo-text);
  transition: border-color var(--demo-transition-fast);
}
.demo-input:focus { outline: none; border-color: var(--demo-primary); }
.demo-input::placeholder { color: var(--demo-text-subtle); }

/* ---------- Cards ---------- */
.demo-card {
  background: var(--demo-surface);
  border: 1px solid var(--demo-border);
  border-radius: var(--demo-radius-md);
  padding: var(--demo-space-4);
  transition: box-shadow var(--demo-transition-fast),
              transform var(--demo-transition-fast);
}
.demo-card--elevated { box-shadow: var(--demo-shadow-md); border-color: transparent; }
.demo-card--interactive { cursor: pointer; }
.demo-card--interactive:hover { box-shadow: var(--demo-shadow-md); transform: translateY(-1px); }

.demo-card__title { font-size: var(--demo-font-lg); font-weight: var(--demo-weight-semibold); color: var(--demo-text-strong); }
.demo-card__meta  { font-size: var(--demo-font-sm); color: var(--demo-text-muted); margin-top: var(--demo-space-1); }
.demo-card__body  { margin-top: var(--demo-space-2); color: var(--demo-text); }

/* ---------- Chips / Pills ---------- */
.demo-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--demo-space-1);
  padding: 4px 10px;
  border-radius: var(--demo-radius-full);
  background: var(--demo-surface-alt);
  color: var(--demo-text-muted);
  font-size: var(--demo-font-xs);
  font-weight: var(--demo-weight-medium);
  border: 1px solid var(--demo-border-subtle);
}
.demo-chip--primary { background: var(--demo-primary-50); color: var(--demo-primary); border-color: transparent; }
.demo-chip--success { background: rgba(16,185,129,0.12); color: var(--demo-success); border-color: transparent; }
.demo-chip--warning { background: rgba(245,158,11,0.15); color: var(--demo-warning); border-color: transparent; }
.demo-chip--danger  { background: rgba(239,68,68,0.12);  color: var(--demo-danger);  border-color: transparent; }

/* ---------- Badges ---------- */
.demo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--demo-radius-full);
  background: var(--demo-danger);
  color: #fff;
  font-size: 10px;
  font-weight: var(--demo-weight-bold);
}

/* ---------- Divider ---------- */
.demo-divider {
  height: 1px;
  background: var(--demo-border);
  margin: var(--demo-space-4) 0;
  border: 0;
}

/* ---------- Toast ---------- */
.demo-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(120%);
  z-index: var(--demo-z-toast);
  padding: var(--demo-space-3) var(--demo-space-5);
  background: var(--demo-text-strong);
  color: #fff;
  border-radius: var(--demo-radius-full);
  font-size: var(--demo-font-sm);
  box-shadow: var(--demo-shadow-lg);
  opacity: 0;
  transition: transform var(--demo-transition), opacity var(--demo-transition);
  pointer-events: none;
}
.demo-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- Modal ---------- */
.demo-modal {
  position: fixed; inset: 0;
  z-index: var(--demo-z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--demo-space-4);
  background: rgba(0, 0, 0, 0.45);
}
.demo-modal.is-open { display: flex; }
.demo-modal__panel {
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 64px);
  overflow: auto;
  background: var(--demo-surface);
  color: var(--demo-text);
  border-radius: var(--demo-radius-lg);
  box-shadow: var(--demo-shadow-xl);
  padding: var(--demo-space-5);
}

/* ---------- Skeleton (for loading states) ---------- */
.demo-skeleton {
  background: linear-gradient(
    90deg,
    var(--demo-surface-alt) 0%,
    var(--demo-border-subtle) 50%,
    var(--demo-surface-alt) 100%
  );
  background-size: 200% 100%;
  animation: demo-skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: var(--demo-radius-xs);
}
@keyframes demo-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Focus ring ---------- */
:focus-visible {
  outline: 2px solid var(--demo-primary);
  outline-offset: 2px;
  border-radius: inherit;
}

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============================================================
   데모 제한 안내 모달 (biz + admin 공용)
   ============================================================= */
.demo-notice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: demoNoticeFade 0.15s ease-out;
}
@keyframes demoNoticeFade { from { opacity: 0; } to { opacity: 1; } }

.demo-notice-modal {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: demoNoticePop 0.2s ease-out;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #111827;
}
@keyframes demoNoticePop {
  from { transform: translateY(8px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0)   scale(1);    opacity: 1; }
}

.demo-notice-modal__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #EFF6FF;
  color: #3B82F6;
  margin: 0 auto 14px;
}
.demo-notice-modal__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
  color: #111827;
}
.demo-notice-modal__feature {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #F3F4F6;
  color: #374151;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin: 4px 0 10px;
}
.demo-notice-modal__desc {
  font-size: 14px;
  line-height: 1.6;
  color: #4B5563;
  margin: 4px 0 22px;
}
.demo-notice-modal__desc b { color: #111827; font-weight: 700; }

.demo-notice-modal__close {
  width: 100%;
  padding: 12px;
  background: #111827;
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.demo-notice-modal__close:hover { background: #000; }
.demo-notice-modal__close:active { transform: translateY(1px); }
