* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

header {
  background: #1a73e8;
  padding: 12px 24px;
  text-align: center;
}

header .logo {
  color: white;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.container {
  width: 100%;
}

h1 {
  font-size: 24px;
  margin-bottom: 20px;
  color: #1a1a1a;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
  color: #1a1a1a;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #555;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.radio-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
  color: #555;
}

.radio-label input[type="radio"] {
  width: auto;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
}

.btn-primary {
  background: #1a73e8;
  color: white;
}

.btn-primary:hover {
  background: #1557b0;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  background: #e8e8e8;
  color: #555;
}

.btn-sm:hover {
  background: #1a73e8;
  color: white;
}

.btn-secondary {
  background: #e8e8e8;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.share-link {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.share-link .btn {
  white-space: nowrap;
}

.share-link input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #f9f9f9;
}

.hint {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
}

/* Login bar - single line */
.login-bar {
  padding: 12px 24px;
}

.login-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.login-inline input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  min-width: 0;
}

.login-inline input[type="text"],
.login-inline .name-input-wrap {
  flex: 3;
}

.login-inline input[type="password"] {
  flex: 2;
}

.login-inline input:focus {
  outline: none;
  border-color: #1a73e8;
}

.login-inline .btn {
  padding: 8px 20px;
  white-space: nowrap;
}

.name-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  position: relative;
}

.name-input-wrap input {
  flex: 1;
  padding-right: 32px !important;
}

.reroll-btn {
  position: absolute;
  right: 4px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #888;
  padding: 4px;
  line-height: 1;
}

.reroll-btn:hover {
  color: #1a73e8;
}

.login-bar .hint {
  margin-top: 4px;
  margin-bottom: 0;
}

/* Members bar - inline tags */
.members-bar {
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
}

.member-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.member-tag {
  background: #e3f2fd;
  color: #1a73e8;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}

.member-tag.clickable {
  cursor: pointer;
}

.member-tag.clickable:hover {
  background: #1a73e8;
  color: white;
}

/* Meeting header */
.meeting-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.meeting-header h1 {
  margin-bottom: 0;
}

.meeting-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meeting-info {
  color: #666;
  font-size: 14px;
}

/* Date edit bar */
.date-edit-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.date-edit-bar input[type="date"],
.date-edit-bar select {
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}

.date-edit-bar span {
  font-size: 13px;
  color: #888;
}

@media (max-width: 600px) {
  .date-edit-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 6px;
  }

  .date-edit-bar .btn {
    grid-column: span 1;
  }
}

/* Calendar legend */
.calendar-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}

.calendar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.status-ok {
  color: #4caf50;
  font-weight: 600;
}

.status-err {
  color: #f44336;
  font-weight: 600;
}

/* Detail time button in month view */
.detail-time-btn {
  display: block;
  margin: 2px auto 4px;
  padding: 2px 8px;
  font-size: 11px;
  background: #e8e8e8;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
}

.detail-time-btn:hover {
  background: #1a73e8;
  color: white;
}

/* Results heatmap */
.heatmap-wrapper {
  overflow-x: auto;
}

.heatmap {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.heatmap th {
  padding: 8px 4px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: #555;
  border-bottom: 2px solid #ddd;
  min-width: 60px;
}

.heatmap .time-label {
  font-weight: 600;
  color: #555;
  padding: 4px 8px;
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}

.heat-cell {
  text-align: center;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  cursor: default;
  min-height: 28px;
  position: relative;
}

.heat-cell:hover {
  outline: 2px solid #333;
  z-index: 1;
}

.unavail-count {
  font-size: 11px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.6);
}

.best-slot {
  background: #e8f5e9;
  border: 1px solid #4caf50;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
}

.legend {
  display: flex;
  gap: 20px;
  font-size: 13px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-block;
}

/* FullCalendar overrides */
.fc {
  font-size: 13px;
}

.fc .fc-col-header-cell-cushion {
  font-size: 13px;
}

.fc .fc-timegrid-slot {
  height: 28px;
}

.fc-event {
  border: none !important;
  border-radius: 3px !important;
  cursor: pointer;
  pointer-events: none;
}

/* 개별 클릭 삭제는 eventClick 대신 커스텀으로 처리 */

/* Month view day cell */
.fc .fc-daygrid-day-frame {
  min-height: 70px;
}

/* 범위 밖 / 다른 달 날짜 흐리게 */
.fc .fc-day-other {
  opacity: 0.4;
}

.fc .fc-day-disabled {
  opacity: 0.25;
  background: #f0f0f0;
}

/* Heatmap tooltip */
.heat-tip {
  display: none;
  position: absolute;
  background: #333;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Footer */
footer {
  text-align: center;
  padding: 24px 16px 16px;
  margin-top: 32px;
}

.footer-warn {
  font-size: 11px;
  color: #999;
  margin-bottom: 4px;
}

.footer-copy {
  font-size: 11px;
  color: #bbb;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .meeting-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .login-inline {
    flex-wrap: wrap;
  }

  .heatmap th {
    min-width: 45px;
    font-size: 11px;
  }
}
