/* ============================================================
   가계부 — Custom Styles
   Tailwind handles utility classes; this file handles
   keyframes, CSS variables, and structural layout only.
   ============================================================ */

/* ── Pretendard font family ──────────────────────────────── */
:root {
  --font-sans: 'Pretendard Variable', Pretendard, -apple-system,
    BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR',
    sans-serif;
  --color-teal: #008080;
  --color-teal-dark: #006666;
  --color-bg: #F0F0F0;
  --app-max-width: 430px;
  --header-height: 64px;
  --tabbar-height: 64px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
}

.font-pretendard {
  font-family: var(--font-sans);
}

/* ── App shell (phone frame) ─────────────────────────────── */
.app-shell {
  width: 100%;
  max-width: var(--app-max-width);
  height: 100dvh;
  height: 100vh; /* fallback */
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
}

/* ── Header ──────────────────────────────────────────────── */
.app-header {
  flex-shrink: 0;
  height: var(--header-height);
  display: flex;
  align-items: flex-end;
}

/* ── Scrollable content area ─────────────────────────────── */
.app-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── Bottom tab bar ──────────────────────────────────────── */
.app-tab-bar {
  flex-shrink: 0;
  height: var(--tabbar-height);
}

/* ── Calendar cell ───────────────────────────────────────── */
.calendar-cell {
  min-height: 52px;
}

/* ── Modal bottom sheet ──────────────────────────────────── */
.modal-sheet {
  max-height: 90vh;
}

/* ── Expense item entry animation ────────────────────────── */
.expense-item {
  animation: slideUp 0.2s ease-out both;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Tab transition ──────────────────────────────────────── */
.tab-enter {
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

/* ── Spinner ─────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spin 0.8s linear infinite;
}

/* ── Scrollbar (desktop preview) ────────────────────────── */
.app-content::-webkit-scrollbar {
  width: 0;
}

/* ── Focus ring override ─────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-teal);
  outline-offset: 2px;
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .expense-item,
  .tab-enter,
  .animate-spin {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Safe area for notch phones ──────────────────────────── */
.pt-safe-top {
  padding-top: max(12px, env(safe-area-inset-top));
}
