/* ============================================================
   OIM3690 Demo Day Voting Site — Shared Styles
   Festive, fun, celebration-oriented theme
   ============================================================ */

/* ----- Custom Properties ----- */
:root {
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-primary-light: #a5b4fc;
  --color-accent: #f59e0b;
  --color-accent-dark: #d97706;
  --color-bg: #faf5ff;
  --color-surface: #ffffff;
  --color-text: #1e1b4b;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-gold: #fbbf24;
  --color-silver: #9ca3af;
  --color-bronze: #d97706;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
  --shadow-lg: 0 8px 24px rgba(99, 102, 241, 0.15);
  --transition: 0.2s ease;
}

/* ----- Base Reset ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ----- Layout Container ----- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ----- Header ----- */
header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.25rem;
}

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

/* ----- Card Grid (Masonry) ----- */
.card-grid {
  column-count: 3;
  column-gap: 1.25rem;
  padding: 1.5rem 0;
}
@media (max-width: 900px) { .card-grid { column-count: 2; } }
@media (max-width: 600px) { .card-grid { column-count: 1; } }

/* ----- Project Card ----- */
.project-card {
  background: var(--color-surface);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  break-inside: avoid;
  margin-bottom: 1.25rem;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.project-card .screenshot {
  width: 100%;
  object-fit: cover;
  background: #e2e8f0;
  cursor: pointer;
}

/* ----- Image Lightbox ----- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 2rem;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.project-card .card-body {
  padding: 0.85rem 1rem;
}

.project-card .card-body h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card .card-body .author {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.project-card .card-body .visit-link {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
}

/* ----- Forms ----- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

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

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

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

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
}

.btn-accent {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger), #dc2626);
  color: #fff;
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

/* ----- Toggle Switch (CSS-only) ----- */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 28px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.toggle-label {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ----- Award Cards ----- */
.award-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.award-card h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.award-card .winner-name {
  font-size: 1.8rem;
  font-weight: 800;
}

.award-card .winner-project {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.award-most-fun {
  background: linear-gradient(135deg, #34d399, #059669);
}

.award-most-useful {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
}

.award-best-project {
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
}

/* ----- Medal Indicators ----- */
.medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

.medal-gold {
  background: var(--color-gold);
  color: #78350f;
}

.medal-silver {
  background: var(--color-silver);
  color: #fff;
}

.medal-bronze {
  background: var(--color-bronze);
  color: #fff;
}

/* ----- Results Reveal Animation ----- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.revealed {
  animation: fadeInUp 0.6s ease forwards;
}

/* ----- Results Page — Projection-Friendly Sizes ----- */
.results-page {
  background: #0f0a1f;
  color: #e2e8f0;
}

.results-page h1 {
  font-size: 3rem;
  -webkit-text-fill-color: #fff;
  background: none;
}

.results-page .award-card h2 {
  font-size: 2rem;
}

.results-page .award-card .winner-name {
  font-size: 2.8rem;
}

.results-page .award-card .winner-project {
  font-size: 1.4rem;
}

.results-page .ranking-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
  font-size: 1.5rem;
}

.results-page .ranking-row .score {
  margin-left: auto;
  font-weight: 800;
  color: var(--color-primary);
  font-size: 1.8rem;
}

/* ----- Password Gate ----- */
.password-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.password-gate h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.password-gate input {
  max-width: 300px;
  margin-bottom: 1rem;
}

/* ----- Thank You / Voting Closed ----- */
.message-box {
  max-width: 520px;
  margin: 3rem auto;
  text-align: center;
  padding: 2.5rem 2rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.message-box h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.message-box p {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* ----- Admin Utilities ----- */
.admin-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.admin-section h2 {
  font-size: 1.2rem;
  margin-bottom: 0.85rem;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.project-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.project-list-item:last-child {
  border-bottom: none;
}

.project-list-item .name {
  font-weight: 600;
  min-width: 140px;
}

.project-list-item .url-field {
  flex: 1;
  min-width: 180px;
}

.project-list-item .screenshot-status {
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}

.screenshot-ok {
  background: #d1fae5;
  color: #065f46;
}

.screenshot-missing {
  background: #fee2e2;
  color: #991b1b;
}

/* ----- Voting Form Section ----- */
.voting-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  margin: 1.5rem 0;
}

.voting-section h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--color-primary-dark);
}

/* ----- Status / Notice Banner ----- */
.notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  text-align: center;
}

.notice-info {
  background: #e0e7ff;
  color: #3730a3;
}

.notice-success {
  background: #d1fae5;
  color: #065f46;
}

.notice-warning {
  background: #fef3c7;
  color: #92400e;
}

.notice-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* ----- Vote Category Sections ----- */
.vote-category {
  background: var(--color-surface);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}
.vote-category-gold { border-left-color: var(--color-gold); background: #fffdf5; }
.vote-category-fun { border-left-color: #10b981; background: #f0fdf4; }
.vote-category-useful { border-left-color: #3b82f6; background: #eff6ff; }

/* ----- Submit Vote Button Pulse ----- */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
.btn-submit-vote {
  animation: pulse 2s ease infinite;
}

/* ----- Results Placeholder Pulse ----- */
@keyframes pulseFade {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.award-card .winner-name-placeholder {
  animation: pulseFade 2s ease infinite;
  font-size: 3rem;
}

/* ----- Confetti on Award Reveal ----- */
.award-card.revealed {
  position: relative;
}
.award-card.revealed::before,
.award-card.revealed::after {
  content: '\1F389';
  position: absolute;
  font-size: 2rem;
  animation: confettiBounce 1s ease forwards;
}
.award-card.revealed::before { left: 1rem; top: 0.5rem; }
.award-card.revealed::after { right: 1rem; top: 0.5rem; content: '\1F38A'; }
@keyframes confettiBounce {
  0% { opacity: 0; transform: translateY(20px); }
  50% { opacity: 1; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ----- Responsive ----- */
@media (max-width: 600px) {
  header h1 {
    font-size: 1.6rem;
  }

  header p {
    font-size: 0.95rem;
  }

  .container {
    padding: 1rem;
  }

  .btn {
    width: 100%;
  }

  .project-list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-page h1 {
    font-size: 2rem;
  }

  .results-page .award-card .winner-name {
    font-size: 1.8rem;
  }
}
