/* ====== CSS RESET & VARIABLES ====== */
:root {
  --color-primary: #e65100; /* Sunset Orange */
  --color-primary-hover: #ff7043;
  --color-secondary: #0277bd; /* Sky Blue */
  --color-secondary-hover: #29b6f6;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #1e293b;
  --color-text-light: #64748b;
  --color-border: #e2e8f0;
  --color-error: #ef4444;
  --color-success: #10b981;
  
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 24px;
  --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.15);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: #0f172a;
}

.hidden {
  display: none !important;
}

/* ====== HERO SECTION ====== */
.hero {
  position: relative;
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background-image: url('https://offertabs.s3.amazonaws.com/offer/ey3j9x/site/media/6abc4e299048b9.33248499.png');
  background-size: cover;
  background-position: center;
  text-align: center;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(15,23,42,0.85) 0%, rgba(30,58,138,0.7) 100%);
  z-index: -1;
}

.hero-content {
  max-width: 800px;
  color: #fff;
}

.hero-content .badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 24px;
}

.hero-content h1 {
  font-size: clamp(2.25rem, 5vw, 4rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: 16px;
  text-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.hero-content p {
  font-size: 1rem;
  color: rgba(255,255,255,0.9);
  max-width: 600px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .hero {
    min-height: 45vh;
    padding: 80px 20px;
  }
  .hero-content p {
    font-size: 1.125rem;
  }
}

/* ====== MAIN CONTAINER ====== */
.main-container {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 16px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .main-container {
    padding: 40px 20px;
  }
}

.status-panel {
  background: var(--color-surface);
  border-left: 4px solid var(--color-error);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
  text-align: center;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}

@media (min-width: 992px) {
  .workspace-grid {
    grid-template-columns: 400px 1fr;
    gap: 60px;
  }
  .interaction-column {
    margin-top: -100px;
    position: sticky;
    top: 40px;
    z-index: 10;
  }
}

/* ====== CARDS & PANELS ====== */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
  .glass-card {
    padding: 40px 30px;
  }
}

.glass-card h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .glass-card h2 {
    font-size: 1.75rem;
  }
}

.glass-card .subtitle {
  color: var(--color-text-light);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.alert {
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.alert.error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.field-error {
  color: var(--color-error);
  font-size: 0.85rem;
  margin-top: 6px;
  font-weight: 600;
  display: block;
}

.input-error {
  border-color: var(--color-error) !important;
  background-color: #fff0f0 !important;
}

.input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* ====== FORM STYLES ====== */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #334155;
}

/* Enhanced Tap Targets for Mobile */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea,
.form-group input[type="file"] {
  width: 100%;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 1rem; /* >=16px prevents iOS zoom */
  color: var(--color-text);
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  min-height: 48px; /* Standard accessible tap target */
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(2, 119, 189, 0.15);
  background-color: #fff;
}

.form-group input[type="file"] {
  padding: 6px;
  background-color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.form-group input[type="file"]::file-selector-button {
  background: var(--color-border);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  margin-right: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 36px;
}
.form-group input[type="file"]::file-selector-button:hover {
  background: #cbd5e1;
}

/* ====== BUTTONS ====== */
.btn-primary, .btn-secondary, .social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 24px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: 48px; /* Accessible tap target */
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, #f97316 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(230, 81, 0, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(230, 81, 0, 0.4);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.small {
  padding: 10px 16px;
  width: auto;
  font-size: 0.95rem;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

#gallery-loading.spinner {
  border-color: rgba(2, 119, 189, 0.2);
  border-top-color: var(--color-secondary);
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ====== SUCCESS & SHARE PANEL ====== */
#success-panel {
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: #d1fae5;
  color: var(--color-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.success-icon svg {
  width: 32px;
  height: 32px;
}

.share-box {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--color-border);
}

.share-box h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.share-box p {
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin-bottom: 20px;
}

.share-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.share-input-group input {
  flex: 1;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-light);
  font-family: monospace;
  font-size: 0.9rem;
}

.copy-success {
  color: var(--color-success);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.social-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.social-btn {
  flex: 1;
  padding: 10px;
  font-size: 0.9rem;
  color: #fff;
}

.social-btn.fb { background-color: #1877F2; }
.social-btn.fb:hover { background-color: #1664d9; }
.social-btn.tw { background-color: #0f1419; }
.social-btn.tw:hover { background-color: #272c30; }

@media (max-width: 480px) {
  .share-input-group {
    flex-direction: column;
  }
  .share-input-group input {
    width: 100%;
  }
  .share-input-group .btn-primary.small {
    width: 100%;
  }
  .social-actions {
    flex-direction: column;
  }
}

/* ====== GALLERY GRID ====== */
.gallery-header {
  margin-bottom: 24px;
}

.gallery-header h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

@media (min-width: 768px) {
  .gallery-header h2 {
    font-size: 2rem;
  }
}

.gallery-header p {
  color: var(--color-text-light);
  font-size: 1.1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
  }
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  background: #e2e8f0;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 32px 12px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
  color: #fff;
  opacity: 1; /* Always visible on mobile for better discovery */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

@media (min-width: 768px) {
  .gallery-item-overlay {
    padding: 24px 16px 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .gallery-item:hover .gallery-item-overlay {
    opacity: 1;
  }
}

.gallery-item-vote {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.gallery-item-vote svg {
  fill: #fff;
  width: 16px;
  height: 16px;
}

.gallery-item-caption {
  font-size: 0.8rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-actions {
  text-align: center;
}


/* ====== LIGHTBOX ====== */
.lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px; /* Smaller padding on mobile */
}

@media (min-width: 768px) {
  .lightbox {
    padding: 20px;
  }
}

.lightbox-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
}

.lightbox-content {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow-y: auto; /* Allow internal scrolling on mobile */
  max-width: 900px;
  width: 100%;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  .lightbox-content {
    flex-direction: row;
    overflow-y: hidden;
    max-height: 90vh;
  }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 48px; /* Accessible tap target */
  height: 48px;
  background: rgba(15, 23, 42, 0.7); /* Dark background for visibility over images */
  border: none;
  border-radius: 50%;
  font-size: 24px;
  color: #fff;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

@media (min-width: 768px) {
  .close-btn {
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    color: var(--color-text);
    box-shadow: none;
  }
  .close-btn:hover {
    background: #e2e8f0;
  }
}

.lightbox-image-container {
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

@media (max-width: 767px) {
  .lightbox-image-container {
    min-height: 250px;
  }
}

.lightbox-image-container img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.lightbox-details {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
}

@media (min-width: 768px) {
  .lightbox-details {
    flex: 0 0 320px;
    padding: 40px 30px;
  }
}

.lightbox-caption {
  font-size: 1.1rem;
  line-height: 1.5;
  margin-bottom: 12px;
  color: var(--color-text);
}

.lightbox-author {
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin-bottom: 24px;
  font-weight: 600;
}

@media (min-width: 768px) {
  .lightbox-author {
    margin-bottom: 30px;
  }
}

.lightbox-voting {
  margin-top: auto;
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.btn-vote {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--color-secondary) 0%, #0369a1 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(2, 119, 189, 0.3);
  min-height: 48px;
}

.btn-vote:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(2, 119, 189, 0.4);
}

.btn-vote.voted {
  background: var(--color-success);
  box-shadow: none;
  cursor: default;
  transform: none;
}

.btn-vote:disabled:not(.voted) {
  background: var(--color-border);
  color: var(--color-text-light);
  box-shadow: none;
  cursor: not-allowed;
}

.vote-count {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--color-text-light);
  font-weight: 600;
}

/* SDK Attribution */
#wbx-powered-by-slot {
  margin-top: 40px;
  text-align: center;
  width: 100%;
}