/**
 * 잠깐정산 - 영수증 감성 스타일시트
 * 종이 영수증 느낌의 UI 디자인
 */

/* 전역 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Courier New', monospace; /* 영수증 느낌의 폰트 */
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
  padding: 20px;
}

.container {
  max-width: 400px;
  margin: 0 auto;
  background-color: #fff;
  padding: 30px 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border-top: 3px dashed #333;
  border-bottom: 3px dashed #333;
}

/* 헤더 */
.header {
  text-align: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.header h1 {
  font-size: 28px;
  margin-bottom: 5px;
}

.header .room-id-small {
  font-size: 10px;
  color: #999;
  margin-top: -3px;
  margin-bottom: 8px;
}

.header p {
  font-size: 14px;
  color: #666;
}

/* 영수증 헤더 */
.receipt-header {
  text-align: center;
  border-bottom: 1px dashed #333;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.receipt-header h1 {
  font-size: 18px;
  margin-bottom: 5px;
  letter-spacing: 1px;
}

.receipt-header .room-id {
  font-size: 10px;
  color: #999;
  margin-top: -3px;
  margin-bottom: 8px;
}

.receipt-header p {
  font-size: 12px;
  color: #666;
}

.receipt-header .completed {
  color: #27ae60;
  font-weight: bold;
  margin-top: 5px;
}

/* 방 생성 폼 */
.create-room-form {
  margin-top: 20px;
}

.create-room-form h2 {
  font-size: 18px;
  margin-bottom: 15px;
  text-align: center;
}

.create-room-form input,
.create-room-form select {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  background-color: #fafafa;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.create-room-form input:focus,
.create-room-form select:focus {
  outline: none;
  border-color: #333;
  background-color: #fff;
}

.create-room-form label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: #666;
}

/* 버튼 */
.btn-primary,
.btn-secondary,
.btn-share {
  width: 100%;
  padding: 12px;
  border: none;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background-color: #333;
  color: #fff;
  margin-top: 10px;
}

.btn-primary:hover {
  background-color: #555;
}

.btn-secondary {
  background-color: #f0f0f0;
  color: #333;
  border: 1px dashed #999;
  margin-top: 15px;
}

.btn-secondary:hover {
  background-color: #e0e0e0;
}

.btn-secondary:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  border-color: #ddd;
}

.btn-share {
  background-color: #3498db;
  color: #fff;
  margin-top: 0;
}

.btn-share:hover {
  background-color: #2980b9;
}

/* 항목 섹션 */
.items-section {
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ddd;
}

.items-section h2 {
  font-size: 16px;
  margin: 0;
}

.sort-select {
  padding: 5px 10px;
  border: 1px solid #ddd;
  background-color: #fafafa;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  cursor: pointer;
}

.sort-select:focus {
  outline: none;
  border-color: #333;
  background-color: #fff;
}

#itemsList {
  margin-bottom: 15px;
}

.item {
  padding: 12px 0;
  border-bottom: 1px dotted #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.item:last-child {
  border-bottom: none;
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-row1 {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 3px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.item-name {
  flex: 1;
  text-align: left;
}

.item-amount {
  text-align: right;
  margin-left: 10px;
}

.item-row2 {
  font-size: 12px;
  color: #666;
  text-align: right;
}

.btn-delete {
  background-color: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  transition: background-color 0.2s;
}

.btn-delete:hover {
  background-color: #c0392b;
}

.btn-delete:active {
  transform: scale(0.95);
}

.empty {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 20px 0;
}

/* 사람별 그룹 */
.person-group {
  margin-bottom: 20px;
}

.person-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  background-color: #f8f8f8;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  margin-bottom: 5px;
}

.person-name {
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

.person-total {
  font-size: 14px;
  font-weight: bold;
  color: #e74c3c;
}

.person-group .item {
  padding-left: 10px;
  padding-right: 0;
  border-left: 3px solid #f0f0f0;
}

/* 차트 섹션 */
.chart-section {
  margin-bottom: 30px;
  padding: 20px 0;
  border-top: 1px dashed #333;
}

.chart-section h2 {
  font-size: 16px;
  margin-bottom: 15px;
  text-align: center;
}

#expenseChart {
  display: block;
  margin: 0 auto;
  width: 350px;
  height: 250px;
  max-width: 100%;
}

.legend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px dotted #eee;
}

.legend-item:last-child {
  border-bottom: none;
}

.legend-label {
  font-weight: bold;
  flex: 1;
}

.legend-value {
  color: #e74c3c;
  font-size: 11px;
  text-align: right;
  margin-left: 10px;
}

/* 정산 완료 안내 */
.completed-notice {
  text-align: center;
  padding: 20px;
  background-color: #e8f5e9;
  border: 2px solid #4caf50;
  border-radius: 5px;
  margin-bottom: 20px;
}

.completed-notice h3 {
  font-size: 16px;
  color: #2e7d32;
  margin-bottom: 8px;
}

.completed-notice p {
  font-size: 12px;
  color: #666;
}

/* 정산 메시지 섹션 */
.settlement-message-section {
  margin-bottom: 30px;
  padding: 20px;
  background-color: #fafafa;
  border: 1px dashed #999;
}

.settlement-message-section h3 {
  font-size: 16px;
  margin-bottom: 15px;
  text-align: center;
}

/* 결제 수단 선택 */
.payment-methods {
  margin-bottom: 15px;
  display: flex;
  gap: 8px;
}

.payment-method-label {
  flex: 1;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.payment-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.payment-method-label span {
  display: block;
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  border: 2px solid #ddd;
  background-color: #fff;
  color: #666;
  transition: all 0.2s;
  font-weight: normal;
}

.payment-checkbox:checked + span {
  border-color: #333;
  background-color: #333;
  color: #fff;
  font-weight: bold;
}

.payment-method-label:hover span {
  border-color: #555;
}

.account-input-section {
  margin-bottom: 15px;
}

.account-input-section label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}

.account-input-section input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  background-color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.account-input-section input:focus {
  outline: none;
  border-color: #333;
}

#settlementMessage {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 1px solid #ddd;
  background-color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.3;
  resize: none;
  overflow: hidden;
  margin-bottom: 10px;
}

#settlementMessage:focus {
  outline: none;
  border-color: #333;
}

/* 액션 버튼 */
.actions {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed #333;
  display: flex;
  gap: 10px;
}

.actions button {
  flex: 1;
  margin-top: 0;
}

/* 반응형 */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 20px 15px;
  }

  .header h1 {
    font-size: 24px;
  }

}

/* 입장 폼 */
.join-form {
  margin-top: 20px;
  padding: 20px 0;
  border-bottom: 1px dashed #ddd;
}

.join-form h2 {
  font-size: 16px;
  margin-bottom: 15px;
  text-align: center;
}

.join-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  background-color: #fafafa;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  text-align: center;
}

.join-form input:focus {
  outline: none;
  border-color: #333;
  background-color: #fff;
}

.join-hint {
  font-size: 11px;
  color: #999;
  text-align: center;
  margin-top: -10px;
  margin-bottom: 10px;
}

.participants-info {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: #666;
}

.participant-list {
  margin-top: 5px;
  font-weight: bold;
  color: #333;
}

/* 모달 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  overflow-y: auto;
  z-index: 1000;
}

.modal-content {
  background-color: #fff;
  padding: 30px 20px;
  max-width: 350px;
  width: 90%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border-top: 3px dashed #333;
  border-bottom: 3px dashed #333;
}

.modal-content h2 {
  font-size: 18px;
  margin-bottom: 20px;
  text-align: center;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  background-color: #fafafa;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.modal-content input:focus {
  outline: none;
  border-color: #333;
  background-color: #fff;
}

.modal-content input[type="datetime-local"] {
  padding: 10px 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions button {
  flex: 1;
  margin-top: 0;
}

/* 로딩 애니메이션 */
.loading {
  text-align: center;
  padding: 40px 0;
  color: #999;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}
