/* ------------------------------
   RESET / BASE
------------------------------ */

@font-face {
  font-family: "FinkHeavy";
  src: url("/assets/fonts/FinkHeavy.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ArialRounded";
  src: url("/assets/fonts/ARLRDBD.TTF") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

body {
    background: #f5f7fa;
    color: #222;
    line-height: 1.6;
    font-family: 'ArialRounded', system-ui, sans-serif;
    font-weight: normal;
    font-size: 20px;
}

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

a:hover {
    text-decoration: underline;
}

input[type="submit"],
input[type="button"],
button,
a.button {
    cursor: pointer;
    font-family: "FinkHeavy", system-ui, sans-serif;
    font-size: 20px;
}


/* ------------------------------
   LAYOUT
------------------------------ */

h2 {
  margin-bottom: 10px;
}

.site-header {
    background: #ffffff;
    border-bottom: 1px solid #e3e3e3;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav a {
    margin-right: 1.5rem;
    text-decoration: none;
    color: #333;
    font-weight: 600;
}

.nav a:hover {
    color: var(--accent-dark);
}

.site-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem 1rem 1rem;
    background: rgba(255, 255, 255, 0.9);
}

.site-footer {
    text-align: center;
    padding: 2rem 0;
    color: #777;
    font-size: 0.9rem;
}

ul, ol {
  list-style-position: inside;
  margin-bottom: 35px;
}

/* ------------------------------
   DASHBOARD
------------------------------ */

.dashboard-section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

.dashboard:not(:has(.index-page)) h2 {
    margin-top: 50px;
}

a.button.center {
  margin: 0px auto;
  display: block;
  width: min-content;
  white-space: nowrap;
}

h1 {
    margin-bottom: 10px;
    font-family: "FinkHeavy", system-ui, sans-serif;
    font-size: 40px;
}

p {
    margin-bottom: 30px;
    color: #444;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.card h2 {
    margin-top: 0;
    font-size: 20px;
}

.card p {
    margin: 10px 0 15px;
    color: #666;
}

.card a {
    font-weight: bold;
    color: #0077cc;
    text-decoration: none;
}

.card a:hover {
    text-decoration: underline;
}

.retoken {
  display: block;
  font-size: 12px;
  margin-top: 0px;
}

/* ------------------------------
   WORLD LIST
------------------------------ */

.world-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

/* Example world-card styling */
.world-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #e3e3e3;
    transition: box-shadow 0.2s ease;
}

.world-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.center {
    text-align: center !important;
    margin: 0 auto !important;
}

.pad {
    padding: 20px;
}

/* ------------------------------
   FORMS
------------------------------ */

.form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.form input,
.form select,
.admin-search input {
    width: 100%;
    padding: 0.6rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    margin-bottom: 1rem;
    font-size: 1rem;
    background-color: white;
}

.form input:focus,
.form select:focus,
.admin-search input:focus {
    border-color: #0077cc;
    outline: none;
}

.admin-search {
  position: relative;
  float: right;
  right: 0px;
  width: 275px;
}

.admin-search input[type="text"] {
  width: 70% !important;
  position: absolute;
  left: 0px;
  top: 15px;
}

form:has(.column-half) {
  display: grid;
  grid-template-areas: "left right"
    "full full"
    "button button";
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  column-gap: 50px;
}

form.delete-inline {
    display: inline;
    margin: 0;
    padding: 0;
}

.column-half {
    display: inline-block;
    grid-area: left;

}
.column-half:nth-child(even) {
  position: relative;
  right: 0px;
  grid-area: right;
}

.column-full {
  grid-area: full;
  width: 100%;
  text-align: center;
}

.actions {
    text-align: left;
    display: inline-block;
    width: auto;
    position: relative;
    white-space: nowrap;
}

.form-group.remember-me {
  vertical-align: top;
  display: inline;

  input {
    float: left;
    width: auto;
    margin: 7px;
  }
}

.form-group:has(button) {
  display: flex;
  justify-content: center;
}

/* ------------------------------
   BUTTON COMPONENT
------------------------------ */

.button,
.button-inline,
a.button {
    display: inline-block;
    /*padding: 0.6rem 1.2rem 0.6rem 35px;*/
    border-radius: 6px;
    border: 2px solid var(--accent-dark);
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.button:hover,
.button-inline:hover,
a.button:hover {
    background-color: var(--accent-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.button:active,
.button-inline:active,
a.button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px var(--shadow);
}

.button-light {
    background: var(--accent-light);
    color: #222;
    border-color: var(--accent);
}

.button-light:hover {
    background: var(--accent);
    color: #fff;
}

.button {
    margin-top: 0px;
}

.button-inline[type="submit"] {
  position: absolute;
  right: 0px;
  top: 16px;
}

.button-center {
  grid-area: button;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  margin-top: 20px;
}

/* When there are two buttons */
.button-center:has(:nth-child(2)) {
  grid-template-columns: 1fr 1fr;
  column-gap: 25px;
  justify-items: stretch; /* important */
}

/* Left button (first child) → right aligned */
.button-center .button:nth-child(1) {
  justify-self: end;
}

/* Right button (second child) → left aligned */
.button-center .button:nth-child(2) {
  justify-self: start;
}

.save-prder-btn {
  padding: 5px 10px;
}

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
    margin-right: 0.3em;
}

/* ------------------------------
   ADMIN TABLES
------------------------------ */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

.admin-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.admin-table tr:hover {
    background-color: #f2f2f2;
}

.admin-search button {
    position: absolute;
    right: 0px;
    top: 20px;
    padding: 6px 12px !important;
    border: none;
    background-color: var(--accent);
    color: var(--shadow);
    border-radius: 4px;
    cursor: pointer;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    text-align: center;

    .button.icon-season {
        margin: 0px auto;
    }
}

.danger {
    background-color: #dc3545 !important;
    background-image: none !important;
    color: white !important;
    font-weight: normal;
}

button.danger {
    padding: 0.5rem 1.2rem 0.5rem 1.2rem;
    position: relative;
    top: -1px;
}

a.danger {
    padding: 0.2rem 1.2rem 0.3rem 1.2rem;
    position: relative;
    top: -1px;
}

.danger:hover {
    background-color: #c82333 !important;
}

button.delete-inline {
  top: 0px;
}

.star-level {
    color: #f39c12;
    font-size: 2em;
    line-height: .5em;
    top: 5px;
    position: relative;
    letter-spacing: -0.15em;
}

.alpha-filter {
  margin: 1rem auto;
  text-align: center;
  background-color: var(--accent-light);
}

.alpha-filter a {
  padding: 4px 5px 4px 8px;
  border-radius: 4px;
  text-decoration: none;
  background: var(--button-bg-color);
  color: var(--text-color);
  transition: background-color 0.2s ease;
}

.alpha-filter a,
.pagination a {
  display: inline-block;
}

.alpha-filter a:hover {
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent-dark);
}

.alpha-filter a.active {
  padding: 4px 8px;
  background: var(--accent-dark);
  color: var(--accent-light);
  font-weight: 700;
}

.pagination {
  margin: 1rem auto;
  text-align: center;
  background-color: var(--accent-light);
}

.pagination a {
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
  background: var(--button-bg-color);
  color: var(--text-color);
  transition: background-color 0.2s ease;
}

.pagination a:hover {
  background: var(--accent-light);
  border-radius: 4px;
  color: var(--accent-dark);
}

.pagination a.active {
  padding: 4px 8px !important;
  background: var(--accent-dark);
  color: var(--accent-light);
  font-weight: 700;
}

.alpha-filter {
  margin: 1rem auto;
  text-align: center;
  background-color: var(--accent-light);
}

.pagination {
  margin: 1rem auto;
  text-align: center;
  background-color: var(--accent-light);
}

.site-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
    font-family: "FinkHeavy", system-ui, sans-serif;
    font-size: 25px;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: var(--nav-bg);
    color: var(--nav-text);
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 25px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background: var(--nav-bg);
    min-width: 180px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 10;
    flex-direction: column;
    font-family: system-ui, sans-serif;
    font-size: 1rem;
    background: var(--accent-light);
}

.dropdown-content a {
    padding: 0.5rem 0.75rem;
    display: block;
    white-space: nowrap;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown:hover .dropbtn {
    background: var(--nav-hover-bg);
}

.villager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.villager-card {
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
}
.villager-card img {
    max-width: 100%;
}



.theme-spring {
  background-image: url('/assets/themes/spring-grass.png');

  a.button,
  button {
    padding: 0.2rem 1.2rem 0.2rem 30px;
  }

  .danger {
    padding: 0.5rem 1.2rem 0.3rem 1.2rem;
    position: relative;
    top: 1px;
  }
}

.theme-summer {
  background-image: url('/assets/themes/summer-grass.png');

  a.button,
  button {
    padding: 0.2rem 1.2rem 0.2rem 35px;
  }

  .danger {
    padding: 0.5rem 1.2rem 0.3rem 1.2rem;
    position: relative;
    top: 2px;
  }
}

.theme-autumn { 
  background-image: url('/assets/themes/autumn-grass.png');
  background-size: auto;
  background-repeat: repeat;

  a.button,
  button {
    padding: 0.2rem 1.2rem 0.2rem 41px;
  }

  .danger {
    padding: 0.5rem 1.2rem 0.3rem 1.2rem;
    position: relative;
    top: 2px;
  }
}

.theme-winter {
  background-image: url('/assets/themes/winter-snow-square.png');

  a.button,
  button {
    padding: 0.2rem 1rem 0rem 45px;
  }

  .danger {
    padding: 0.4rem 1.2rem 0.3rem 1.2rem;
  }

  .actions a.button.icon-season,
  .actions button.icon-season,
  .image-grid a,
  .image-grid button,
  .thumbnail-grid button {
    background-image: none;
    padding-left: 1rem;
  }

  .thumbnail-grid button {
    max-height: 45px;
  }

  form.form > button.button {
    padding: 0.2rem 0.6rem !important;
    background-image: none;
  }
}

.theme-winter .button.icon-season[type="submit"] {
    padding: 0.4rem 1.2rem 0.2rem 45px;
}

/* THEMES */
.theme-spring .icon-season {
    background-image: url('/assets/icons/icon-spring.png');
    background-size: 45px;
    background-repeat: no-repeat;
    background-position: -22px -6px;
}

.theme-summer .icon-season {
    background-image: url('/assets/icons/icon-summer.png');
    background-size: 50px;
    background-repeat: no-repeat;
    background-position: -20px;
}

.theme-autumn .icon-season {
    background-image: url('/assets/icons/icon-autumn.png');
    background-size: 45px;
    background-repeat: no-repeat;
    background-position: -6px -7px;
}

.theme-winter .icon-season {
    background-image: url('/assets/icons/icon-winter-2.png');
    background-size: 50px;
    background-repeat: no-repeat;
    background-position: -10px;
    color: var(--shadow);
    padding: 0.6rem 1.2rem 0.6rem 45px;
}

body.theme-spring,
body.theme-summer,
body.theme-fall,
body.theme-winter {
  background-repeat: repeat;
  background-attachment: fixed;
  background-size: auto !important;
}


.featured-world {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 15px;
    align-items: center;
    margin-bottom: 25px;
}

.featured-world img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.featured-world .no-thumb {
    width: 120px;
    height: 120px;
    background: #eee;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.9rem;
    border: 1px solid #ccc;
}

.featured-world .world-name {
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
}

.featured-world .world-owner a {
    text-decoration: none;
    color: #555;
}

.villager-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.villager-featured img {
    width: 250px;
    border-radius: 8px;
}

.villager-gallery {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 50px;
}

.villager-gallery img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
    opacity: 0.8;
}

.villager-gallery img.featured-thumb {
    border: 5px solid #ffb300;
    opacity: 1;
}

.admin-controls {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    width: 100%;
    text-align: center;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.index-page {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
}

.index-header {
    grid-column: span 3;
    text-align: center;
}

.index-subtitle {
    font-size: 18px;
    margin-top: 10px;
    color: #555;
    vertical-align: middle;
    text-align: center;

    img {
      position: relative;
      top: 2px;
      margin: 0 25px;
    }
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto;
  gap: 20px;
}

.index-grid > div {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.index-stats {
    grid-column: span 1;
}

.dropzone {
    border: 2px dashed #888;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    background: #fafafa;
    transition: background 0.2s, border-color 0.2s;
    margin-bottom: 20px;
}
    .dropzone:hover {
    border-color: red !important;
}

.dropzone.dragover {
    background: #eef7ff;
    border-color: #3399ff;
}

.dropzone p {
    margin: 0;
    font-size: 14px;
    color: #555;
}

.dropzone-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.dropzone-thumb {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ccc;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.image-card {
  display: grid;
  grid-column-rows: auto;
  grid-template-areas: 
    "img"
    "btn";
  text-align: center;
  position: relative;
}

.image-card img {
  width: 200px;
  height: 200px;
  object-fit: contain; 
  border-radius: 6px;
  grid-area: img;
  align-items: center;
  justify-items: center;
}

.image-card a {
  grid-area: btn;
  margin-top: 5px;
  text-align: center;
  align-self: center;
  justify-self: center;
}

.image-grid a,
.image-grid button {
  margin-top: 10px;
}

.image-card.featured {
  position: relative;
  overflow: hidden;
}

.featured-badge {
  position:absolute;
  top:2px;
  left:2px;
  background:#ffcc00;
  padding:2px 4px;
  font-size:20px;
  border-radius:3px;
  font-weight:bold;
  pointer-events: none;
}

.image-card.featured::before {
  content: "Featured";
  position: absolute;
  top: 15px;
  left: -40px;
  width: 140px;
  padding: 4px 0;
  background: #ffd86b;
  color: #333;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  transform: rotate(-45deg);
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/*
.image-card.featured .badge {
  content: "Featured";
  width: 48px;
  height: 48px;
  background-image: url("/assets/icons/icon-star-fragment.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center center;
}
*/

.image-gallery {
  display: grid;
  gap: 20px;
}

.main-image img {
  width: 100%;
  max-width: 400px;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 150px);
  gap: 10px;
  margin-bottom: 25px;
}

.thumbnail-grid .thumb {
  width: auto;
  height: 200px;
  object-fit: contain;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease;
  margin-bottom: 25px;
}

.thumbnail-grid .thumb:hover {
  transform: scale(1.05);
}

.thumbnail-grid button {
  height: 100%;
  margin-bottom: 10px;
}

.main-image img {
  transition: opacity 0.2s ease;
}

.main-image img.fade-out {
  opacity: 0;
}

.thumb.active {
  outline: 3px solid #ffd86b;
  outline-offset: 2px;
  border-radius: 6px;
}

#villager-primary-image {
  transition: opacity 0.2s ease;
}

#villager-primary-image.fade-out {
  opacity: 0;
}

.thumb.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.flash {
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.flash.success {
    background: #d8f5d0;
    color: #2e7d32;
}

.flash.error {
    background: #ffd6d6;
    color: #c62828;
}


/* Default: grid */
.villager-list {
  display: none;
}

.villager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 200px);
  gap: 1rem;
  align-content: start;
  justify-content: space-between;
  align-items: start;
  justify-items: center;
}

/* List mode */
.list-view .villager-grid {
  display: none;
}
.list-view .villager-list {
  display: table;
}

/* Grid mode */
.grid-view .villager-grid {
  display: grid;
}
.grid-view .villager-list {
  display: none;
}