/* ==========================================================
   css/guestbook.css — Guestbook app styles
   Single-pane drilldown UI matching retro aesthetic
   ========================================================== */

/* --- Layout --- */
.guestbook-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: "VT323", monospace;
  background: #f7f7f7;
}

#gb-view-list, #gb-view-detail, #gb-view-compose {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* --- List View Header --- */
.gb-list-header {
  background: #e0e0e0;
  border-bottom: 2px solid #000;
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.gb-list-header h3 {
  margin: 0;
  font-size: 22px;
}

/* --- Detail / Compose Headers --- */
.gb-detail-header {
  background: #e0e0e0;
  border-bottom: 2px solid #000;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.gb-detail-header h3 {
  margin: 0;
  font-size: 20px;
}

/* --- Message List --- */
.guestbook-list {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

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

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

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

.guestbook-loader-track::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: -24%;
  width: 24%;
  background: #32cd32;
  animation: gbLoaderSweep 1.1s steps(6, end) infinite;
}

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

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

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

.guestbook-list-item {
  background: #fff;
  border: 2px solid #000;
  padding: 12px 15px;
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.9);
  transition: transform 0.1s, box-shadow 0.1s;
}

.guestbook-list-item:hover {
  background: #fdfdfd;
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.9);
}

.guestbook-list-item:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.9);
}

.guestbook-list-item .gb-name {
  font-size: 19px;
  font-weight: bold;
  display: block;
}

.guestbook-list-item .gb-preview {
  font-size: 15px;
  color: #555;
  display: -webkit-box;
  margin-top: 6px;
  white-space: pre-wrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.guestbook-list-item .gb-date {
  font-size: 13px;
  color: #888;
  display: block;
  margin-top: 6px;
}

/* --- Detail Body --- */
.guestbook-detail-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  font-size: 18px;
  line-height: 1.7;
  background: #fff;
}

/* --- Compose Area --- */
.guestbook-compose {
  flex: 1;
  background: #f7f7f7;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.guestbook-compose input {
  margin-bottom: 0;
}

.guestbook-compose textarea {
  flex: 1;
  resize: none;
  min-height: 150px;
  margin-bottom: 0;
}

.guestbook-compose-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 3px;
}

.gb-emoji-anchor {
  position: relative;
  display: flex;
  align-items: flex-end;
}

.gb-emoji-toggle {
  min-width: 110px;
  padding: 6px 12px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.9);
}

.gb-emoji-toggle[aria-expanded="true"] {
  background: #000;
  color: #fff;
}

.gb-emoji-picker {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: min(320px, calc(100vw - 90px));
  border: 2px solid #000;
  background: rgba(240, 240, 240, 0.78);
  backdrop-filter: blur(8px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.65);
  padding: 10px;
}

.gb-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.gb-emoji-option {
  font-family: "VT323", monospace;
  font-size: 24px;
  min-height: 42px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  box-shadow: none;
  transition: background 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gb-emoji-option:hover {
  background: rgba(255, 255, 255, 0.95);
}

.gb-emoji-option:active {
  background: #000;
  color: #fff;
}

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

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

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

.gb-btn-send {
  background: #4a90e2;
  color: #fff;
  border-color: #000;
}

.gb-btn-send:hover {
  background: #357abd;
}

.gb-btn-delete {
  background: #fff;
  color: #ff3b30;
  border-color: #ff3b30;
  font-size: 14px;
  padding: 4px 10px;
  box-shadow: 3px 3px 0 rgba(255, 59, 48, 0.5);
}

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

/* --- Empty State --- */
.guestbook-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666;
  font-size: 18px;
  text-align: center;
  padding: 20px;
}

.guestbook-empty p {
  margin: 5px 0;
}

/* --- Notification --- */
.gb-notification {
  position: fixed;
  top: 40px;
  right: 20px;
  padding: 10px 20px;
  font-family: "VT323", monospace;
  font-size: 16px;
  border: 3px solid #000;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.9);
  z-index: 10000;
  animation: gbSlideIn 0.3s ease-out;
}

.gb-notification.success {
  background: #32cd32;
  color: #000;
}

.gb-notification.error {
  background: #ff3b30;
  color: #fff;
}

@keyframes gbSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* --- Profanity Warning --- */
.gb-warning {
  color: #ff3b30;
  font-size: 14px;
  margin-bottom: 8px;
}

/* --- Detail meta --- */
.gb-detail-meta {
  color: #888;
  font-size: 15px;
  margin-bottom: 15px;
}

@media (max-width: 600px) {
  .guestbook-compose {
    padding: 15px;
  }

  .gb-emoji-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-height: 140px;
  }

  .guestbook-compose-actions {
    align-items: stretch;
  }

  .gb-emoji-anchor {
    flex: 1;
  }

  .gb-emoji-picker {
    width: min(280px, calc(100vw - 60px));
  }

  .gb-emoji-toggle,
  .guestbook-compose-actions .gb-btn-send {
    width: auto;
  }
}
