/**
 * 성수야! V2 - 메인 스타일
 * 
 * 기본 스타일, 레이아웃, 페이지별 스타일
 * 
 * @package SungsuyaV2
 * @version 2.0.0
 */

/* === 전역 리셋 === */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* === 기본 타이포그래피 === */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: 1.3;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

h1 {
  font-size: var(--text-4xl);
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-primary-dark);
}

/* === 이미지 최적화 === */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* === 앱 전체 레이아웃 === */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-main {
  flex: 1;
  padding-top: var(--safe-area-inset-top);
  padding-bottom: var(--safe-area-inset-bottom);
}

/* === 페이지 공통 레이아웃 === */
.page {
  min-height: calc(100vh - 64px); /* 네비게이션 높이 제외 */
  padding: var(--space-6) 0;
}

.page-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.page-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-4);
}

.page-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* === 홈 페이지 === */
.hero {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: var(--space-20) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(103, 126, 234, 0.1) 0%, transparent 70%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-6);
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

/* === 팝업스토어 목록 === */
.stores-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.store-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}

.store-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.store-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.store-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-muted);
  position: relative;
}

.store-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent 60%, rgba(0,0,0,0.3));
}

.store-content {
  padding: var(--space-6);
}

.store-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.store-description {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-bottom: var(--space-4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.store-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.store-category {
  background: var(--gradient-secondary);
  color: var(--text-inverse);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  text-transform: uppercase;
}

.store-date {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.store-actions {
  display: flex;
  gap: var(--space-3);
}

/* === 투어 플래너 === */
.planner-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: var(--space-8);
  align-items: start;
}

@media (max-width: 1024px) {
  .planner-container {
    grid-template-columns: 1fr;
  }
}

.planner-map {
  height: 600px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.planner-sidebar {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  position: sticky;
  top: calc(64px + var(--space-6)); /* 네비게이션 + 여백 */
}

.planner-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-6);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.selected-stores {
  margin-bottom: var(--space-6);
}

.selected-store {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  cursor: grab;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}

.selected-store:hover {
  background: var(--bg-muted);
  transform: translateX(4px);
}

.selected-store.dragging {
  cursor: grabbing;
  opacity: 0.8;
  transform: rotate(5deg);
}

.store-number {
  width: 28px;
  height: 28px;
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  flex-shrink: 0;
  margin-top: 2px;
}

.selected-store-info {
  flex: 1;
  min-width: 0; /* flex 아이템이 축소될 수 있도록 */
}

.selected-store-name {
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
  line-height: 1.4;
}

.selected-store-type {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.place-type-icon {
  font-size: var(--text-sm);
}

.place-type-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}

.remove-store {
  background: none;
  border: none;
  color: var(--color-error);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: background-color var(--duration-fast) var(--ease-out);
  font-size: var(--text-lg);
  line-height: 1;
  flex-shrink: 0;
}

.remove-store:hover {
  background: rgba(245, 101, 101, 0.1);
}

.planner-summary {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  border: 2px solid var(--bg-muted);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.summary-item:last-child {
  margin-bottom: 0;
  font-weight: var(--font-semibold);
  padding-top: var(--space-3);
  border-top: 1px solid var(--bg-muted);
}

.summary-item span:first-child {
  color: var(--text-secondary);
}

.summary-item span:last-child {
  color: var(--text-primary);
  font-weight: var(--font-medium);
}

/* 빠른 장소 추가 섹션 */
.add-places-section {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-5);
}

.add-places-section h4 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.quick-add-places {
  margin-bottom: var(--space-4);
}

.quick-add-places .btn {
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
}

.quick-add-places .btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Places 카테고리 그리드 (홈페이지) */
.places-categories {
  margin: var(--space-8) 0;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
}

.category-card {
  display: block;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: all var(--duration-normal) var(--ease-out);
  border: 2px solid transparent;
  text-decoration: none;
}

.category-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary);
}

.category-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.category-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.category-description {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* 장소 유형별 배지 스타일 */
.badge-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.badge-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.badge-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.badge-secondary {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
}

/* === 상세 페이지 === */
.store-detail {
  max-width: 800px;
  margin: 0 auto;
}

.store-detail-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.store-detail-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius-2xl);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-xl);
}

.store-detail-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
}

.store-detail-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.store-detail-content {
  background: var(--bg-primary);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-8);
}

.store-detail-description {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--text-secondary);
}

.store-detail-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
}

.info-item {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.info-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

.info-content {
  color: var(--text-secondary);
}

/* === 스켈레톤 로딩 === */
.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-secondary) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  height: 300px;
  border-radius: var(--radius-xl);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

/* === 모바일 최적화 === */
@media (max-width: 768px) {
  .hero-title {
    font-size: var(--text-3xl);
  }
  
  .hero-subtitle {
    font-size: var(--text-lg);
  }
  
  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .stores-grid {
    grid-template-columns: 1fr;
  }
  
  .store-detail-image {
    height: 250px;
  }
  
  .store-detail-title {
    font-size: var(--text-3xl);
  }
  
  .store-detail-meta {
    flex-direction: column;
    gap: var(--space-3);
  }
  
  .store-detail-content {
    padding: var(--space-6);
  }
  
  .info-item {
    padding: var(--space-4);
  }
}

/* === 접근성 개선 === */
@media (prefers-reduced-motion: reduce) {
  .hero::before {
    animation: none;
  }
  
  .skeleton {
    animation: none;
  }
}

/* === 포커스 스타일 === */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* === 프린트 스타일 === */
@media print {
  .nav,
  .hero,
  .planner-sidebar,
  .store-actions,
  .btn {
    display: none !important;
  }
  
  .page {
    padding: 0;
  }
  
  .store-card,
  .store-detail-content {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
