/* ============================================================
   RAPHAEL - 앱 내부 페이지 공통 CSS (app.css)
   ============================================================ */

/* ── 기본 리셋 & 변수 ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary:       #000000;
  --primary-dark:  #3366e0;
  --primary-light: #e8f0fe;
  --accent:        #000000;
  --success:       #333333;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --bg:            #f0f4f8;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --text:          #1e293b;
  --text-2:        #64748b;
  --text-3:        #94a3b8;
  --sidebar-w:     260px;
  --header-h:      64px;
  --radius:        16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.12);
}
body { font-family: 'Noto Sans KR', sans-serif; background: var(--bg); color: var(--text); font-size: 0.95rem; line-height: 1.6; }

/* ── 앱 레이아웃 ─────────────────────────────────────────── */
.app-layout   { display: flex; min-height: 100vh; }
.app-sidebar  { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 200; transition: transform 0.3s; }
.app-main     { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.app-header   { height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 100; }
.app-content  { flex: 1; padding: 32px 28px; }

/* ── 사이드바 ────────────────────────────────────────────── */
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px 22px; border-bottom: 1px solid var(--border); text-decoration: none; }
.sidebar-logo-icon { width: 36px; height: 36px; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-logo-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; display: block; }
.sidebar-logo-text { font-size: 1.1rem; font-weight: 800; color: var(--text); }

.sidebar-nav  { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-section-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); padding: 12px 10px 6px; }
.sidebar-nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text-2); font-weight: 500; font-size: 0.9rem; transition: all 0.2s; position: relative; margin-bottom: 2px; cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.sidebar-nav-item:hover { background: var(--bg); color: var(--text); }
.sidebar-nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.sidebar-nav-item.active .nav-icon { color: var(--primary); }
.nav-icon { width: 20px; text-align: center; font-size: 0.95rem; color: var(--text-3); transition: color 0.2s; }
.nav-badge { margin-left: auto; background: var(--primary); color: white; font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.nav-badge.warning { background: var(--warning); }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background 0.2s; }
.sidebar-user:hover { background: var(--bg); }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: #000000; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 0.88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan  { font-size: 0.75rem; color: var(--text-2); }

/* ── 헤더 ────────────────────────────────────────────────── */
.header-left  { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-btn   { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 0.95rem; transition: all 0.2s; }
.header-btn:hover { background: var(--bg); color: var(--text); }
.btn-new-project { display: flex; align-items: center; gap: 8px; background: var(--primary); color: white; border: none; border-radius: 10px; padding: 8px 18px; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Noto Sans KR', sans-serif; }
.btn-new-project:hover { background: #222222; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.header-hamburger { display: none; }

/* ── 통계 카드 ───────────────────────────────────────────── */
.stat-grid   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card   { background: var(--surface); border-radius: var(--radius); padding: 22px; border: 1px solid var(--border); display: flex; align-items: flex-start; gap: 16px; transition: box-shadow 0.2s; }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon   { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-body   { flex: 1; }
.stat-value  { font-size: 1.7rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 4px; }
.stat-label  { font-size: 0.82rem; color: var(--text-2); margin-bottom: 6px; }
.stat-delta  { font-size: 0.78rem; font-weight: 600; }
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ── 섹션 헤더 ───────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-title  { font-size: 1rem; font-weight: 700; color: var(--text); }
.section-link   { font-size: 0.82rem; color: var(--primary); text-decoration: none; font-weight: 600; }
.section-link:hover { text-decoration: underline; }

/* ── 프로젝트 카드 그리드 ────────────────────────────────── */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.project-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; cursor: pointer; transition: all 0.25s; }
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.project-card-thumb { height: 160px; overflow: hidden; position: relative; }
.project-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.project-card:hover .project-card-thumb img { transform: scale(1.06); }
.project-type-badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.55); backdrop-filter: blur(8px); color: white; font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.project-menu-btn { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; background: rgba(0,0,0,0.55); backdrop-filter: blur(8px); border: none; border-radius: 8px; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; font-size: 0.8rem; }
.project-card:hover .project-menu-btn { opacity: 1; }
.project-card-body { padding: 16px; }
.project-card-name { font-size: 0.92rem; font-weight: 700; color: var(--text); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-card-meta { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--text-2); margin-bottom: 12px; }
.project-card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.project-card-footer { display: flex; align-items: center; justify-content: space-between; }
.project-status { font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.project-status.done { background: #f0fdf4; color: #16a34a; }
.project-status.progress { background: #eff6ff; color: #2563eb; }
.project-status.review { background: #fff7ed; color: #ea580c; }
.project-avatars { display: flex; }
.project-avatars span { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: white; font-size: 0.68rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); margin-left: -6px; }
.project-avatars span:first-child { margin-left: 0; }

/* ── 새 프로젝트 카드 ──────────────────────────────────────── */
.project-card-new { border: 2px dashed var(--border); background: transparent; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; height: 100%; min-height: 248px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s; color: var(--text-3); }
.project-card-new:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.project-card-new i { font-size: 2rem; }
.project-card-new span { font-size: 0.88rem; font-weight: 600; }

/* ── 활동 피드 + 크레딧 패널 ─────────────────────────────── */
.bottom-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.panel { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 22px; }
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 0.88rem; flex-shrink: 0; }
.activity-body { flex: 1; }
.activity-text { font-size: 0.85rem; color: var(--text); margin-bottom: 2px; }
.activity-text strong { font-weight: 700; }
.activity-time { font-size: 0.75rem; color: var(--text-3); }

/* ── 크레딧 패널 ─────────────────────────────────────────── */
.credit-display { text-align: center; margin: 20px 0 24px; }
.credit-ring-wrap { position: relative; width: 120px; height: 120px; margin: 0 auto 12px; }
.credit-ring-wrap svg { transform: rotate(-90deg); }
.credit-ring-bg  { fill: none; stroke: var(--border); stroke-width: 8; }
.credit-ring-fg  { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray 1s ease; }
.credit-ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.credit-num   { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.credit-sub   { font-size: 0.72rem; color: var(--text-2); }
.credit-label { font-size: 0.85rem; color: var(--text-2); }
.credit-bar-wrap { margin-bottom: 16px; }
.credit-bar-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-2); margin-bottom: 6px; }
.credit-bar      { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.credit-bar-fill { height: 100%; background: #000000; border-radius: 4px; transition: width 1s ease; }
.btn-upgrade { display: flex; align-items: center; justify-content: center; gap: 8px; background: #000000; color: white; border: none; border-radius: 12px; padding: 12px; font-size: 0.88rem; font-weight: 700; cursor: pointer; width: 100%; transition: all 0.2s; font-family: 'Noto Sans KR', sans-serif; }
.btn-upgrade:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.plan-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.plan-feat { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--text-2); }
.plan-feat i { color: var(--success); width: 14px; }

/* ── 공지 배너 ───────────────────────────────────────────── */
.notice-banner { background: #000000; border-radius: var(--radius); padding: 20px 24px; margin-bottom: 28px; display: flex; align-items: center; gap: 16px; color: white; }
.notice-icon { width: 44px; height: 44px; background: rgba(255,255,255,0.2); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.notice-body { flex: 1; }
.notice-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 2px; }
.notice-desc  { font-size: 0.82rem; opacity: 0.85; }
.notice-cta   { background: white; color: #000000; border: none; border-radius: 10px; padding: 9px 18px; font-size: 0.82rem; font-weight: 700; cursor: pointer; white-space: nowrap; font-family: 'Noto Sans KR', sans-serif; transition: all 0.2s; }
.notice-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.notice-close { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; font-size: 1rem; padding: 4px; }

/* ── 모바일 사이드바 토글 ─────────────────────────────────── */
@media (max-width: 1024px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .header-hamburger { display: flex; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 199; }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 768px) {
  .stat-grid     { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .project-grid  { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .bottom-grid   { grid-template-columns: 1fr; }
  .app-content   { padding: 16px 14px; }
  .app-header    { padding: 0 16px; }

  /* 헤더 액션 버튼 간소화 */
  .header-actions .btn-text { display: none; }
  .page-title    { font-size: 1.1rem; }

  /* 프로젝트 카드 */
  .project-card-thumb { height: 120px; }
  .project-card-name  { font-size: 0.85rem; }
  .project-card-meta  { font-size: 0.72rem; }

  /* 통계 카드 */
  .stat-card     { padding: 16px; }
  .stat-value    { font-size: 1.6rem; }
  .stat-label    { font-size: 0.78rem; }

  /* 갤러리 그리드 */
  .gallery-grid  { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .gallery-thumb { height: 130px; }
  .gallery-title { font-size: 0.82rem; }
  .gallery-meta  { font-size: 0.72rem; }

  /* 모달 */
  .modal-content { width: 95vw; max-height: 90vh; overflow-y: auto; }
  .modal-body    { flex-direction: column; }
  .modal-img-area { min-height: 200px; }
  .modal-info    { padding: 16px; }

  /* 크레딧 링 */
  .credit-ring-wrap { flex-direction: column; align-items: center; gap: 16px; }
  .credit-bar-wrap  { width: 100%; }

  /* 사이드바 유저 영역 */
  .sidebar-user  { padding: 12px 16px; }
  .sidebar-user-name { font-size: 0.88rem; }
}

@media (max-width: 480px) {
  .stat-grid     { grid-template-columns: 1fr 1fr; gap: 10px; }
  .project-grid  { grid-template-columns: 1fr; }
  .gallery-grid  { grid-template-columns: 1fr; }
  .app-content   { padding: 12px; }

  /* 카드 터치 최적화 */
  .project-card  { border-radius: 12px; }
  .gallery-item  { border-radius: 12px; }

  /* 필터 버튼 스크롤 */
  .filter-bar    { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; padding-bottom: 4px; }
  .filter-btn    { flex-shrink: 0; white-space: nowrap; }

  /* 페이지 헤더 */
  .page-header   { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header .btn { width: 100%; justify-content: center; }
}

/* 모바일 하단 네비게이션 바 */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    z-index: 300;
    padding: 8px 0 env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  }
  .mobile-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 4px 0;
    transition: color 0.2s;
  }
  .mobile-bottom-nav a.active { color: #4f86f7; }
  .mobile-bottom-nav a i { font-size: 1.2rem; }
  /* 하단 네비 높이만큼 콘텐츠 패딩 */
  .app-content { padding-bottom: 80px !important; }
}

.mobile-bottom-nav { display: none; }

