/* style.css - 스마트폰 모바일 최적화 깔끔한 UI */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: #1e293b;
    --primary-border: #334155;
    --bg-main: #0b0f17;
    --bg-card: #161e2e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #263244;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard Variable", Pretendard, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
  padding-bottom: env(safe-area-inset-bottom, 24px);
}

.app-container {
  max-width: 580px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 헤더 */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 28px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.icon-button {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.icon-button:hover, .icon-button:active {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* API 안내 배너 */
.banner {
  background-color: #fefce8;
  border-bottom: 1px solid #fef08a;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #854d0e;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.banner-content p {
  color: #a16207;
  font-size: 12px;
}

.banner-icon {
  font-size: 22px;
}

/* 메인 컨텐츠 영역 */
.main-content {
  padding: 20px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* 모바일 빠른 선택 액션 그리드 */
.mobile-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 8px;
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  user-select: none;
}

.action-card:active {
  transform: scale(0.97);
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.action-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.action-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* 드래그 & 드롭 영역 */
.drop-zone {
  border: 2px dashed var(--border-color);
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.drop-text {
  font-size: 14px;
  margin-bottom: 4px;
  font-weight: 500;
}

.file-support-tag {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.8;
}

/* 미리보기 영역 */
.file-preview-area {
  margin-top: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-info-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}

.thumbnail-wrapper {
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 220px;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail-wrapper img {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
}

/* 샘플 링크 버튼 */
.sample-try-area {
  text-align: center;
  margin-top: 8px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px;
}

/* 버튼 스타일 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 42px;
  padding: 0 16px;
  font-size: 14px;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-lg {
  min-height: 52px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:active {
  background-color: var(--primary-hover);
  transform: scale(0.98);
}

.btn-success {
  background-color: var(--success);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.btn-secondary {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-text-danger {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}

/* 로딩 스피너 섹션 */
.loading-section {
  text-align: center;
  padding: 40px 20px;
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.loading-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* 결과 섹션 */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.events-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 개별 일정 카드 */
.event-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-index-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background-color: var(--primary-light);
  padding: 3px 8px;
  border-radius: 12px;
}

.btn-delete-card {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-main);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--primary);
}

textarea.form-control {
  min-height: 60px;
  resize: vertical;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.btn-add-gcal {
  background-color: #0284c7;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  min-height: 48px;
}

.btn-add-gcal:active {
  background-color: #0369a1;
}

.btn-sub-action {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-align: center;
  padding: 4px;
}

.btn-sub-action:hover {
  color: var(--primary);
}

/* 도움말 안내 상자 */
.help-box {
  background-color: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}

/* 모달 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  background-color: var(--bg-card);
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.label-badge {
  font-size: 10px;
  background-color: #fee2e2;
  color: #ef4444;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.help-text {
  font-size: 12px;
  color: var(--text-muted);
}

.guide-box {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-main);
}

/* 토스트 알림 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1e293b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 100;
  transition: opacity 0.3s ease;
}

/* 유틸리티 */
.hidden {
  display: none !important;
}
