/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #fafafa;
  color: #222;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Pages ── */
.page {
  min-height: 100vh;
}

/* ── Landing Page ── */
.landing-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 120px 24px 80px;
  text-align: center;
}

.landing-icon {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 16px;
  color: #222;
  letter-spacing: -1px;
}

.landing-container h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.landing-desc {
  font-size: 15px;
  color: #888;
  margin-bottom: 40px;
  line-height: 1.6;
}

.primary-btn {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.primary-btn:hover {
  background: #444;
}

.primary-btn:active {
  transform: scale(0.98);
}

.primary-btn.outline {
  background: #fff;
  color: #222;
  border: 1.5px solid #222;
}

.primary-btn.outline:hover {
  background: #f5f5f5;
}

.divider {
  display: flex;
  align-items: center;
  margin: 28px 0;
  color: #ccc;
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.divider span {
  padding: 0 14px;
}

.join-section {
  display: flex;
  gap: 10px;
}

.join-input {
  flex: 1;
  padding: 14px 16px;
  font-size: 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  font-weight: 600;
}

.join-input:focus {
  border-color: #222;
}

.join-section .primary-btn {
  width: auto;
  padding: 14px 24px;
  white-space: nowrap;
}

/* ── Container ── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 24px 80px;
}

/* ── Room Header ── */
.room-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.room-header-top h1 {
  flex: 1;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.back-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.subtitle {
  font-size: 14px;
  color: #888;
  margin-bottom: 12px;
}

.room-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.room-code-badge {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  background: #f0f0f0;
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: 1px;
}

.share-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  background: #fff;
  color: #222;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.share-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.option-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.option-tag {
  font-size: 12px;
  font-weight: 500;
  color: #666;
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  padding: 4px 10px;
  border-radius: 6px;
}

/* ── Input Section ── */
.input-section {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

#nameInput,
#passwordInput {
  flex: 1;
  padding: 14px 16px;
  font-size: 15px;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

#nameInput:focus,
#passwordInput:focus {
  border-color: #222;
}

/* ── Calendar ── */
.calendar-section {
  margin-bottom: 24px;
}

.calendar {
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 16px;
  padding: 20px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: #222;
}

.cal-nav-btn:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #ccc;
}

.cal-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 8px;
}

.weekdays span {
  font-size: 12px;
  font-weight: 600;
  color: #aaa;
  padding: 4px 0;
}

.weekdays span:first-child {
  color: #e74c3c;
}

.weekdays span:last-child {
  color: #3498db;
}

.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  user-select: none;
}

.day:hover {
  background: #f5f5f5;
}

.day.empty {
  cursor: default;
}

.day.empty:hover {
  background: transparent;
}

.day.past {
  color: #ccc;
  cursor: default;
}

.day.past:hover {
  background: transparent;
}

.day.unavailable {
  background: #222;
  color: #fff;
}

.day.unavailable:hover {
  background: #444;
}

.day.sunday {
  color: #e74c3c;
}

.day.sunday.unavailable {
  color: #fff;
}

.day.sunday.past {
  color: #f0c8c4;
}

.day.saturday {
  color: #3498db;
}

.day.saturday.unavailable {
  color: #fff;
}

.day.saturday.past {
  color: #c4ddf0;
}

.day.excluded {
  color: #ddd;
  cursor: default;
  background: #f8f8f8;
  text-decoration: line-through;
}

.day.excluded:hover {
  background: #f8f8f8;
}

.day .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ── Tooltip ── */
.day .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
}

.day .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #222;
}

.day .tooltip.visible {
  display: block;
}

/* ── Buttons ── */
.btn-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.submit-btn {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.submit-btn:hover {
  background: #444;
}

.submit-btn:active {
  transform: scale(0.98);
}

.submit-btn:disabled {
  background: #aaa;
  cursor: default;
}

/* ── Ad Container ── */
.ad-container {
  margin: 24px 0;
  text-align: center;
  min-height: 100px;
}

.cancel-btn {
  flex: 1;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  background: #fff;
  color: #222;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.cancel-btn:hover {
  background: #f5f5f5;
}

/* ── Result Section ── */
.result-section {
  margin-top: 32px;
  display: none;
}

.result-section.show {
  display: block;
}

.result-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Best Dates */
.best-dates {
  margin-bottom: 32px;
}

.best-date-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.best-date-card.rank-1 {
  border-color: #222;
  background: #222;
  color: #fff;
}

.best-date-card .date-text {
  font-size: 15px;
  font-weight: 600;
}

.best-date-card .date-info {
  font-size: 13px;
  color: #888;
}

.best-date-card.rank-1 .date-info {
  color: #bbb;
}

.best-date-card .rank {
  font-size: 20px;
  font-weight: 700;
  margin-right: 16px;
  width: 30px;
  flex-shrink: 0;
}

.best-date-left {
  display: flex;
  align-items: center;
}

.no-date-msg {
  text-align: center;
  padding: 24px;
  color: #888;
  font-size: 14px;
  background: #fff;
  border-radius: 12px;
  border: 1.5px dashed #e0e0e0;
}

/* Participants */
.participants h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #888;
}

.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.participant-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
}

.participant-tag .edit-btn,
.participant-tag .remove-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #eee;
  color: #888;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.participant-tag .edit-btn:hover {
  background: #3498db;
  color: #fff;
}

.participant-tag .remove-btn:hover {
  background: #e74c3c;
  color: #fff;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  padding: 24px;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f5f5f5;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover {
  background: #eee;
  color: #222;
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.form-group .hint {
  font-weight: 400;
  color: #aaa;
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.modal-input:focus {
  border-color: #222;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  padding: 10px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  transition: all 0.2s;
}

.toggle-label:hover {
  border-color: #ccc;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #222;
  cursor: pointer;
}

.toggle-label input[type="checkbox"]:checked + span {
  font-weight: 600;
}

.modal-btn {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-btn.primary {
  background: #222;
  color: #fff;
}

.modal-btn.primary:hover {
  background: #444;
}

.modal-btn.outline {
  background: #fff;
  color: #222;
  border: 1.5px solid #e0e0e0;
}

.modal-btn.outline:hover {
  background: #f5f5f5;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #222;
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  z-index: 2000;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .landing-container {
    padding: 80px 20px 40px;
  }

  .container {
    padding: 16px 16px 60px;
  }

  .input-section {
    flex-direction: column;
  }

  .calendar {
    padding: 16px;
  }

  .room-header-top h1 {
    font-size: 20px;
  }

  .modal {
    margin: 16px;
  }
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #222;
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .container {
    padding: 32px 16px 60px;
  }

  h1 {
    font-size: 24px;
  }

  .day {
    font-size: 13px;
  }
}
