:root {
  --accent: #c0392b;
  --bg: #f7f7f8;
  --card-bg: #ffffff;
  --border: #e2e2e5;
  --text: #1c1c1e;
  --muted: #6b6b70;
}

* { box-sizing: border-box; }

/* Force the native [hidden] behavior to win even if the host site's global
   CSS (e.g. "div { display: ... }" resets) would otherwise override it. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 24px 32px 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-wall {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}

.login-wall-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-wall-card h1 { margin: 0; font-size: 22px; }
.login-wall-card .subtitle { margin: 0 0 8px; }
.login-wall-card input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}
.login-wall-card button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 14px;
}
.login-wall-card button:hover { opacity: 0.9; }
.login-wall-card button:disabled { opacity: 0.6; cursor: default; }

.activity-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  font-size: 13px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
header h1 { margin: 0 0 4px; font-size: 24px; }
.subtitle { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

.asianet-auth { flex-shrink: 0; margin-top: 2px; }

.search-bar {
  display: flex;
  gap: 8px;
  max-width: 720px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 12px 0;
  margin: 0 0 -4px;
}

.search-bar input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.search-bar button {
  padding: 10px 20px;
  font-size: 15px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}
.search-bar button:hover { opacity: 0.9; }

.provider-group {
  margin: 0 0 14px;
  padding: 8px 14px 12px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.provider-group legend {
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.provider-group label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

#asianet-agency-filter {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  width: 220px;
}

.generate-group {
  display: block;
}

.generate-models {
  display: flex;
  gap: 18px;
  margin-bottom: 10px;
}

.generate-input-row {
  display: flex;
  gap: 8px;
}

.generate-input-row input {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.generate-input-row button,
.generate-prompt-box button {
  padding: 8px 16px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  white-space: nowrap;
}
.generate-input-row button:hover,
.generate-prompt-box button:hover { opacity: 0.9; }
.generate-input-row button:disabled,
.generate-prompt-box button:disabled { opacity: 0.6; cursor: default; }

.generate-prompt-box {
  margin-top: 12px;
}

.generate-prompt-box label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.generate-prompt-box textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  margin-bottom: 8px;
}

.generate-status {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.generate-status.error { color: var(--accent); }

.status {
  margin: 8px 0 16px;
  font-size: 14px;
  color: var(--muted);
}
.status.error { color: var(--accent); }

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0 16px;
}
.view-toggle-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 4px;
}
.view-toggle button {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  cursor: pointer;
}
.view-toggle button:first-of-type { border-radius: 6px 0 0 6px; }
.view-toggle button:last-of-type { border-radius: 0 6px 6px 0; border-left: none; }
.view-toggle button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Columns view: a horizontal row of per-provider columns. Scrolls
   horizontally if there are more providers than fit. */
.result-columns {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}
.result-column {
  flex: 1 0 220px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.result-column-head {
  position: sticky;
  top: 64px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 4px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}
.result-column-head .col-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: #eee;
}

.card-meta {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
}
.badge.unsplash { background: #111; }
.badge.pexels { background: #05a081; }
.badge.pixabay { background: #1a9c37; }
.badge.gemini-light { background: #8e5cf7; }
.badge.gemini-regular { background: #5b21b6; }
.badge.gpt-image { background: #0d8a6a; }
.badge.asianet { background: var(--accent); }
.badge.ani { background: #b45309; }
.badge.getty { background: #142850; }

.asianet-login-box {
  padding: 8px 12px;
  background: #fff6f5;
  border: 1px solid #f0c9c4;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.asianet-login-box input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  width: 140px;
}

.asianet-login-box button {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 13px;
}
.asianet-login-box button:hover { opacity: 0.9; }
.asianet-login-box button:disabled { opacity: 0.6; cursor: default; }

.asianet-login-status {
  color: var(--accent);
  font-size: 12px;
  word-break: break-word;
  flex-basis: 100%;
}

.load-more-status {
  text-align: center;
  padding: 20px 0;
  color: var(--muted);
  font-size: 13px;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.lightbox-content {
  background: white;
  border-radius: 8px;
  max-width: 780px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
  padding: 16px;
  position: relative;
}

.lightbox-content img {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 12px;
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(0, 0, 0, 0.85); }

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 110;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-nav:hover { background: rgba(0, 0, 0, 0.8); }
.lightbox-nav:disabled { opacity: 0.25; cursor: default; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-meta p { margin: 4px 0; font-size: 14px; }
#lightbox-credit { color: var(--muted); font-size: 13px; }

.credit-note {
  font-size: 12.5px;
  line-height: 1.4;
  color: #8a5a00;
  background: #fff8e6;
  border: 1px solid #f2d98f;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 8px 0 0;
}

#lightbox-download,
#lightbox-download-desktop {
  margin-top: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 14px;
}
#lightbox-download-desktop {
  margin-left: 8px;
  background: #374151;
}
#lightbox-download:disabled,
#lightbox-download-desktop:disabled { opacity: 0.6; cursor: default; }

#lightbox-download-status {
  margin-left: 10px;
  font-size: 13px;
  color: var(--muted);
}

#lightbox-download-status a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}
