/**
 * 서툰어른연합 - 감성적이고 따뜻한 웜 베이지 & 어스 테마 디자인 시스템 (style.css v3.0)
 */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  /* 따뜻한 웜 베이지 / 테라코타 / 어스 팔레트 */
  --bg-app: #fcfaf7;
  --bg-subtle: #f5f0e8;
  --bg-card: #ffffff;
  --bg-card-glass: rgba(255, 255, 255, 0.85);
  
  --primary: #c25e38;          /* 따뜻한 테라코타 브라운 */
  --primary-hover: #a84824;
  --primary-light: #faece7;
  --primary-focus: rgba(194, 94, 56, 0.2);

  --secondary: #635e59;
  --secondary-hover: #4d4843;
  --secondary-light: #eee9e0;

  --accent-amber: #d97706;     /* 앰버 골드 */
  --accent-amber-light: #fef3c7;
  --accent-olive: #65a30d;     /* 올리브 그린 */
  --accent-sage: #059669;      /* 세이지 그린 */
  --accent-sage-light: #ecfdf5;

  --text-main: #292524;        /* 딥 에스프레소 */
  --text-muted: #78716c;       /* 웜 챠콜 */
  --text-subtle: #a8a29e;

  --border-color: #e7e0d5;     /* 샌드 베이지 보더 */
  --border-focus: #c25e38;

  --success: #15803d;
  --success-bg: #f0fdf4;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warning: #b45309;
  --warning-bg: #fffbeb;

  /* 부드러운 라운딩 & 웜 섀도우 */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 6px rgba(120, 100, 80, 0.04);
  --shadow-md: 0 6px 18px rgba(120, 100, 80, 0.07);
  --shadow-lg: 0 14px 32px rgba(120, 100, 80, 0.1);
  --shadow-warm-glow: 0 10px 28px rgba(194, 94, 56, 0.16);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --------------------------------------------------------------------------
   기본 리셋 & 폰트 세팅
-------------------------------------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  min-height: 100vh;
  font-size: 0.94rem;
  background-image: 
    radial-gradient(at 0% 0%, rgba(245, 235, 224, 0.7) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(250, 236, 231, 0.6) 0px, transparent 50%);
  background-attachment: fixed;
}

input, button, select, textarea, table, th, td {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif !important;
  font-size: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* --------------------------------------------------------------------------
   레이아웃 프레임워크
-------------------------------------------------------------------------- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 글로벌 상단 헤더 */
.app-header {
  background: rgba(253, 251, 247, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all var(--transition-fast);
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

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

.nav-link {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--bg-subtle);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.user-badge:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.user-rank {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.logout-btn {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* 메인 바디 래퍼 */
.main-wrapper {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 48px;
  display: flex;
  gap: 28px;
  flex: 1;
}

.main-content {
  flex: 1;
  min-width: 0;
  animation: fadeIn 0.35s ease-out;
}

/* 사이드바 */
.app-sidebar {
  width: 220px;
  flex-shrink: 0;
}

.sidebar-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.sidebar-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 8px 12px 10px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  text-decoration: none;
  background: transparent;
}

.sidebar-link:hover {
  color: var(--primary);
  background: var(--bg-subtle);
  transform: translateX(3px);
}

.sidebar-link.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   달력 (Calendar Grid) 컴포넌트
-------------------------------------------------------------------------- */
.cal-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.cal-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 12px 0;
  color: var(--text-muted);
}

.cal-header .sun { color: var(--danger); }
.cal-header .sat { color: #2563eb; }

.cal-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--border-color);
  gap: 1px;
}

.cal-day {
  background: #ffffff;
  min-height: 110px;
  min-width: 0;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
  transition: background-color var(--transition-fast);
}

.cal-day:hover {
  background-color: rgba(245, 240, 232, 0.4);
}

.cal-day.empty {
  background: #faf8f5;
}

.cal-day-num {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.cal-day.sun .cal-day-num { color: var(--danger); }
.cal-day.sat .cal-day-num { color: #2563eb; }

.cal-day.today {
  background: #fffbeb;
}

.cal-day.today .cal-day-num {
  display: inline-flex;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}

.cal-event-badge {
  font-size: 0.74rem;
  padding: 4px 6px;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  text-decoration: none;
  transition: transform var(--transition-fast);
  box-sizing: border-box;
}

.cal-event-badge:hover {
  transform: translateY(-1px);
}

.cal-event-birthday {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.cal-event-meetup {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(194, 94, 56, 0.25);
}

/* --------------------------------------------------------------------------
   카드 & 컴포넌트
-------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: all var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 통계 카드 그리드 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #d8cebf;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.stat-icon.terracotta { background: var(--primary-light); color: var(--primary); }
.stat-icon.amber { background: var(--accent-amber-light); color: var(--accent-amber); }
.stat-icon.sage { background: var(--accent-sage-light); color: var(--accent-sage); }
.stat-icon.sand { background: var(--bg-subtle); color: var(--text-muted); }

.stat-label {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
  letter-spacing: -0.5px;
}

/* --------------------------------------------------------------------------
   버튼 시스템
-------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  outline: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(194, 94, 56, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-warm-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.82rem;
  border-radius: var(--radius-xs);
}

.btn-block {
  width: 100%;
}

/* --------------------------------------------------------------------------
   폼 & 인풋 컴포넌트
-------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-main);
  font-size: 0.94rem;
  font-family: inherit;
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.form-control-sm {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-col {
  flex: 1;
}

/* --------------------------------------------------------------------------
   테이블 & 상태 뱃지
-------------------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
  background-color: rgba(245, 240, 232, 0.5);
}

/* 상태 뱃지 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

/* O / X 심플 텍스트 표기 (테두리 및 배경 원형 제거, O는 얇고 부드럽게) */
.badge-status-o {
  color: #059669;
  font-size: 1.05rem;
  font-weight: 500;
  display: inline-block;
  line-height: 1;
  font-family: inherit;
  opacity: 0.85;
}

.badge-status-x {
  color: #dc2626;
  font-size: 1.05rem;
  font-weight: 800;
  display: inline-block;
  line-height: 1;
  font-family: inherit;
}

/* 미납자 행 연한 레드 배경 */
.row-unpaid {
  background-color: rgba(254, 242, 242, 0.75) !important;
}

.row-unpaid:hover {
  background-color: rgba(254, 226, 226, 0.9) !important;
}

.badge-paid {
  background: var(--accent-sage-light);
  color: var(--accent-sage);
}

.badge-unpaid {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-prepaid {
  background: var(--accent-amber-light);
  color: var(--accent-amber);
}

.badge-attend {
  background: #eff6ff;
  color: #1d4ed8;
}

.badge-absent {
  background: #fdf2f8;
  color: #db2777;
}

/* --------------------------------------------------------------------------
   알림 메시지 (Floating Toast Modal - 화면 흔들림 제로)
-------------------------------------------------------------------------- */
.floating-toast {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  font-size: 0.94rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toastSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.35s ease, transform 0.35s ease;
  max-width: 90vw;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -30px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.toast-success {
  background: rgba(240, 253, 244, 0.96);
  color: #166534;
  border-color: #bbf7d0;
}

.toast-error {
  background: rgba(254, 242, 242, 0.96);
  color: #991b1b;
  border-color: #fecaca;
}

.toast-info {
  background: rgba(239, 246, 255, 0.96);
  color: #1e40af;
  border-color: #bfdbfe;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0 4px;
  line-height: 1;
}
.toast-close:hover {
  opacity: 1;
}

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* --------------------------------------------------------------------------
   갤러리 & 포토 그리드
-------------------------------------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.gallery-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: #f5f0e8;
}

.gallery-info {
  padding: 14px 16px;
}

.gallery-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.gallery-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   푸터
-------------------------------------------------------------------------- */
.app-footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  padding: 32px 20px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: auto;
}

.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   애니메이션 & 트랜지션
-------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseWarm {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* --------------------------------------------------------------------------
   반응형 (Mobile)
-------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .main-wrapper {
    flex-direction: column;
    padding: 18px 14px 36px;
    gap: 20px;
  }
  .app-sidebar {
    width: 100%;
  }
  .sidebar-menu {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding: 8px;
    white-space: nowrap;
  }
  .sidebar-title {
    display: none;
  }
  .sidebar-link {
    margin-bottom: 0;
    font-size: 0.86rem;
    padding: 8px 12px;
  }
  .header-nav {
    display: none; /* 모바일 메뉴 토글 연동 */
  }
}
