/* TMQG Branding: teal #2cafc4, coral #e99361, cream #f4f2e9 */
:root {
  --primary: #2cafc4;
  --primary-dark: #1d8a9c;
  --primary-light: #5ec8d8;
  --accent: #e99361;
  --accent-dark: #d97a45;
  --accent-light: #f0b48e;
  --cream: #f4f2e9;
  --warm-white: #faf8f3;
  --text: #2c3e42;
  --text-light: #5a6d72;
  --success: #4a7c59;
  --success-light: #e8f2eb;
  --danger: #e74c3c;
  --shadow: rgba(44, 175, 196, 0.1);
}

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

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

h1, h2, h3 {
  font-family: 'Roboto Slab', Georgia, serif;
}

a {
  color: var(--primary-dark);
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
  padding: 1.5rem 1rem 1.75rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30z' fill='%23ffffff' fill-opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

.header-inner {
  position: relative;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.header p {
  font-size: 0.95rem;
  opacity: 0.92;
}

/* Progress section */
.progress-section {
  background: var(--warm-white);
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(44, 175, 196, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px var(--shadow);
}

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

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.progress-label {
  font-weight: 600;
  color: var(--primary-dark);
}

.progress-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.progress-bar {
  height: 10px;
  background: #e0e8ea;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: 5px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.completion-message {
  text-align: center;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--success-light);
  border-radius: 0.5rem;
  color: var(--success);
  font-weight: 700;
  display: none;
}

.completion-message.visible {
  display: block;
  animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Main */
.main {
  padding: 1.5rem 1rem;
  max-width: 700px;
  margin: 0 auto;
}

/* Card */
.card {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 20px var(--shadow);
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--primary-dark);
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--primary-dark);
}

.instructions ol {
  padding-left: 1.25rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.instructions li {
  margin-bottom: 0.4rem;
}

.restore-line {
  font-size: 0.9rem;
  color: var(--text-light);
  border-top: 1px solid #eee;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

/* Banners */
.banner-success {
  background: var(--success-light) !important;
  border: 2px solid var(--success);
  color: var(--success);
}

.banner-success h2 {
  color: var(--success) !important;
}

.error-banner {
  background: #fdecea;
  color: var(--danger);
  border: 2px solid var(--danger);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e8ea;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 175, 196, 0.15);
}

.form-group small {
  display: block;
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500 !important;
  color: var(--text) !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
  color: white;
  width: 100%;
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233, 147, 97, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--primary-dark);
  border: 2px solid var(--primary);
  padding: 0.75rem 1.25rem;
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--danger);
  color: white;
  width: 100%;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

.btn-check {
  background: var(--primary);
  color: white;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.btn-check:hover:not(:disabled) {
  background: var(--primary-dark);
}

/* Hunt grid */
.hunt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 600px) {
  .hunt-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.hunt-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow);
  transition: all 0.3s;
  position: relative;
  border: 3px solid transparent;
}

.hunt-card.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.hunt-card.correct::after {
  content: '\2713';
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  z-index: 2;
  animation: checkPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkPop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.hunt-image-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--cream);
}

.hunt-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.placeholder-image {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: 'Roboto Slab', serif;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  padding: 1rem;
}

.hunt-card-body {
  padding: 1rem;
}

.hunt-label {
  font-family: 'Roboto Slab', serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
}

.hunt-card.correct .hunt-label {
  color: var(--success);
}

.hunt-input-row {
  display: flex;
  gap: 0.5rem;
}

.hunt-input {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border: 2px solid #e0e8ea;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  min-width: 0;
}

.hunt-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 175, 196, 0.15);
}

.hunt-input:disabled {
  background: rgba(74, 124, 89, 0.08);
  color: var(--success);
  font-weight: 600;
}

.hunt-feedback {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.hunt-feedback.correct {
  color: var(--success);
  font-weight: 600;
}

.hunt-feedback.wrong {
  color: var(--danger);
  font-weight: 500;
}

/* Voted quilt highlight */
.voted-quilt {
  background: var(--cream);
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
  font-size: 1.1rem;
  margin: 0.75rem 0;
}

/* Vote link card on hunt page */
.vote-link-card {
  margin-top: 1.5rem;
  text-align: center;
}

.vote-link-card h3 {
  color: var(--accent-dark);
}

.vote-link-card p {
  color: var(--text-light);
  margin-bottom: 1rem;
}

/* Favourites list */
.fav-form {
  margin-bottom: 1rem;
}

.favourites-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--cream);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}

.fav-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.4;
}

.fav-text em {
  color: var(--text-light);
  font-size: 0.85rem;
}

.fav-empty {
  color: var(--text-light);
  font-style: italic;
  margin-top: 0.5rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 50, 60, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: white;
  border-radius: 1rem;
  padding: 1.75rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal h3 {
  font-family: 'Roboto Slab', serif;
  color: var(--primary-dark);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.modal p {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.modal input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e8ea;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 1rem;
}

.modal input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 175, 196, 0.15);
}

.modal-buttons {
  display: flex;
  gap: 0.5rem;
}

.modal-buttons .btn {
  flex: 1;
  width: auto;
}

.modal-feedback {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.modal-feedback.error { color: var(--danger); }
.modal-feedback.success { color: var(--success); }

/* Admin nav */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.5rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.admin-nav a {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.2s;
}

.admin-nav a:hover {
  background: var(--cream);
  color: var(--primary-dark);
}

.admin-nav a.active {
  background: var(--primary);
  color: white;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  box-shadow: 0 2px 12px var(--shadow);
}

.stat-number {
  font-family: 'Roboto Slab', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* Admin table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.admin-table th {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 0.375rem;
  display: block;
}

.admin-thumb-placeholder {
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: white;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Image preview */
.image-preview {
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  overflow: hidden;
  max-width: 400px;
}

.image-preview img {
  width: 100%;
  display: block;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-light);
  font-size: 0.85rem;
}

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

@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .header h1 {
    font-size: 1.5rem;
  }
}
