/* === Image Hub - style.css === */

:root {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #0f1a2e;
  --text: #e8e8e8;
  --text-muted: #8892a4;
  --accent: #e94560;
  --accent-hover: #d63851;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  background: var(--bg);
  color: var(--text);
}

main {
  font-family: 'Migu 1C', system-ui, -apple-system, sans-serif;
}

/* Header overrides for dark theme */
.site-header {
  background: rgba(22, 33, 62, 0.92);
  border-bottom: 1px solid var(--border);
}

.site-header .site-logo {
  color: var(--text);
}

.site-header .site-logo span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.75em;
}

.site-header .menu-toggle {
  color: var(--text);
}

.site-footer {
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ─── Layout ─── */
.gen-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  padding: 24px 0 48px;
  min-height: calc(100vh - 200px);
}

/* ─── Generation Form ─── */
.gen-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  align-self: start;
  position: sticky;
  top: 72px;
}

.gen-form-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.gen-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 14px;
}

.gen-label:first-of-type {
  margin-top: 0;
}

.gen-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.gen-textarea:focus {
  border-color: var(--accent);
}

.gen-textarea::placeholder {
  color: var(--text-muted);
}

.gen-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892a4' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.gen-select:focus {
  border-color: var(--accent);
}

.gen-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.gen-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.gen-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gen-status {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 1.4em;
}

.gen-status.error {
  color: var(--accent);
}

/* ─── Gallery ─── */
.gen-gallery-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 0.9rem;
}

.image-card {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.15s;
}

.image-card:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px var(--shadow);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Lightbox ─── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-body {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-close {
  position: absolute;
  top: -36px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-info {
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  width: 100%;
  max-width: 600px;
}

.lightbox-prompt {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
  word-break: break-word;
}

.lightbox-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.lightbox-meta span {
  white-space: nowrap;
}

/* ─── Context Menu ─── */
.context-menu {
  position: fixed;
  z-index: 1001;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px var(--shadow);
  padding: 4px 0;
  min-width: 120px;
}

.context-menu[hidden] {
  display: none;
}

.context-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.context-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.context-menu-delete {
  color: var(--accent);
}

/* ─── Confirm Dialog ─── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1002;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-overlay[hidden] {
  display: none;
}

.confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: 0 16px 48px var(--shadow);
  animation: confirm-in 0.15s ease;
}

@keyframes confirm-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.confirm-msg {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
  color: var(--text);
}

.confirm-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.confirm-btns button {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.confirm-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.confirm-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
}

.confirm-ok {
  background: var(--accent);
  color: #fff;
}

.confirm-ok:hover {
  background: var(--accent-hover);
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1003;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  max-width: 360px;
  word-break: break-word;
}

.toast.info {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.toast.success {
  background: #1b5e20;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.toast.error {
  background: #7f1d1d;
  border: 1px solid rgba(233, 69, 96, 0.3);
}

.toast.removing {
  animation: toast-out 0.3s ease forwards;
}

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

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

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .gen-layout {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px 0 32px;
  }

  .gen-form {
    position: static;
    padding: 16px;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
  }

  .lightbox-body {
    max-width: 95vw;
  }

  .lightbox-img {
    max-width: 95vw;
    max-height: 60vh;
  }

  .lightbox-info {
    max-width: 95vw;
  }

  .toast-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: 100%;
  }
}
