/* Base */
:root {
  --bg: #f7f6f4;
  --green-dark: #203c29;
  --green: #28a745;
  --yellow: #ffc107;
  --red: #dc3545;
  --white: #ffffff;
}

/* Admin Toggle Button */
.admin-toggle {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  z-index: 100;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  font-family: "Titillium Web", sans-serif;
  background: var(--bg);
  color: #111;
}

li {
  list-style-type: none;
}

.screen {
  display: none;
  height: 100%;
  width: 100%;
}
.screen.active {
  display: block;
}

/* HOME SPLIT */
.half {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50%;
  flex-direction: column;
}
.half.top {
  background: var(--bg);
}
.half.bottom {
  background: var(--green-dark);
}

.half button {
  padding: 2rem 4rem;
  font-size: 1.4rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}
.half.top button {
  background: var(--green-dark);
  color: var(--white);
}
.half.bottom button {
  background: var(--white);
  color: var(--green-dark);
}

.trassu-logo {
  width: 20%;
  margin-bottom: 50px;
}

/* LANGUAGE TOGGLE */
.language-toggle img {
  width: 60px;
  height: 60px;
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border 0.2s ease;
}

.language-toggle img.active {
  border-color: var(--green-dark);
}

/* Opcional: espaçamento entre bandeiras já definido inline, mas podes fazer aqui também */
.language-toggle {
  display: flex;
  gap: 8px;
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
}

/* STOCK GRID */
#stock-screen {
  flex-direction: column;
  padding-top: 1rem;
}

#stock-screen.active {
  display: flex;
}

#admin-login-modal.active,
#admin-confirm-modal.active {
  display: flex;
}

#stock-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#search-container {
  padding: 0 1rem 1rem 1rem;
  background: var(--bg);
}

#search-input {
  width: 100%;
  max-width: 600px;
  padding: 10px 14px;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.2s;
}

#search-input:focus {
  outline: none;
  border-color: var(--green-dark);
}

#stock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4rem;
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}
.stock-card {
  background: var(--white);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s;
}
.stock-card:hover {
  transform: scale(1.03);
}
.stock-card img {
  width: 100%;
  object-fit: cover;
  border-radius: 8px;
}
.stock-card p {
  margin: 1rem;
  font-weight: 600;
  color: #222;
}

#back-home {
  position: fixed;
  left: 16px;
  bottom: 16px;
  padding: 10px 16px;
  background: var(--green-dark);
  color: var(--white);
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  padding-top: 56px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: rgba(0, 0, 0, 0.8);
}
.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 80%;
  border-radius: 12px;
}
#modal-caption {
  text-align: center;
  color: #fff;
  margin-top: 8px;
  font-size: 1.1rem;
}
.close {
  position: absolute;
  top: 14px;
  right: 22px;
  color: #fff;
  font-size: 36px;
  font-weight: bold;
  cursor: pointer;
}
.close:hover {
  color: #ccc;
}

/* QUIZ */
#question-container {
  max-width: 900px;
  margin: 32px auto;
  padding: 16px;
  text-align: center;
  opacity: 1;
  transition: opacity 0.5s ease;
}
#question-img {
  max-width: 100%;
  height: 500px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}
#question-text {
  margin-top: 12px;
  font-size: 1.15rem;
  color: #111;
}
#options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.option-btn {
  padding: 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: var(--green-dark);
  color: #fff;
  font-size: 1rem;
  transition:
    transform 0.12s,
    opacity 0.2s;
}
.option-btn:active {
  transform: scale(0.98);
}
.option-btn.correct {
  background: var(--green) !important;
  color: #fff;
}
.option-btn.wrong {
  background: var(--red) !important;
  color: #fff;
}
.option-btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

/* TIMER - wrapper and fill */
#timer-wrapper {
  margin-top: 14px;
  width: 100%;
  display: flex;
  justify-content: center;
}
#timer-bar {
  width: 90%;
  height: 12px;
  background: #e6e6e6;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}
#timer-fill {
  width: 100%;
  height: 100%;
  background: var(--green);
  transition: width linear;
}

/* FEEDBACK (float-up fade-out) */
#feedback-layer {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}
.feedback-bubble {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 0) scale(1);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  transition: all 0.8s ease-out;
}
.feedback-small {
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.95;
}
@keyframes floatUpFade {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(1);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -10px) scale(1.02);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -40px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70px) scale(0.98);
  }
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
  font-size: 1.2rem;
  color: #666;
  font-weight: 500;
}

.no-results {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
  font-size: 1.2rem;
  color: #999;
  font-weight: 500;
  text-align: center;
}

/* EMAIL / LEADERBOARD / Misc */
#email-popup,
#leaderboard-screen {
  align-content: center;
  text-align: center;
  padding: 24px;
}
#player-name,
#player-email {
  display: block;
  width: 90%;
  max-width: 420px;
  margin: 8px auto;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
}
#submit-email,
#export-btn,
#restart-btn {
  margin: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--green-dark);
  color: #fff;
  cursor: pointer;
}

/* ADMIN STYLES */
#admin-screen,
#admin-edit-screen,
#admin-stats-screen {
  padding: 24px;
  overflow-y: auto;
  background: var(--bg);
}

#admin-content,
#admin-edit-content,
#admin-stats-content {
  max-width: 1200px;
  margin: 0 auto;
}

#admin-screen h2,
#admin-edit-screen h2,
#admin-stats-screen h2 {
  color: var(--green-dark);
  margin-bottom: 20px;
}

#admin-screen h3,
#admin-edit-screen h3,
#admin-stats-screen h3 {
  color: #333;
  margin-top: 20px;
  margin-bottom: 12px;
}

#events-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.event-card {
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  transition: border-color 0.2s;
}

.event-card.active {
  border-color: var(--green-dark);
  background: #f0f8f4;
}

.event-header {
  margin-bottom: 12px;
}

.event-header h3 {
  margin: 0 0 4px 0;
  font-size: 1.2rem;
}

.event-date {
  font-size: 0.9rem;
  color: #666;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 8px;
}

.active-badge {
  background: var(--green);
  color: white;
}

.event-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.9rem;
  border: none;
  border-radius: 4px;
  background: var(--green-dark);
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-small:hover {
  background: #1a2a1f;
}

.btn-small.btn-danger {
  background: var(--red);
}

.btn-small.btn-danger:hover {
  background: #bb2d3b;
}

.btn-small.btn-stats {
  background: #0066cc;
}

.btn-small.btn-stats:hover {
  background: #0052a3;
}

#cars-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin: 20px 0;
}


.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.stat-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--green-dark);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: white;
}

.stats-table th {
  background: var(--green-dark);
  color: white;
  padding: 12px;
  text-align: left;
}

.stats-table td {
  padding: 12px;
  border-bottom: 1px solid #ddd;
}

.stats-table tr:hover {
  background: #f5f5f5;
}

.stats-table .sold-row {
  opacity: 0.7;
}

.stock-card.sold {
  opacity: 0.5;
  filter: grayscale(1);
}

.stock-card.sold::after {
  content: "SOLD";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--red);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.9rem;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  #question-img {
    height: 180px;
  }
}
@media (max-width: 600px) {
  .stock-card img {
    height: 120px;
  }
  #options-grid {
    grid-template-columns: 1fr;
  }
  .half button {
    padding: 1.2rem 2rem;
    font-size: 1.05rem;
  }
}

/* ========= ADMIN FORMS ========= */
.admin-form {
  max-width: 400px;
  background: white;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.admin-form label {
  display: block;
  font-weight: 600;
  margin: 12px 0 4px 0;
  color: #333;
}

.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form input[type="date"] {
  display: block;
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 6px;
}

.admin-form input:focus {
  outline: none;
  border-color: var(--green-dark);
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.btn-cancel {
  background: #e0e0e0 !important;
  color: #333 !important;
}

/* ========= ADD CAR OPTIONS ========= */
.add-car-options {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}

.btn-option {
  padding: 20px 24px;
  font-size: 1.1rem;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.btn-option:hover {
  border-color: var(--green-dark);
  transform: scale(1.02);
}

/* ========= SHOPIFY PICKER ========= */
.shopify-loading {
  padding: 40px;
  text-align: center;
  font-size: 1.1rem;
  color: #666;
}

.shopify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}

/* ========= SHOPIFY PICKER FULL-SCREEN ========= */
#admin-edit-screen {
  position: relative;
}

#admin-edit-content:has(.shopify-grid) {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  z-index: 1000;
  overflow-y: auto;
  padding: 40px;
}

#admin-edit-content:has(.shopify-grid) h2 {
  margin-top: 0;
  position: sticky;
  top: -40px;
  background: var(--bg);
  padding: 20px 0;
  z-index: 10;
}

.shopify-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.shopify-item {
  background: white;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.shopify-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.shopify-item-main {
  display: flex;
  padding: 12px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #f9f9f9;
}

.shopify-item-main img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}

.shopify-item-info {
  flex: 1;
}

.shopify-item-name {
  font-weight: 600;
  margin: 0;
  font-size: 0.95rem;
}

.shopify-item-count {
  font-size: 0.8rem;
  color: #888;
  margin: 2px 0 0 0;
}

.shopify-variants {
  padding: 4px 0;
  background: #fafafa;
}

.shopify-variant {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.shopify-variant:hover {
  background: #f0f0f0;
}

.shopify-variant.selected {
  background: #e8f5e9;
  color: #2e7d32;
}

.variant-select-dot {
  width: 12px;
  height: 12px;
  border: 2px solid #ccc;
  border-radius: 50%;
  flex-shrink: 0;
}

.shopify-variant.selected .variant-select-dot {
  background: #2e7d32;
  border-color: #2e7d32;
}

.variant-title {
  flex: 1;
}

.variant-price {
  font-weight: 600;
  color: #555;
}

.shopify-actions {
  position: sticky;
  bottom: -40px;
  background: var(--bg);
  padding: 20px 0;
  display: flex;
  gap: 12px;
  z-index: 10;
  border-top: 1px solid #eee;
  margin-top: 40px;
}

.car-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.car-card.sold {
  opacity: 0.6;
  background: #f9f9f9;
}

.car-card img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.car-card > div {
  flex: 1;
  min-width: 0;
}

.car-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.qty-controls {
  display: flex;
  align-items: center;
  background: #eee;
  border-radius: 6px;
  padding: 2px;
}

.btn-qty {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.btn-qty:hover {
  background: #f5f5f5;
}

.btn-qty:active {
  background: #e0e0e0;
}

/* ========= ADMIN SEARCH ========= */
.admin-search-container {
  margin: 0;
  position: sticky;
  top: 70px; /* Exact height of sticky header + padding */
  background: var(--bg);
  z-index: 5;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.admin-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-search-input:focus {
  outline: none;
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(32, 60, 41, 0.1);
}

.admin-footer-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.no-results {
  text-align: center;
  padding: 40px;
  color: #888;
  font-style: italic;
}

.stock-item-name {
  font-weight: 700;
  margin: 0.5rem 0 0.2rem 0;
  font-size: 1.1rem;
}

.stock-item-variant {
  font-size: 0.9rem;
  color: #777;
  margin: 0;
  font-style: italic;
}

.modal-variant-info {
  font-size: 1.1rem;
  color: #555;
  display: block;
  margin-top: 5px;
}

.stock-item-qty {
  font-size: 0.85rem;
  color: var(--green);
  font-weight: bold;
  margin: 2px 0 0 0;
}

.sold .stock-item-qty {
  color: #888;
}

.shopify-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
}

.shopify-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 6px 0 2px;
  color: #333;
}

.shopify-item-price {
  font-size: 0.9rem;
  color: var(--green-dark);
  font-weight: 700;
  margin: 0;
}

.shopify-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ========= BRANDING & NAV REFINEMENTS ========= */

.admin-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-top-act.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

#stock-header {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: white;
  border-bottom: 2px solid #eee;
  margin-bottom: 1rem;
}

.acf-logo {
  max-width: 300px;
  max-height: 150px;
  object-fit: contain;
  margin-bottom: 2rem;
  border-radius: 8px;
}

.acf-logo-small {
  max-height: 60px;
  max-width: 200px;
  object-fit: contain;
}

/* ========= ADMIN LOGO MANAGEMENT ========= */

.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  gap: 20px;
}

.event-logo-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: white;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid #ddd;
  min-width: 180px;
}

.event-logo-preview img {
  max-width: 150px;
  max-height: 80px;
  object-fit: contain;
  border-radius: 8px;
}

.no-logo {
  width: 150px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  color: #888;
  border-radius: 8px;
  font-style: italic;
  font-size: 0.9rem;
}

/* Tablet / Mobile adjustments */
@media (max-width: 768px) {
  .event-logo-main {
    max-width: 180px;
  }
  
  .edit-header {
    flex-direction: column;
    align-items: center;
  }
}

/* ========= ADMIN NOTIFICATION ========= */
.admin-notification {
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 600;
  display: none;
  animation: slideIn 0.3s ease-out;
}

.admin-notification.active {
  display: block;
}

.admin-notification.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.admin-notification.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

@keyframes slideIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
/* ========= STATS TABS & TABLES ========= */
.stats-header {
  margin-bottom: 24px;
  border-bottom: 1px solid #eee;
  padding-bottom: 16px;
}

.stats-tabs {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.tab-btn {
  padding: 8px 20px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--green-dark);
  color: white;
  border-color: var(--green-dark);
}

.stats-tab-content {
  display: none;
}

.stats-tab-content.active {
  display: block;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stats-table th, .stats-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.stats-table th {
  background: #f8f9fa;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.sold-row {
  background: #fff9f9;
  color: #999;
}

.stats-footer {
  margin-top: 32px;
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

@media (max-width: 600px) {
  .stats-tabs {
    flex-wrap: wrap;
  }
  .tab-btn {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 0.9rem;
  }
}
