/* Base Variables & Reset */
:root {
  --theme-main: #5b8ab1; /* Matched to light blue in logo */
  --theme-dark: #3e678a;
  --dark-slate: #0f354b; /* Matched to dark text in logo */
  --wood-bg: #3e2b20;
  --text-main: #333333;
  --text-light: #666666;
  --font-body: 'Open Sans', sans-serif;
  --font-heading: 'Montserrat', sans-serif;
  --font-script: 'Caveat', cursive;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--text-main);
  background-color: var(--wood-bg);
  -webkit-font-smoothing: antialiased;
}

/* Wood Background Effect */
.wood-background {
  min-height: 100vh;
  background-color: #3f2a1d;
  background-image: 
    repeating-linear-gradient(90deg, transparent 0, transparent 48px, rgba(0,0,0,0.2) 50px),
    linear-gradient(rgba(255,255,255,0.03) 0%, rgba(0,0,0,0.15) 100%);
  padding: 40px 20px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

/* Header */
.campaign-header {
  text-align: center;
  margin-bottom: 25px;
  position: relative;
  z-index: 2;
}

.pre-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
  color: white;
  margin: 0;
  letter-spacing: -0.5px;
  text-shadow: 0 4px 6px rgba(0,0,0,0.5);
  line-height: 1.1;
}

.main-title {
  font-family: var(--font-script);
  font-size: 4.8rem;
  font-weight: 700;
  color: white;
  margin: -10px 0 10px 0;
  line-height: 1;
  text-shadow: 
    -2px -2px 0 var(--theme-main),
     2px -2px 0 var(--theme-main),
    -2px  2px 0 var(--theme-main),
     2px  2px 0 var(--theme-main),
     0 6px 12px rgba(0,0,0,0.4);
  transform: rotate(-3deg);
  display: inline-block;
}

.subtitle {
  font-family: var(--font-script);
  font-size: 1.8rem;
  color: white;
  margin: 0;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
  transform: rotate(-1deg);
}

/* Decorative Polaroids (CSS only) */
.polaroid-decorations {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
  flex-wrap: wrap;
}

.polaroid {
  background: white;
  padding: 8px 8px 30px 8px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
  width: 120px;
  height: 120px;
  border-radius: 2px;
}

.polaroid .p-img {
  width: 100%;
  height: 100%;
  border: 1px solid #eee;
}

.p-1 { transform: rotate(-8deg) translateY(10px); }
.p-2 { transform: rotate(4deg) translateY(-5px); }
.p-3 { transform: rotate(-2deg); }
.p-4 { transform: rotate(10deg) translateY(5px); }

/* Theme Banner */
.theme-banner {
  background-color: var(--theme-main);
  color: white;
  text-align: center;
  padding: 16px 20px;
  border-radius: 8px;
  margin: 30px 0;
  box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.theme-banner p {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.info-card {
  background: white;
  padding: 25px 20px;
  border-radius: 4px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
  text-align: center;
  position: relative;
}

.script-heading {
  font-family: var(--font-script);
  font-size: 2.2rem;
  color: var(--theme-main);
  margin: 0 0 15px 0;
  line-height: 1;
}

.rules-card {
  border: 4px solid var(--dark-slate);
  padding-top: 35px; /* space for overlapping title */
}

.rules-card .script-heading.white-bg {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark-slate);
  color: white;
  padding: 5px 20px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Info content styling */
.dates-display {
  color: var(--dark-slate);
  margin-bottom: 15px;
}

.date-large {
  font-family: var(--font-script);
  font-size: 2.5rem;
  line-height: 1;
  color: #a4613b;
}

.date-sep {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 5px 0;
}

.small-text {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-light);
}

.rules-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 0;
}

.rules-list li {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  padding-left: 32px;
  position: relative;
  line-height: 1.4;
}

.rules-list .num {
  position: absolute;
  left: 0;
  top: -2px;
  background: var(--theme-main);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

.prize-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.prize-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.prize-item strong {
  font-size: 0.95rem;
  color: var(--text-main);
}

.badge {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 99px;
  color: white;
  letter-spacing: 0.5px;
}

.badge.gold { background: #bba268; }
.badge.silver { background: #8e959b; }
.badge.bronze { background: #a4613b; }


/* Main Form Container & Tabs */
.form-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.3);
  overflow: hidden;
  margin-bottom: 30px;
}

.view-tabs {
  display: flex;
  background: var(--dark-slate);
  border-bottom: 3px solid var(--theme-main);
}

.tab-btn {
  flex: 1;
  padding: 18px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: none;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.tab-btn.active {
  background: var(--theme-main);
  color: white;
  cursor: default;
}

.form-header-box {
  background: var(--dark-slate);
  color: white;
  text-align: center;
  padding: 20px;
}

.form-header-box h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin: 0;
  color: var(--theme-main);
}

#contest-form {
  padding: 40px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label:not(.file-label) {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--dark-slate);
  font-size: 0.95rem;
}

.form-group input:not([type="file"]) {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #f9fafb;
  transition: all 0.2s;
  box-sizing: border-box;
}

.form-group input:not([type="file"]):focus {
  outline: none;
  border-color: var(--theme-main);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(91, 138, 177, 0.2);
}

/* Custom File Input */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.file-label {
  display: block;
  cursor: pointer;
}

.file-custom {
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  background-color: #f9fafb;
  transition: all 0.2s;
}

.file-label:focus-within .file-custom {
  border-color: var(--theme-main);
  box-shadow: 0 0 0 3px rgba(91, 138, 177, 0.2);
}

.file-name {
  flex: 1;
  padding: 14px 16px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-btn {
  padding: 14px 20px;
  background: var(--dark-slate);
  color: white;
  font-weight: 600;
  transition: background 0.2s;
}

.file-label:hover .file-btn {
  background: #1a252a; /* Slightly lighter than slate */
}

/* Submit Button */
button[type="submit"] {
  width: 100%;
  padding: 18px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: white;
  background: var(--theme-main);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(91, 138, 177, 0.4);
  margin-top: 10px;
}

button[type="submit"]:hover:not(:disabled) {
  background: var(--theme-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(91, 138, 177, 0.5);
}

button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Result / Views */
.view-pad {
  padding: 60px 40px;
}

.result-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  color: var(--dark-slate);
  margin-bottom: 15px;
}

.description {
  font-size: 1.1rem;
  color: var(--text-light);
  line-height: 1.6;
}

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

.success-icon {
  margin-bottom: 20px;
}

/* Messages */
.error {
  color: #b91c1c;
  background: #fef2f2;
  padding: 14px;
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 0.95rem;
  border: 1px solid #f87171;
  text-align: left;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Share Section */
.share-section {
  margin-top: 40px;
  padding: 24px;
  background: #f4f9ff;
  border-radius: 8px;
  border: 1px solid #cce0ff;
  text-align: left;
}

.share-section h3 {
  margin-top: 0;
  color: var(--theme-dark);
  font-size: 1.3rem;
  font-family: var(--font-heading);
}

.share-section p {
  color: var(--text-main);
  margin-bottom: 16px;
}

.share-input-group {
  display: flex;
}

.share-input-group input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 6px 0 0 6px;
  font-family: inherit;
  font-size: 0.95rem;
}

.share-input-group input:focus {
  outline: none;
  border-color: var(--theme-main);
}

.share-input-group button {
  padding: 12px 20px;
  background: var(--dark-slate);
  color: white;
  border: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s;
  white-space: nowrap;
}

.share-input-group button:hover {
  background: #1a252a;
}

/* Gallery Styles */
.gallery-header {
  text-align: center;
  padding: 30px 20px 10px;
}
.gallery-header h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--dark-slate);
  margin: 0 0 10px 0;
}
.gallery-header p {
  color: var(--text-light);
  font-size: 1.1rem;
  margin: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 20px 30px 40px;
}
.gallery-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.gallery-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
  background-color: #f1f5f9;
}
.gallery-info {
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gallery-author {
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding-right: 10px;
}
.gallery-vote-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.grid-vote-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: var(--text-light);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.grid-vote-btn:hover:not(:disabled) {
  border-color: var(--theme-main);
  color: var(--theme-main);
}
.grid-vote-btn.voted {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
  cursor: default;
}
.grid-vote-count {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--dark-slate);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state p {
  font-size: 1.2rem;
  color: var(--text-light);
  margin-bottom: 20px;
}
#btn-be-first {
  background: var(--theme-main);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
#btn-be-first:hover {
  background: var(--theme-dark);
}
#load-more-btn {
  background: white;
  border: 2px solid var(--theme-main);
  color: var(--theme-main);
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
#load-more-btn:hover {
  background: var(--theme-main);
  color: white;
}

/* Lightbox */
#lightbox {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.lightbox-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(5px);
}
.lightbox-content {
  position: relative;
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.lightbox-image-container {
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  flex: 1;
  min-height: 300px;
}
#lightbox-img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
}
.lightbox-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.lightbox-info .caption {
  font-size: 1.1rem;
  line-height: 1.5;
  margin: 0;
}
.lightbox-info .author {
  font-weight: 700;
  color: var(--text-light);
  margin: 0;
}
#lightbox-vote-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
#lightbox-vote-btn {
  background: var(--theme-main);
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}
#lightbox-vote-btn:hover:not(:disabled) {
  background: var(--theme-dark);
}
#lightbox-vote-btn.voted {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
  cursor: default;
}
#lightbox-vote-count {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark-slate);
}
.lb-share-row {
  display: flex;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}
.lb-share-row button {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.2s;
}
.lb-share-row button:hover {
  background: #e2e8f0;
}

#lightbox-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#lightbox-close:hover {
  background: rgba(0,0,0,0.8);
}
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.9);
  color: var(--dark-slate);
  border: none;
  width: 40px;
  height: 60px;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: background 0.2s;
}
.nav-btn:hover {
  background: white;
}
#lightbox-prev { left: 0; border-radius: 0 8px 8px 0; }
#lightbox-next { right: 0; border-radius: 8px 0 0 8px; }

/* Footer Logos */
.campaign-footer {
  background: white;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  margin-bottom: 10px;
}

.footer-logo {
  max-width: 100%;
  height: auto;
  max-height: 120px;
  display: block;
}

/* Hide SDK Attribution */
#wbx-powered-by-slot, .wbx-powered-by {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .pre-title { font-size: 1.5rem; }
  .main-title { font-size: 3.2rem; margin: 5px 0; }
  .subtitle { font-size: 1.3rem; }
  
  .polaroid-decorations { display: none; }
  
  .info-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .campaign-footer {
    padding: 15px;
  }
  
  .footer-logo {
    max-height: 80px;
  }
  
  #contest-form {
    padding: 25px;
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    padding: 15px 15px 30px;
  }
  .lightbox-content {
    width: 95%;
  }
  .nav-btn {
    width: 30px;
    height: 50px;
  }
  .lb-share-row {
    flex-wrap: wrap;
  }
  .lb-share-row button {
    flex: 1;
  }
}