/* ============================================================
   HDFarming.com — Hay Day Theme Stylesheet
   ============================================================ */

/* ── Fonts & Reset ── */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:        #F5A623;
  --gold-dark:   #D4831A;
  --gold-light:  #FDE68A;
  --green:       #5A9E2F;
  --green-dark:  #3D7020;
  --green-light: #A8D05A;
  --brown:       #7B4A1E;
  --brown-dark:  #4A2C0E;
  --cream:       #FFF8E7;
  --cream-dark:  #FDF0CC;
  --orange:      #E8722A;
  --red:         #C0392B;
  --blue:        #2980B9;
  --purple:      #8E44AD;
  --teal:        #16A085;
  --shadow:      0 4px 16px rgba(74,44,14,.13);
  --shadow-lg:   0 8px 32px rgba(74,44,14,.18);
  --radius:      14px;
  --radius-sm:   8px;
}

body {
  font-family: 'Nunito', sans-serif;
  background: #FFF8E7;
  color: #3a2a0a;
  min-height: 100vh;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Page Header ── */
.site-header {
  background: linear-gradient(135deg, var(--brown-dark) 0%, var(--brown) 60%, #9B5E28 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 12px 24px;
  gap: 16px;
}

.header-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: #5865F2;
  border: 2px solid rgba(255,255,255,.18);
  border-radius: 50%;
  color: #fff;
  margin-left: auto;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  transition: background .15s, transform .15s;
  text-decoration: none;
}
.header-discord:hover {
  background: #4752c4;
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}
.header-discord svg {
  width: 20px;
  height: 20px;
}
.header-discord--disabled {
  opacity: .55;
  cursor: default;
}
.header-discord--disabled:hover {
  transform: none;
  background: #5865F2;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-icon { font-size: 2rem; line-height: 1; }
.logo-text { display: flex; flex-direction: column; }
.logo-text .title {
  font-family: 'Fredoka One', sans-serif;
  font-size: 1.5rem;
  color: var(--gold);
  line-height: 1;
  letter-spacing: .5px;
}
.logo-text .sub {
  font-size: .72rem;
  color: #d4b896;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Navigation ── */
.site-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 50px;
  font-weight: 700;
  font-size: .9rem;
  color: #ffe9c0;
  transition: background .2s, color .2s, transform .15s;
  text-decoration: none;
}
.nav-link:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; transform: translateY(-1px); }
.nav-link.active { background: var(--gold); color: var(--brown-dark); }
.nav-link .nav-icon { font-size: 1.1rem; }

/* ── Page Wrapper ── */
.page-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ── Section Header ── */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.section-head .icon { font-size: 2rem; }
.section-head h2 {
  font-family: 'Fredoka One', sans-serif;
  font-size: 1.7rem;
  color: var(--brown-dark);
}
.section-head p { font-size: .9rem; color: #6b4a1e; margin-top: 2px; }

/* ── Hero Banner ── */
.hero {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 50%, var(--green-light) 100%);
  border-radius: var(--radius);
  padding: 40px 36px;
  color: #fff;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  display: none;
}
.hero h1 {
  font-family: 'Fredoka One', sans-serif;
  font-size: 2.4rem;
  margin-bottom: 8px;
  text-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.hero p { font-size: 1.05rem; opacity: .9; max-width: 560px; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--gold);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-info .num {
  font-family: 'Fredoka One', sans-serif;
  font-size: 1.9rem;
  color: var(--brown-dark);
  line-height: 1;
}
.stat-info .label { font-size: .8rem; color: #7a5a2a; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }

/* ── Cards Grid ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.hay-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hay-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--gold-light); }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-name { font-family: 'Fredoka One', sans-serif; font-size: 1.2rem; color: var(--brown-dark); line-height: 1.2; }
.card-tag { font-family: 'Courier New', monospace; font-size: .82rem; color: var(--green-dark); background: #e8f5d0; padding: 2px 8px; border-radius: 50px; font-weight: 700; }

.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.card-row { display: flex; align-items: center; gap: 6px; font-size: .88rem; color: #5a3e1a; }
.card-row .row-icon { font-size: 1rem; flex-shrink: 0; }
.card-row strong { color: var(--brown-dark); }

.card-notes { font-size: .82rem; color: #7a5a2a; background: var(--cream-dark); padding: 8px 10px; border-radius: var(--radius-sm); border-left: 3px solid var(--gold); font-style: italic; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-gold     { background: #FDE68A; color: #7B4A1E; border: 1.5px solid #F5A623; }
.badge-green    { background: #D1FAE5; color: #065F46; border: 1.5px solid #34D399; }
.badge-blue     { background: #DBEAFE; color: #1E40AF; border: 1.5px solid #60A5FA; }
.badge-purple   { background: #EDE9FE; color: #5B21B6; border: 1.5px solid #A78BFA; }
.badge-red      { background: #FEE2E2; color: #991B1B; border: 1.5px solid #FCA5A5; }
.badge-orange   { background: #FFEDD5; color: #9A3412; border: 1.5px solid #FB923C; }
.badge-gray     { background: #F3F4F6; color: #374151; border: 1.5px solid #D1D5DB; }
.badge-teal     { background: #CCFBF1; color: #134E4A; border: 1.5px solid #5EEAD4; }

/* League-specific badges */
.league-champion { background: #FDE68A; color: #7B4A1E; border: 1.5px solid #F59E0B; }
.league-expert   { background: #DBEAFE; color: #1E40AF; border: 1.5px solid #3B82F6; }
.league-pro      { background: #EDE9FE; color: #5B21B6; border: 1.5px solid #8B5CF6; }
.league-advanced { background: #D1FAE5; color: #065F46; border: 1.5px solid #10B981; }
.league-rookie   { background: #F3F4F6; color: #374151; border: 1.5px solid #9CA3AF; }

.status-open   { background: #D1FAE5; color: #065F46; border: 1.5px solid #34D399; }
.status-closed { background: #FEE2E2; color: #991B1B; border: 1.5px solid #FCA5A5; }

/* ── Search & Filters ── */
.toolbar {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border: 2px solid var(--gold-light);
  border-radius: 50px;
  padding: 8px 16px;
  flex: 1;
  min-width: 200px;
}
.search-box input {
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: .95rem;
  width: 100%;
  outline: none;
  color: var(--brown-dark);
}
.search-box .search-icon { font-size: 1rem; color: var(--gold-dark); flex-shrink: 0; }

.filter-select {
  padding: 9px 14px;
  border: 2px solid var(--gold-light);
  border-radius: 50px;
  background: var(--cream);
  font-family: 'Nunito', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--brown-dark);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23D4831A' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.filter-select:focus { border-color: var(--gold); }

.result-count {
  font-size: .85rem;
  font-weight: 700;
  color: var(--green-dark);
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.toolbar-btn {
  padding: 9px 16px;
  border: 2px solid var(--gold-light);
  border-radius: 50px;
  background: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--brown-dark);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.toolbar-btn:hover { background: var(--cream-dark); border-color: var(--gold); }
.toolbar-btn.primary { background: var(--green); color: #fff; border-color: var(--green-dark); }
.toolbar-btn.primary:hover { background: var(--green-dark); }

.level-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 2px solid var(--gold-light);
  border-radius: 50px;
  background: var(--cream);
  flex-shrink: 0;
}
.level-label {
  font-family: 'Nunito', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--brown-dark);
  white-space: nowrap;
}
.level-input {
  width: 56px;
  min-width: 56px;
  padding: 0;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--brown-dark);
  outline: none;
}
.level-input:focus { outline: none; }
.level-field:focus-within { border-color: var(--gold); }

.filter-wrap { display: inline-flex; }
.filter-wrap.is-hidden { display: none; }

.view-toggle {
  display: inline-flex;
  border: 2px solid var(--gold-light);
  border-radius: 50px;
  overflow: hidden;
}
.view-toggle-btn {
  padding: 9px 14px;
  border: none;
  background: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--brown);
  cursor: pointer;
}
.view-toggle-btn.active {
  background: var(--gold);
  color: var(--brown-dark);
}

.copy-tag-btn {
  padding: 5px 12px;
  border: 2px solid var(--green-light);
  border-radius: 50px;
  background: #eef8e3;
  font-family: 'Nunito', sans-serif;
  font-size: .78rem;
  font-weight: 800;
  color: var(--green-dark);
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.copy-tag-btn:hover { background: #dff0c8; transform: translateY(-1px); }
.copy-tag-btn.copied { background: var(--green); color: #fff; border-color: var(--green-dark); }

.card-description {
  font-size: .86rem;
  color: #6b4a1e;
  line-height: 1.5;
}

.submit-banner {
  background: #fff;
  border: 2px dashed var(--gold);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.submit-banner p {
  margin: 0;
  font-size: .92rem;
  color: #7a5a2a;
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--brown-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: 50px;
  font-size: .88rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .2s, transform .2s;
  z-index: 300;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

.list-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Tabs ── */
.tabs-nav {
  display: flex;
  gap: 4px;
  background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 12px 0;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  border-bottom: 3px solid var(--gold-light);
}

.tab-btn {
  padding: 9px 16px;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  color: #7a5a2a;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tab-btn:hover { background: var(--cream-dark); color: var(--brown-dark); }
.tab-btn.active { background: var(--gold); color: var(--brown-dark); }

.tab-panel {
  display: none;
  background: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  min-height: 200px;
}
.tab-panel.active { display: block; }

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}
.hay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.hay-table th {
  background: var(--brown-dark);
  color: var(--gold-light);
  font-family: 'Fredoka One', sans-serif;
  font-size: .9rem;
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
}
.hay-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.hay-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.hay-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0e8d0;
  vertical-align: middle;
  color: #3a2a0a;
}
.hay-table tr:last-child td { border-bottom: none; }
.hay-table tr:nth-child(even) td { background: #fffbf0; }
.hay-table tr:hover td { background: #fef3cc; }

/* Progress bar */
.prog-bar { background: #e8dfc0; border-radius: 50px; height: 8px; overflow: hidden; min-width: 80px; }
.prog-fill { height: 100%; border-radius: 50px; background: linear-gradient(90deg, var(--green), var(--green-light)); transition: width .4s; }

/* ── Friends page sub-tabs ── */
.sub-tabs-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.sub-tab-btn {
  padding: 8px 18px;
  border: 2px solid var(--gold-light);
  border-radius: 50px;
  background: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: .88rem;
  font-weight: 700;
  color: var(--brown);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sub-tab-btn:hover { background: var(--cream-dark); }
.sub-tab-btn.active { background: var(--green); color: #fff; border-color: var(--green-dark); }

/* ── Loading / Error / Empty States ── */
.loading-state, .error-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 12px;
  color: #7a5a2a;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}
.error-state { color: var(--red); }

.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--gold-light);
  border-top-color: var(--gold-dark);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state span { font-size: 3rem; }
.empty-state p { color: #9a7040; }

/* ── Page-specific hero colors ── */
.hero-companion  { background: linear-gradient(135deg, #2C6E49 0%, #52B788 100%); }
.hero-neighbors  { background: linear-gradient(135deg, #7B4A1E 0%, #C87941 100%); }
.hero-friends    { background: linear-gradient(135deg, #1B4F72 0%, #2E86C1 100%); }
.hero-designs    { background: linear-gradient(135deg, #6B3FA0 0%, #9B59B6 55%, #D4A5F5 100%); }

/* ── Hub page quick-links ── */
.quicklinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}
.quicklink-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 5px solid var(--gold);
  text-decoration: none;
  color: inherit;
  transition: transform .2s, box-shadow .2s;
}
.quicklink-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); text-decoration: none; }
.quicklink-card.green-top { border-top-color: var(--green); }
.quicklink-card.blue-top  { border-top-color: var(--blue); }
.quicklink-card.purple-top { border-top-color: var(--purple); }
.quicklink-card .ql-icon  { font-size: 2.8rem; }
.quicklink-card h3 { font-family: 'Fredoka One', sans-serif; font-size: 1.3rem; color: var(--brown-dark); }
.quicklink-card p  { font-size: .88rem; color: #7a5a2a; line-height: 1.5; }
.quicklink-card .ql-arrow { margin-top: auto; font-size: .85rem; font-weight: 800; color: var(--green-dark); }

/* ── Footer ── */
footer {
  background: var(--brown-dark);
  color: #d4b896;
  text-align: center;
  padding: 20px;
  font-size: .82rem;
}
footer a { color: var(--gold-light); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .site-nav { width: 100%; }
  .header-discord { margin-left: 0; }
  .hero h1 { font-size: 1.7rem; }
  .hero::before { display: none; }
  .tab-btn { font-size: .78rem; padding: 7px 10px; }
  .cards-grid { grid-template-columns: 1fr; }
}

/* ── Discord link button ── */
.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #5865F2;
  color: #fff;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 700;
  text-decoration: none;
}
.discord-btn:hover { background: #4752c4; color: #fff; text-decoration: none; }

/* ── Tooltip ── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--brown-dark);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: .75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  z-index: 50;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Coming Soon ── */
.coming-soon-wrap {
  background: #fff;
  border-radius: var(--radius);
  padding: 48px 32px;
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}
.coming-soon-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--brown-dark);
  font-family: 'Fredoka One', sans-serif;
  font-size: .95rem;
  padding: 8px 20px;
  border-radius: 50px;
  letter-spacing: .5px;
  margin-bottom: 20px;
}
.coming-soon-wrap h2 {
  font-family: 'Fredoka One', sans-serif;
  font-size: 1.8rem;
  color: var(--brown-dark);
  margin-bottom: 12px;
}
.coming-soon-lead {
  font-size: 1rem;
  color: #7a5a2a;
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto 28px;
}
.coming-soon-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}
.coming-soon-feature {
  background: var(--cream-dark);
  border: 1.5px solid var(--gold-light);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--brown);
}
.coming-soon-note {
  font-size: .9rem;
  color: #7a5a2a;
  margin-bottom: 14px;
}
.coming-soon-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.quicklink-card.coming-soon-card {
  opacity: .85;
  border-top-color: var(--gold);
  position: relative;
}
.quicklink-card.coming-soon-card .ql-arrow { color: var(--gold-dark); }

/* ── No-sheet notice ── */
.no-sheet-notice {
  background: #FFF3CD;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.no-sheet-notice .icon { font-size: 1.8rem; flex-shrink: 0; }
.no-sheet-notice h4 { font-family: 'Fredoka One', sans-serif; color: var(--brown-dark); font-size: 1.1rem; }
.no-sheet-notice p  { font-size: .88rem; color: #7a5a2a; margin-top: 4px; }
.no-sheet-notice code { background: rgba(0,0,0,.08); padding: 1px 5px; border-radius: 4px; font-size: .84rem; }
