/* ===== 기본 설정 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background-color: #f8f8f8;
  color: #333;
  line-height: 1.4;
  font-size: 12px;
  overflow-x: hidden;
}

/* ===== 레이아웃 ===== */
.container {
  max-width: 1000px;
  margin: 0 auto;
  background-color: #ffffff;
  border: 1px solid #ddd;
  overflow-x: hidden;
}

.header {
  background: linear-gradient(to bottom, #4a90e2, #357abd);
  color: white;
  padding: 15px 0;
  border-bottom: 2px solid #2e5c87;
  position: relative;
  width: 100%;
}

.header h1 {
  padding: 0 15px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  margin: 0;
  width: 100%;
}

/* ===== 뒤로가기 버튼 ===== */
.back-btn {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 3px;
  font-size: 11px;
  text-decoration: none;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== 글쓰기 폼 ===== */
.write-form {
  background-color: #f9f9f9;
  border-bottom: 1px dotted #ccc;
  padding: 15px;
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.form-row:first-child {
  margin-bottom: 10px;
}

.form-row:last-child {
  justify-content: flex-end;
  margin-top: 10px;
  align-items: stretch;
}

.form-row input[type="text"],
.form-row input[type="password"] {
  padding: 5px 8px;
  border: 1px solid #ccc;
  font-size: 12px;
  font-family: inherit;
}

#title {
  flex: 1;
  resize: both;
  overflow: hidden;
  min-height: 64px;
  height: 64px;
  line-height: 1.2;
  padding: 4px 8px;
  border: 1px solid #ccc;
  font-size: 12px;
  font-family: inherit;
  vertical-align: top;
  word-wrap: break-word;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.form-row:first-child #title {
  width: 100%;
}

#password {
  width: 80px;
  margin-right: 5px;
}

.submit-btn {
  background: linear-gradient(to bottom, #4a90e2, #357abd);
  color: white;
  border: 1px solid #2e5c87;
  padding: 5px 15px;
  cursor: pointer;
  font-size: 11px;
  border-radius: 2px;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.submit-btn:hover {
  background: linear-gradient(to bottom, #357abd, #2e5c87);
}

/* ===== 게시판 목록 ===== */
.board-list {
  background-color: white;
}

.board-header {
  background-color: #f5f5f5;
  border-bottom: 1px solid #ddd;
  padding: 8px 15px;
  font-size: 11px;
  color: #666;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.board-item {
  border-bottom: 1px dotted #eee;
  padding: 10px 15px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.board-item:hover {
  background-color: #f9f9f9;
}

.board-number {
  font-weight: bold;
  color: #666;
  margin-right: 10px;
  min-width: 40px;
}

.board-title {
  flex: 1;
  color: #333;
  word-wrap: break-word;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.board-date {
  color: #999;
  font-size: 11px;
  min-width: 120px;
  text-align: right;
}

.board-actions {
  display: flex;
  gap: 5px;
  margin-left: 10px;
}

.action-btn {
  background: #f5f5f5;
  border: 1px solid #ccc;
  color: #666;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 10px;
  border-radius: 2px;
}

.action-btn:hover {
  background: #e8e8e8;
}

.edit-btn {
  color: #4a90e2;
}

.delete-btn {
  color: #dc3545;
}

.board-stats {
  background-color: #f9f9f9;
  border-top: 1px solid #ddd;
  padding: 8px 15px;
  font-size: 11px;
  color: #666;
  text-align: center;
}

.no-posts {
  text-align: center;
  color: #999;
  padding: 40px;
  font-size: 11px;
}

/* ===== 모달 ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  padding: 20px;
  border-radius: 5px;
  width: 300px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.modal-header {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #333;
}

.modal-body {
  margin-bottom: 15px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
}

.modal-btn.primary {
  background: linear-gradient(to bottom, #4a90e2, #357abd);
  color: white;
  border-color: #2e5c87;
}

.modal-btn.secondary {
  background: linear-gradient(to bottom, #f5f5f5, #e8e8e8);
  color: #333;
}

.modal-input {
  width: 100%;
  padding: 6px;
  border: 1px solid #ccc;
  font-size: 12px;
  margin-bottom: 10px;
  font-family: inherit;
  line-height: 1.2;
  box-sizing: border-box;
  word-wrap: break-word;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.modal-input[type="password"] {
  min-height: auto;
}

.modal-input:not([type="password"]) {
  resize: vertical;
  min-height: 60px;
}

/* ===== 메시지 ===== */
.success-message {
  background-color: #d4edda;
  color: #155724;
  padding: 8px 15px;
  font-size: 11px;
  border-bottom: 1px solid #c3e6cb;
}

/* 검색 섹션 */
.search-section {
  padding: 10px 0 20px 0;
  text-align: center;
  background-color: #f8f8f8;
}

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

#searchInput {
  width: 200px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 0;
  font-size: 12px;
}

.search-btn {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 0;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
  background: linear-gradient(to bottom, #4a90e2, #357abd);
  color: white;
  border-color: #2e5c87;
}

.search-btn:hover {
  background: linear-gradient(to bottom, #357abd, #2e5c87);
}

/* 페이지네이션 */
.pagination {
  text-align: center;
  padding: 20px 20px 10px 20px;
  border-top: 1px solid #eee;
}

.page-btn {
  display: inline-block;
  padding: 6px 2px;
  margin: 0 2px;
  border: none;
  background: #fff;
  color: #333;
  cursor: pointer;
  border-radius: none;
  font-size: 11px;
  min-width: 28px;
  text-align: center;
}

.page-btn:hover {
  background: #f5f5f5;
}

.page-btn.active {
  background: #4a90e2;
  color: white;
  border: none;
}

/* ===== 푸터 ===== */
.footer {
  background-color: #f8f8f8;
  border-top: 1px solid #ddd;
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 11px;
}

.footer p {
  margin: 5px 0;
}

.footer a {
  color: #4a90e2;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ===== 모바일 반응형 ===== */
@media (max-width: 768px) {
  .container {
    border: none;
    background-color: transparent;
    box-shadow: none;
  }
  
  .header {
    padding: 16px 0;
  }
  
  .header h1 {
    font-size: 14px;
    padding: 0 15px;
  }
  
  .back-btn {
    left: 10px;
    padding: 4px 8px;
    font-size: 10px;
  }
  
  /* 글쓰기 폼 */
  .write-form {
    padding: 10px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  
  .form-row:last-child {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
  }
  
  #title {
    width: 100% !important;
    height: 50px;
    min-height: 50px;
    font-size: 14px !important;
  }
  
  #password {
    width: 70px !important;
    font-size: 14px !important;
    height: 36px;
    padding: 0 8px;
  }
  
  .submit-btn {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
    height: 36px;
  }
  
  /* 게시판 목록 */
  .board-header {
    padding: 6px 10px;
    font-size: 10px;
  }
  
  .board-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 10px;
    gap: 4px;
  }
  
  .board-number {
    margin-right: 0;
    min-width: auto;
  }
  
  .board-title {
    font-size: 11px;
    line-height: 1.3;
  }
  
  .board-date {
    font-size: 10px;
    text-align: left;
    min-width: auto;
    color: #666;
  }
  
  .board-actions {
    margin-left: 0;
    margin-top: 5px;
  }
  
  .action-btn {
    font-size: 9px;
    padding: 3px 6px;
  }
  
  /* 모달 */
  .modal-content {
    width: 90vw;
    max-width: 300px;
    margin: 0 15px;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
  }
  
  .modal-input {
    font-size: 14px !important;
    padding: 8px;
  }
  
  .modal-btn {
    padding: 10px 12px;
    font-size: 12px;
    min-height: 40px;
  }

  /* 모바일 검색 */
  #searchInput {
    width: 150px;
  }
}

/* ===== 더 작은 화면 ===== */
@media (max-width: 480px) {
  .header h1 {
    font-size: 12px;
  }
  
  .write-form {
    padding: 8px;
  }
  
  #title {
    height: 45px;
    min-height: 45px;
  }
  
  .submit-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
  
  .board-title {
    font-size: 10px;
  }
  
  .board-date {
    font-size: 9px;
  }

  #searchInput {
    width: 120px;
  }
}
