/* ===== Login Modal ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(45,27,78,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: authFadeIn 0.25s ease-out;
}
.auth-overlay.open { display: flex; }

@keyframes authFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-modal {
  position: relative;
  width: 90%;
  max-width: 380px;
  padding: 40px 28px 32px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(45,27,78,0.4);
  text-align: center;
  animation: authSlideUp 0.3s ease-out;
}
@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}
.auth-close:hover { background: rgba(167,139,250,0.1); color: var(--text-primary); }

.auth-logo { width: 80px; height: auto; border-radius: 0; margin-bottom: 16px; }

.auth-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.auth-buttons { display: flex; flex-direction: column; gap: 12px; }

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.auth-btn-google {
  background: #fff;
  color: #222;
}
.auth-btn-google:hover { background: #f0f0f0; box-shadow: 0 2px 12px rgba(255,255,255,0.15); }

.auth-btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }

.auth-btn-kakao {
  background: #FEE500;
  color: #191919;
}
.auth-btn-kakao:hover { background: #f0d900; box-shadow: 0 2px 12px rgba(254,229,0,0.2); }

.auth-btn-kakao svg { width: 18px; height: 18px; flex-shrink: 0; }

.auth-btn-naver {
  background: #03C75A !important;
  color: #fff !important;
}
.auth-btn-naver:hover { background: #02b351 !important; box-shadow: 0 2px 12px rgba(3,199,90,0.2); }

.auth-btn-naver svg { width: 18px; height: 18px; flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-terms {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.auth-terms a { color: var(--text-accent); text-decoration: underline; }

/* ===== Mobile Header Profile ===== */
.mobile-header-profile {
  display: none;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}
.mobile-h-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.mobile-h-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-500), var(--purple-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.coin-badge-mobile {
  font-size: 12px;
  font-weight: 700;
  color: #F59E0B;
}
@media (min-width: 768px) {
  .mobile-header-profile { display: none !important; }
}

/* ===== User Profile (logged in state) ===== */
.user-profile-wrap {
  position: relative;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--border-glass);
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: none;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
}
.user-profile-btn:hover { border-color: rgba(167,139,250,0.4); background: rgba(167,139,250,0.08); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-glass);
}
.user-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-500), var(--purple-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  padding: 8px;
  background: rgba(255,245,250,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(45,27,78,0.4);
  display: none;
  z-index: 60;
}
.user-dropdown.open { display: block; }

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.user-dropdown-item:hover { color: var(--text-primary); background: rgba(167,139,250,0.1); }
.user-dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Mobile logged-in state */
.mobile-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.mobile-user-info .user-avatar,
.mobile-user-info .user-avatar-placeholder { width: 32px; height: 32px; }
.mobile-user-name { font-size: 14px; font-weight: 500; }

/* ===== Coin Badge (Header) ===== */
.coin-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  cursor: pointer;
}
.coin-badge-icon {
  width: 18px;
  height: 18px;
}
#coin-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #F59E0B;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-full);
}

/* ===== Coin Modal (부족 알림) ===== */
.coin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45,27,78,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: authFadeIn 0.25s ease-out;
}
.coin-modal {
  width: 90%;
  max-width: 340px;
  padding: 32px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(45,27,78,0.4);
  text-align: center;
  animation: authSlideUp 0.3s ease-out;
}
.coin-modal h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.coin-modal p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.6;
}
.coin-modal-balance {
  margin-bottom: 20px !important;
  color: #F59E0B !important;
}
.coin-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.coin-modal-actions button {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
}

/* ===== Coin cost tag (서비스 버튼) ===== */
.coin-cost-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #F59E0B;
  font-weight: 600;
}

/* ===== Profile Registration Modal ===== */
.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(45,27,78,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: authFadeIn 0.25s ease-out;
}
.profile-overlay.open { display: flex; }

.profile-modal {
  position: relative;
  width: 90%;
  max-width: 400px;
  padding: 36px 28px 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(45,27,78,0.4);
  animation: authSlideUp 0.3s ease-out;
}

.profile-modal-header {
  text-align: center;
  margin-bottom: 24px;
}
.profile-modal-header h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.profile-modal-header p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.profile-field {
  margin-bottom: 16px;
}
.profile-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.profile-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.6);
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.profile-input:focus {
  outline: none;
  border-color: var(--violet-500);
  box-shadow: 0 0 0 3px rgba(167,139,250,0.15);
}

.profile-radio-group {
  display: flex;
  gap: 8px;
}
.profile-radio-option {
  flex: 1;
  position: relative;
}
.profile-radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.profile-radio-option .profile-radio-label {
  display: block;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255,255,255,0.4);
  color: var(--text-secondary);
}
.profile-radio-option input[type="radio"]:checked + .profile-radio-label {
  background: rgba(167,139,250,0.15);
  border-color: var(--violet-500);
  color: var(--text-accent);
}

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.profile-actions button {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}
.profile-skip-btn {
  background: none;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}
.profile-skip-btn:hover {
  border-color: rgba(167,139,250,0.4);
  background: rgba(167,139,250,0.05);
}
.profile-save-btn {
  background: linear-gradient(135deg, var(--violet-500), var(--violet-600), var(--purple-500));
  border: none;
  color: white;
  box-shadow: 0 4px 20px rgba(167,139,250,0.3);
}
.profile-save-btn:hover {
  box-shadow: 0 8px 32px rgba(167,139,250,0.4);
  transform: translateY(-1px);
}

/* ===== Responsive ===== */
@media (max-width: 400px) {
  .auth-modal { padding: 32px 20px 24px; }
  .auth-btn { padding: 12px 14px; font-size: 13px; }
  .profile-modal { padding: 28px 20px 24px; }
}
