/* ============================================================
   Admin Panel — hidden management interface
   ============================================================ */

.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.admin-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-panel {
  background: #1a1a1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 92vw;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #e0e0e0;
}

/* Header */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.admin-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

.admin-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #999;
  font-size: 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.admin-close:hover {
  background: rgba(255, 80, 80, 0.2);
  color: #f66;
}

/* Tabs */
.admin-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  padding: 0 0.8rem;
}

.admin-tab {
  padding: 0.7rem 1rem;
  border: none;
  background: none;
  color: #888;
  font-size: 0.82rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}

.admin-tab:hover {
  color: #ccc;
}

.admin-tab.active {
  color: #fff;
  border-bottom-color: #c4556b;
}

/* Body */
.admin-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-tab-content {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.admin-tab-content.active {
  display: flex;
}

/* ── Photo Upload Zone ── */
.upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #c4556b;
  background: rgba(196, 85, 107, 0.06);
}

.upload-zone-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.upload-zone-text {
  font-size: 0.82rem;
  color: #999;
}

.upload-zone-input {
  display: none;
}

/* ── Photo Grid (admin thumbnails) ── */
.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
}

.admin-photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.admin-photo-item:active {
  cursor: grabbing;
}

.admin-photo-item.selected {
  border-color: #c4556b;
}

.admin-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #f66;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.admin-photo-item:hover .admin-photo-delete {
  opacity: 1;
}

.admin-photo-count {
  font-size: 0.75rem;
  color: #888;
  text-align: center;
}

/* ── Content Editor ── */
.admin-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.admin-field-group label {
  font-size: 0.75rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-field-group input,
.admin-field-group textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: #e0e0e0;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

.admin-field-group input:focus,
.admin-field-group textarea:focus {
  outline: none;
  border-color: #c4556b;
}

.admin-field-group textarea {
  min-height: 60px;
}

.admin-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

/* ── Message Editor ── */
.admin-message-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.admin-message-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.admin-message-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.admin-message-fields input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  color: #e0e0e0;
  font-size: 0.82rem;
}

.admin-message-fields input:focus {
  outline: none;
  border-color: #c4556b;
}

.admin-message-actions {
  display: flex;
  gap: 0.3rem;
  padding-top: 0.2rem;
}

.admin-btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #999;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.admin-btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.admin-btn-icon.danger:hover {
  background: rgba(255, 80, 80, 0.2);
  color: #f66;
}

/* ── Buttons ── */
.admin-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

.admin-btn {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.admin-btn.primary {
  background: #c4556b;
  color: #fff;
}

.admin-btn.primary:hover {
  background: #d46478;
}

.admin-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
}

.admin-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.admin-btn.warn {
  background: rgba(255, 160, 40, 0.15);
  color: #fa0;
}

.admin-btn.warn:hover {
  background: rgba(255, 160, 40, 0.25);
}

/* ── PIN Screen ── */
.admin-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1rem;
}

.admin-pin h3 {
  font-size: 0.95rem;
  color: #ccc;
  font-weight: 500;
}

.admin-pin-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  color: #fff;
  font-size: 1.2rem;
  text-align: center;
  width: 120px;
  letter-spacing: 0.3em;
}

.admin-pin-input:focus {
  outline: none;
  border-color: #c4556b;
}

.admin-pin-error {
  font-size: 0.78rem;
  color: #f66;
  display: none;
}

/* ── Toast ── */
.admin-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #2a2a30;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-size: 0.8rem;
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.admin-toast.show {
  opacity: 1;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .admin-panel {
    width: 96vw;
    max-height: 92vh;
    border-radius: 12px;
  }
  .admin-field-row {
    grid-template-columns: 1fr;
  }
  .admin-photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 0.4rem;
  }
  .admin-tab {
    font-size: 0.75rem;
    padding: 0.55rem 0.7rem;
  }
  .upload-zone {
    padding: 1.2rem;
  }
}
