/* Global Styles (Shared with other tools) */
:root {
  --bg-color: #0f172a;
  --text-color: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --accent-color: #38bdf8;
  /* Light Blue for Capture */
  --accent-glow: rgba(56, 189, 248, 0.5);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --header-height: 4rem;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 10% 10%, #1e1b4b 0%, #0f172a 100%);
  z-index: -2;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.3;
}

.orb-1 {
  top: -10%;
  right: -10%;
  width: 40vw;
  height: 40vw;
  background: #0ea5e9;
}

.orb-2 {
  bottom: -10%;
  left: -10%;
  width: 40vw;
  height: 40vw;
  background: #6366f1;
}

.container {
  width: 100%;
  max-width: 1200px;
  /* Wider for gallery */
  margin: 0 auto;
  padding: 2rem;
  box-sizing: border-box;
  flex: 1;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

h1 {
  font-size: 2.5rem;
  margin: 0;
  background: linear-gradient(to right, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: #94a3b8;
  margin-top: 0.5rem;
}

/* Input Section */
.input-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 2rem;
  backdrop-filter: blur(10px);
  margin-bottom: 2rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #e2e8f0;
}

textarea {
  width: 100%;
  height: 150px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 1rem;
  color: white;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  resize: vertical;
  box-sizing: border-box;
}

textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.options-section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1rem;
  color: #e2e8f0;
  margin: 0 0 1rem 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.2em;
  background: var(--accent-color);
  border-radius: 2px;
}

.options-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* Force 3 columns side-by-side */
  gap: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--card-border);
}

@media (max-width: 768px) {
  .options-container {
    grid-template-columns: 1fr;
    /* Stack on mobile */
  }
}

.options-group {
  /* Remove individual group borders for cleaner look within container */
  background: transparent;
  padding: 0;
  border: none;
}

.group-label {
  display: block;
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 2rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  font-size: 0.9rem;
}

.checkbox-chip:hover {
  background: rgba(255, 255, 255, 0.1);
}

.checkbox-chip:has(input:checked) {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-color);
  color: var(--accent-color);
  font-weight: 600;
}

.checkbox-chip input {
  display: none;
  /* Hide default checkbox */
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  border: none;
  border-radius: 0.75rem;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Grid Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.capture-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  position: relative;
}

.capture-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.3);
}

.card-header {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.url-badge {
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.device-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
}

.device-desktop {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.device-mobile {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.image-container {
  height: 300px;
  background: #000;
  display: flex;
  align-items: flex-start;
  /* Top align for long screencaps */
  justify-content: center;
  overflow: hidden;
  /* Click to expand? */
  position: relative;
  cursor: pointer;
}

.image-container img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s;
}

/* Loading State in Image Container */
.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.card-footer {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Error State */
.card-error {
  padding: 2rem;
  text-align: center;
  color: var(--danger-color);
  font-size: 0.9rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  border: none;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-download {
  background: var(--success-color);
  color: #0f172a;
}

.btn-download:hover {
  background: #34d399;
}

.btn-retry {
  background: transparent;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
}

.btn-retry:hover {
  background: rgba(56, 189, 248, 0.1);
}

.bulk-actions {
  text-align: center;
  margin-top: 2rem;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 3rem;
  color: #64748b;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text-color);
}

footer {
  text-align: center;
  padding: 2rem;
  color: #64748b;
  font-size: 0.875rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}