/* ===== Board System ===== */

/* Write Button */
.btn-write {
  display: inline-block;
  padding: 10px 24px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-kr);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 24px;
}

.btn-write:hover {
  background: #1e4a6e;
  transform: translateY(-1px);
}

.board-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 20px 0 0;
}

/* Auth Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 90%;
  max-width: 480px;
  overflow: hidden;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover { background: #e0e0e0; }

.modal-body {
  padding: 28px;
}

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

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

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-kr);
  transition: border-color 0.2s ease;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(44,95,138,0.1);
}

.form-group textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.8;
}

.form-group input[type="file"] {
  padding: 10px;
  border-style: dashed;
  cursor: pointer;
}

.form-error {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

.form-error.show { display: block; }

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-submit {
  padding: 10px 28px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-kr);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-submit:hover { background: #1e4a6e; }

.btn-cancel {
  padding: 10px 28px;
  background: #f0f0f0;
  color: #666;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-kr);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cancel:hover { background: #e0e0e0; }

/* Post image preview */
.img-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 8px;
  display: none;
}

.img-preview.show { display: block; }

/* Dynamic board item link style */
a.board-item {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* Board item delete button */
.board-item-actions {
  padding: 0 20px 16px;
  display: flex;
  gap: 8px;
}

.btn-edit, .btn-delete {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-family: var(--font-kr);
  transition: all 0.2s ease;
}

.btn-edit:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-delete:hover { border-color: #e74c3c; color: #e74c3c; }

/* File attachment in post form */
.file-list {
  margin-top: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8f8f8;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}

.file-item .remove-file {
  margin-left: auto;
  color: #e74c3c;
  cursor: pointer;
  font-size: 16px;
  border: none;
  background: none;
}

/* Loading Spinner */
.board-loader {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: #999;
  font-size: 14px;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-submit:disabled {
  background: #aaa;
  cursor: not-allowed;
}

/* Multi-image preview grid */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.preview-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #ddd;
}

/* ===== Admin Footer Login Button ===== */
.btn-admin-login {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 14px;
  background: transparent;
  color: rgba(0,0,0,0.25);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-kr);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-admin-login:hover {
  color: rgba(0,0,0,0.5);
  border-color: rgba(0,0,0,0.25);
}

.btn-admin-login.logged-in {
  color: #e74c3c;
  border-color: #e74c3c;
}

/* ===== Admin Mode Toolbar ===== */
.admin-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  margin-bottom: 16px;
}

.admin-toolbar-inner .admin-label {
  font-size: 13px;
  font-weight: 600;
  color: #e67e22;
}

.admin-toolbar-inner .admin-actions {
  display: flex;
  gap: 8px;
}

.admin-toolbar-inner .btn-write {
  margin-bottom: 0;
}

.btn-admin-logout {
  padding: 8px 18px;
  background: #f0f0f0;
  color: #666;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-kr);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-admin-logout:hover {
  background: #e0e0e0;
  color: #333;
}

/* ===== Admin mode: show action buttons on board items ===== */
.board-item-actions {
  padding: 0 20px 16px;
  display: none;
  gap: 8px;
}

body.admin-mode .board-item-actions {
  display: flex;
}
