/* =============================================
   CheckNest - Global Styles
   ============================================= */

/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1E293B;
  background-color: #FFFFFF;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px; /* tabbar 높이 */
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* ── 색상 변수 ── */
:root {
  --primary: #0D9488;
  --primary-light: #5EEAD4;
  --primary-bg: #F0FDFA;
  --bg: #FFFFFF;
  --surface: #F8FAFC;
  --text: #1E293B;
  --text-secondary: #64748B;
  --border: #E2E8F0;
  --success: #22C55E;
  --danger: #EF4444;
  --like: #EC4899;
  --warning: #F59E0B;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --max-width: 640px;
}

/* ── 레이아웃 ── */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  padding-top: 60px;
}

/* ── 타이포그래피 ── */
h1 { font-size: 24px; font-weight: 700; line-height: 1.3; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }

/* ── Header ── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-icon {
  border-radius: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: background 0.2s;
  border: none;
  background: none;
}

.header-icon:hover {
  background: var(--surface);
}

/* ── Desktop Navigation ── */
.desktop-nav {
  display: none;
}

/* Language selector */
.lang-selector {
  position: relative;
}

.lang-btn {
  font-size: 18px;
}

.lang-flag {
  font-size: 20px;
  line-height: 1;
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 140px;
  padding: 4px;
  z-index: 200;
}

.lang-dropdown.show {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 4px;
  transition: background 0.15s;
}

.lang-option:hover {
  background: var(--surface);
}

.lang-option.active {
  color: var(--primary);
  font-weight: 600;
}

.header-user-menu {
  position: relative;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: 48px;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  padding: 12px;
  z-index: 200;
}

.user-dropdown.show {
  display: block;
}

.dropdown-name {
  font-weight: 600;
  font-size: 14px;
}

.dropdown-email {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.user-dropdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.user-dropdown a,
.dropdown-logout button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 4px;
  font-size: 14px;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 4px;
}

.user-dropdown a:hover,
.dropdown-logout button:hover {
  background: var(--surface);
}

/* ── Tab Bar ── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0 4px;
  color: var(--text-secondary);
  font-size: 10px;
  transition: color 0.15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.tab-item:active {
  opacity: 0.7;
}

.tab-item .material-icons-outlined {
  font-size: 24px;
  transition: transform 0.15s;
}

.tab-item.active {
  color: var(--primary);
}

.tab-item.active .material-icons-outlined {
  transform: scale(1.1);
}

.tab-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

/* Create button - elevated */
.tab-create {
  position: relative;
}

.tab-create .material-icons-outlined {
  font-size: 36px;
  color: var(--primary);
  margin-top: -8px;
}

.tab-create.active::before {
  display: none;
}

.tab-label {
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* ── Section ── */
.section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 18px;
}

.section-link {
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 2px;
}

.section-link .material-icons-outlined {
  font-size: 16px;
}

/* ── Page Header ── */
.page-header {
  padding: 16px 0 8px;
}

.page-title {
  font-size: 24px;
}

/* ── Footer ── */
.footer {
  padding: 24px 0;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.footer p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── 데스크톱 (768px 이상) ── */
@media (min-width: 768px) {
  .tabbar {
    display: none;
  }

  body {
    padding-bottom: 0;
  }

  .main-content {
    max-width: 720px;
    padding: 72px 24px 0;
  }

  .desktop-nav {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .desktop-nav-link {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
  }

  .desktop-nav-link:hover {
    color: var(--text);
    background: var(--surface);
  }

  .desktop-nav-link.active {
    color: var(--primary);
    font-weight: 600;
  }
}
