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

:root {
  --primary: #b8860b;
  --primary-dark: #8b6508;
  --bg: #0f0f0f;
  --card-bg: #1a1a1a;
  --card-border: #2a2a2a;
  --text: #f0f0f0;
  --text-muted: #999;
  --success: #4caf50;
  --radius: 12px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ===== Header ===== */
.header {
  text-align: center;
  padding: 3rem 1rem 2rem;
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
  border-bottom: 1px solid var(--card-border);
}
.header-logo {
  max-height: 120px;
  width: auto;
  object-fit: contain;
}
.header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary), #d4a017);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

/* ===== Container ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ===== Shop Grid ===== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.shop-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.shop-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(184, 134, 11, 0.15);
}

.shop-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #222;
}
.shop-card-img-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #222, #1a1a1a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--primary);
}

.shop-card-body {
  padding: 1.25rem;
}
.shop-card-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.shop-card-body h3 a {
  color: var(--text);
}
.shop-card-body h3 a:hover {
  color: var(--primary);
  text-decoration: none;
}
.shop-card-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.shop-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--card-border);
}

.vote-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}
.vote-count span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-vote {
  background: var(--primary);
  color: #fff;
}
.btn-vote:hover {
  background: var(--primary-dark);
}
.btn-vote:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}
.btn-voted {
  background: var(--success);
  color: #fff;
  cursor: default;
}
.btn-share {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}
.btn-share:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== Shop Detail Page ===== */
.shop-detail {
  max-width: 700px;
  margin: 0 auto;
}
.shop-detail-img {
  width: 100%;
  height: 350px;
  object-fit: cover;
  border-radius: var(--radius);
  background: #222;
}
.shop-detail-img-placeholder {
  width: 100%;
  height: 350px;
  background: linear-gradient(135deg, #222, #1a1a1a);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: var(--primary);
}
.shop-detail h1 {
  font-size: 2rem;
  margin-top: 1.5rem;
}
.shop-detail .meta {
  color: var(--text-muted);
  margin: 0.5rem 0 1rem;
}
.shop-detail .description {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #ccc;
  margin-bottom: 2rem;
}
.shop-detail .vote-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.back-link:hover { color: var(--primary); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: transform 0.3s ease;
  z-index: 1000;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 4rem;
  color: var(--text-muted);
}
.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Admin ===== */
.admin-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.admin-login {
  max-width: 400px;
  margin: 4rem auto;
  text-align: center;
}
.admin-login input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  margin: 1rem 0;
}
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}
.form-group textarea {
  min-height: 100px;
  resize: vertical;
}
.admin-shop-list {
  list-style: none;
  margin-top: 1.5rem;
}
.admin-shop-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.admin-shop-list li .shop-name {
  font-weight: 600;
}
.admin-shop-list li .shop-votes {
  color: var(--primary);
  font-size: 0.9rem;
}
.btn-danger {
  background: #c0392b;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
}
.btn-danger:hover { background: #a93226; }
.btn-admin {
  background: var(--primary);
  color: #fff;
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ===== Vote Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-content {
  background: linear-gradient(145deg, #1e1e1e, #161616);
  border: 1px solid rgba(184, 134, 11, 0.2);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03);
  animation: slideUp 0.25s ease;
}
.modal-content h3 {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), #d4a017);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}
.modal-content p {
  text-align: center;
}
.modal-content label {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.modal-content input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-content input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.15);
}
.modal-content input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}
.modal-content .btn-vote {
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #d4a017);
  transition: transform 0.15s, box-shadow 0.15s;
}
.modal-content .btn-vote:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(184, 134, 11, 0.3);
}
.modal-content .btn-share {
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .header h1 { font-size: 1.75rem; }
  .shop-grid { grid-template-columns: 1fr; }
  .shop-detail .vote-section { flex-direction: column; text-align: center; }
}

/* Voting countdown */
.countdown {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem;
  text-align: center;
}
.countdown:empty { display: none; }
.countdown-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.countdown-time {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.countdown-time span {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.5rem;
}
.countdown-time strong {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.countdown-time em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0.25rem;
}
.countdown-ended {
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
@media (max-width: 600px) {
  .countdown-time { gap: 0.75rem; }
  .countdown-time strong { font-size: 1.4rem; }
}

/* Previous-year winner banner */
.winner-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.15), rgba(212, 160, 23, 0.08));
  border: 1px solid rgba(184, 134, 11, 0.4);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1rem;
}
.winner-trophy {
  font-size: 2rem;
  line-height: 1;
}
.winner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.winner-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.winner-name {
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0.15rem;
}
.winner-name a { color: var(--primary); }
.winner-name a:hover { text-decoration: underline; }

/* Celebration mode — full-page winner reveal */
.celebration-view {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.celebration-inner {
  max-width: 720px;
  text-align: center;
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.18), rgba(212, 160, 23, 0.05));
  border: 1px solid rgba(184, 134, 11, 0.5);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  box-shadow: 0 0 60px rgba(184, 134, 11, 0.15);
}
.celebration-trophy {
  font-size: 4.5rem;
  line-height: 1;
  margin-bottom: 1rem;
  animation: trophy-bounce 2s ease-in-out infinite;
}
@keyframes trophy-bounce {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}
.celebration-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 0.5rem;
}
.celebration-name {
  color: var(--primary);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 1.5rem;
}
.celebration-image {
  max-width: 100%;
  height: auto;
  max-height: 360px;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(184, 134, 11, 0.3);
}
.celebration-link {
  display: inline-block;
  margin-top: 0.5rem;
}
@media (max-width: 600px) {
  .celebration-name { font-size: 2rem; }
  .celebration-trophy { font-size: 3rem; }
  .celebration-inner { padding: 2rem 1rem; }
}

/* Voting concluded message */
.concluded-banner {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  max-width: 540px;
  margin: 0 auto;
}
.concluded-trophy {
  font-size: 2.75rem;
  line-height: 1;
  margin-bottom: 1rem;
  opacity: 0.85;
}
.concluded-banner h2 {
  color: var(--primary);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}
.concluded-banner p {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
  line-height: 1.6;
}
.concluded-banner strong {
  color: var(--text);
}
