/* ==========================================================================
   Standalone Notice Board Styles (notice-board.css)
   Clean, modern overlay modal for notifications & announcements
   Admin board extensions (writing, editing, login modal)
   Zero external CSS dependencies (Self-contained)
   ========================================================================== */

#nb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  justify-content: center;
  align-items: flex-start;
  padding: 32px 16px;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

#nb-overlay *, #nb-overlay *::before, #nb-overlay *::after {
  box-sizing: border-box;
}

#nb-overlay.nb-open {
  display: flex;
  opacity: 1;
}

#nb-modal {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  max-width: 760px;
  width: 100%;
  margin: auto 0;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1e293b;
  animation: nbSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header */
.nb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.nb-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nb-title-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #3E6B5C;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.nb-modal-title {
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.02em;
}

.nb-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nb-btn-admin {
  background: transparent;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.nb-btn-admin:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.nb-btn-admin.logged-in {
  background: #EBF2EF;
  color: #2C4E43;
  border-color: #B8D5CB;
}

.nb-btn-close {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.nb-btn-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Toolbar: Categories & Search */
.nb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

.nb-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nb-cat-btn {
  background: #f1f5f9;
  border: 1px solid transparent;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.nb-cat-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.nb-cat-btn.active {
  background: #3E6B5C;
  color: #ffffff;
}

.nb-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 200px;
}

.nb-search-icon {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}

.nb-search-input {
  width: 100%;
  padding: 6px 12px 6px 34px;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
}

.nb-search-input:focus {
  border-color: #3E6B5C;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Body container */
.nb-body {
  padding: 16px 24px;
  max-height: 60vh;
  min-height: 280px;
  overflow-y: auto;
  position: relative;
}

/* List view */
.nb-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nb-item {
  padding: 16px 18px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.nb-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nb-item.pinned {
  border-left: 4px solid #3E6B5C;
  background: #f0f9ff;
}

.nb-item.pinned:hover {
  background: #EBF2EF;
}

.nb-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

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

.nb-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
  line-height: 1.4;
}

.nb-badge-cat {
  background: #e2e8f0;
  color: #334155;
}

.nb-badge-pinned {
  background: #B8D5CB;
  color: #2C4E43;
}

.nb-item-date {
  font-size: 12px;
  color: #94a3b8;
}

.nb-item-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  line-height: 1.4;
}

.nb-item-preview {
  font-size: 13px;
  color: #64748b;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

/* Detail view */
.nb-detail {
  padding: 4px 0 16px;
}

.nb-detail-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.nb-detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.nb-btn-back {
  background: #f1f5f9;
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.nb-btn-back:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.nb-detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nb-btn-edit {
  background: #EBF2EF;
  color: #3E6B5C;
  border: 1px solid #B8D5CB;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nb-btn-delete {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nb-detail-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin: 10px 0 8px;
  line-height: 1.4;
}

.nb-detail-meta {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nb-detail-content {
  font-size: 14.5px;
  line-height: 1.75;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Form & Login styles */
.nb-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0;
}

.nb-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nb-form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.nb-form-input, .nb-form-select, .nb-form-textarea {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  background: #ffffff;
  color: #0f172a;
  transition: all 0.2s;
}

.nb-form-textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.6;
}

.nb-form-input:focus, .nb-form-select:focus, .nb-form-textarea:focus {
  border-color: #3E6B5C;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.nb-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.nb-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.nb-btn-cancel {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}

.nb-btn-submit {
  background: #3E6B5C;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.2s;
}

.nb-btn-submit:hover {
  background: #2C4E43;
}

/* Empty View */
.nb-empty {
  text-align: center;
  padding: 40px 16px;
  color: #94a3b8;
}

.nb-empty-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

/* Footer */
.nb-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  font-size: 11.5px;
  color: #94a3b8;
}

@media (max-width: 640px) {
  #nb-overlay {
    padding: 12px;
  }
  .nb-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .nb-search-wrap {
    min-width: 100%;
  }
}
