/* ==========================================================
   css/noticeboard.css — Notice Board app styles
   Single-pane scrollable card layout, retro styled
   ========================================================== */

.noticeboard-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: "VT323", monospace;
}

/* --- Header bar --- */
.noticeboard-header {
  background: #f0f0f0;
  border-bottom: 2px solid #000;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.noticeboard-header h3 {
  margin: 0;
  font-size: 20px;
  font-family: "VT323", monospace;
}

/* --- Post List --- */
.noticeboard-posts {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.noticeboard-loader {
  width: 100%;
  min-height: 100%;
  padding: 12px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.noticeboard-loader-panel {
  width: min(100%, 420px);
  border: 3px solid #000;
  background: #fff;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.9);
  padding: 18px 18px 16px;
}

.noticeboard-loader-title {
  margin-bottom: 12px;
  text-align: center;
  font-size: 24px;
  color: #000;
}

.noticeboard-loader-track {
  position: relative;
  height: 24px;
  border: 2px solid #000;
  background: #e6e0d0;
  overflow: hidden;
}

.noticeboard-loader-track::before {
  content: "";
  position: absolute;
  inset: 3px;
  background: repeating-linear-gradient(
    90deg,
    #f7f1e4 0 12px,
    #c8bca1 12px 24px
  );
  animation: nbLoaderGrid 0.9s linear infinite;
}

.noticeboard-loader-track::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: -24%;
  width: 24%;
  background: #32cd32;
  border-left: 2px solid #000;
  border-right: 2px solid #000;
  animation: nbLoaderSweep 1.1s steps(6, end) infinite;
}

.noticeboard-loader-copy {
  margin-top: 14px;
  text-align: center;
  font-size: 18px;
  color: #555;
}

@keyframes nbLoaderGrid {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 24px 0;
  }
}

@keyframes nbLoaderSweep {
  from {
    left: -24%;
  }
  to {
    left: 100%;
  }
}

/* --- Post Card --- */
.nb-card {
  border: 3px solid #000;
  background: #fff;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.9);
}

.nb-card-header {
  background: #e0e0e0;
  padding: 10px 12px;
  border-bottom: 2px solid #000;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.nb-card-title {
  font-size: 20px;
  font-weight: bold;
  margin: 0;
}

.nb-card-date {
  font-size: 13px;
  color: #666;
  margin-top: 3px;
}

.nb-card-body-wrap {
  position: relative;
}

.nb-card-body {
  padding: 12px 15px;
  font-size: 17px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.nb-card-body-has-attachment {
  padding-right: 72px;
}

.nb-card-attachments {
  border-top: 2px solid #000;
  background: #f4f4f4;
  padding: 10px 15px 12px;
}

.nb-card-attachments-title {
  margin-bottom: 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #444;
}

.nb-attachment-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nb-attachment-card {
  border: 2px solid #000;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.85);
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

.nb-attachment-thumb {
  width: 92px;
  min-width: 92px;
  background: repeating-linear-gradient(
    45deg,
    #dcdcdc 0 12px,
    #f5f5f5 12px 24px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.nb-attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nb-attachment-meta {
  padding: 8px 10px;
  flex: 1;
}

.nb-attachment-name {
  font-size: 15px;
  line-height: 1.2;
  word-break: break-word;
}

.nb-attachment-size {
  margin-top: 3px;
  font-size: 12px;
  color: #666;
}

.nb-attachment-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.nb-attachment-btn {
  flex: 1;
  min-width: 0;
  font-family: "VT323", monospace;
  font-size: 15px;
  padding: 5px 8px;
  border: 2px solid #000;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.nb-attachment-btn:hover {
  background: #e0e0e0;
}

.nb-attachment-toggle {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 2px solid #000;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.nb-attachment-toggle:hover {
  background: #e0e0e0;
}

.nb-attachment-toggle.is-open {
  background: #000;
  color: #fff;
}

.nb-attachment-toggle-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  overflow: hidden;
}

.nb-attachment-toggle-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nb-attachment-toggle-count {
  position: absolute;
  right: -6px;
  bottom: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border: 1px solid #000;
  background: #000;
  color: #fff;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
}

.nb-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 10px;
}

/* --- Version badge --- */
.nb-version-badge {
  display: inline-block;
  background: #000;
  color: #32cd32;
  font-size: 14px;
  padding: 2px 8px;
  border: 2px solid #32cd32;
  margin-bottom: 5px;
}

/* --- Category tag --- */
.nb-tag {
  display: inline-block;
  font-size: 13px;
  padding: 2px 8px;
  border: 2px solid #000;
  margin-right: 5px;
  margin-bottom: 5px;
}

.nb-tag-update   { background: #4a90e2; color: #fff; border-color: #4a90e2; }
.nb-tag-announce { background: #febc2e; color: #000; border-color: #000; }
.nb-tag-warning  { background: #ff3b30; color: #fff; border-color: #ff3b30; }
.nb-tag-info     { background: #e0e0e0; color: #000; }

/* --- Buttons --- */
.nb-btn {
  font-family: "VT323", monospace;
  font-size: 16px;
  padding: 6px 16px;
  border: 3px solid #000;
  background: #fff;
  cursor: pointer;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.9);
  transition: background 0.1s;
}

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

.nb-btn:active {
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.9);
  transform: translate(2px, 2px);
}

.nb-btn-small {
  font-size: 14px;
  padding: 3px 10px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.9);
}

.nb-btn-delete {
  color: #ff3b30;
  border-color: #ff3b30;
  box-shadow: 3px 3px 0 rgba(255, 59, 48, 0.5);
}

.nb-btn-delete:hover {
  background: #ff3b30;
  color: #fff;
}

/* --- Admin Compose Form --- */
.nb-compose {
  border-top: 2px solid #000;
  background: #f0f0f0;
  padding: 12px 15px;
}

.nb-compose input,
.nb-compose textarea,
.nb-compose select {
  width: 100%;
  font-family: "VT323", monospace;
  font-size: 16px;
  padding: 8px 10px;
  border: 2px solid #000;
  background: #fff;
  box-sizing: border-box;
  outline: none;
}

.nb-compose input,
.nb-compose select {
  margin-bottom: 8px;
}

.nb-compose textarea {
  height: 80px;
  resize: none;
  margin-bottom: 8px;
}

.nb-attachment-picker {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}

.nb-attachment-picker-title {
  font-size: 17px;
}

.nb-attachment-picker-copy {
  font-size: 14px;
  color: #666;
  line-height: 1.3;
}

.nb-compose-file-input {
  margin-bottom: 10px;
}

.nb-compose-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.nb-compose-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 2px solid #000;
  background: #fff;
  padding: 8px 10px;
}

.nb-compose-attachment-copy {
  min-width: 0;
}

.nb-compose-attachment-name {
  font-size: 16px;
  line-height: 1.2;
  word-break: break-word;
}

.nb-compose-attachment-meta {
  font-size: 13px;
  color: #666;
  margin-top: 3px;
}

.nb-compose-attachment-remove {
  flex-shrink: 0;
  font-family: "VT323", monospace;
  font-size: 14px;
  padding: 4px 8px;
  border: 2px solid #000;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.nb-compose-attachment-remove:hover {
  background: #000;
  color: #fff;
}

.nb-compose-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Empty State --- */
.noticeboard-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  font-size: 18px;
}

/* --- Hide admin controls from regular users --- */
.admin-only {
  display: none !important;
}

body.admin-mode .admin-only {
  display: flex !important;
}

/* Admin indicator in title bar */
.admin-badge {
  display: none;
  font-size: 12px;
  background: #32cd32;
  color: #000;
  padding: 1px 6px;
  border: 1px solid #000;
  margin-left: 8px;
  vertical-align: middle;
}

body.admin-mode .admin-badge {
  display: inline;
}

@media (max-width: 700px) {
  .nb-attachment-card {
    flex-direction: column;
  }

  .nb-attachment-thumb {
    width: 100%;
    min-width: 0;
    height: 88px;
  }

  .nb-compose-attachment {
    align-items: flex-start;
    flex-direction: column;
  }

  .nb-compose-attachment-remove {
    align-self: flex-end;
  }
}
