/* ============================================
   BEST ELDEN RING TRACKER - FLUID LAYOUT
   Inspired by elden-ring-progression-tracker
   ============================================ */

/* === CSS Variables === */
:root {
  --gold: #ead684f2;
  --text-primary: rgb(206, 196, 178);
  --text-secondary: #b0b0b0;
  --text-muted: #808080;
  --success-color: #6e640c;
  --error-color: #f44336;
  --border-color: #333;
  --card-bg: rgba(0, 0, 0, 0.7);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0a0a0a;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-y: scroll;
  overflow-x: hidden;
  position: relative;
}

/* Background Wallpaper System */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* background-image: url('../wallpaper/ranni_art.jpg'); */
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: -2;
  opacity: 0.8;
}

/* Dark overlay for better readability */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(15, 15, 15, 0.85) 0%, rgba(26, 26, 26, 0.85) 100%);
  z-index: -1;
}

/* Portrait wallpaper with parallax effect */
@media (orientation: portrait) {
  body::before {
    position: absolute;
    background-attachment: scroll;
    background-size: cover;
    background-position: center top;
    height: 200vh;
    /* Extended height for parallax effect */
  }
}

/* Landscape wallpaper fixed center */
@media (orientation: landscape) {
  body::before {
    position: fixed;
    background-attachment: fixed;
    background-size: cover;
    background-position: center center;
  }
}

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

/* === Container === */
.container {
  max-width: 1400px;
  margin: 50px auto;
  padding: 30px;
  background-color: rgba(0, 0, 0, 0.75);
  border-radius: 8px;
  position: relative;
  backdrop-filter: blur(10px);
}

/* === Header === */
.header {
  text-align: center;
  padding: 20px;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 20px;
  position: relative;
}

.header-nav {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(218, 165, 32, 0.2), rgba(184, 134, 11, 0.2));
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: 'Mantinia', serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.donate-btn:hover {
  background: linear-gradient(135deg, rgba(218, 165, 32, 0.4), rgba(184, 134, 11, 0.4));
  color: #fff;
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(218, 165, 32, 0.4);
  text-decoration: none;
}

.donate-btn .donate-icon,
.donate-btn-footer .donate-icon {
  fill: currentColor;
  flex-shrink: 0;
}

.header::before {
  content: '';
  display: none;
}

.logo {
  display: block;
  margin: 0 auto 10px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
}

.header h1 {
  font-family: 'Mantinia', serif;
  color: var(--gold);
  font-size: 2.8rem;
  margin-bottom: 5px;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
  letter-spacing: 4px;
}

.subtitle {
  font-family: 'Mantinia', serif;
  color: var(--text-secondary);
  font-size: 1rem;
  opacity: 0.9;
  letter-spacing: 1px;
}

/* === Upload Section === */
.upload-section {
  background: rgba(40, 35, 30, 0.6);
  border: 1px solid rgba(218, 165, 32, 0.3);
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 20px;
}

.upload-compact {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.file-hint {
  font-size: 13px;
  color: #888;
  font-family: monospace;
}

.slot-options-container {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.slot-dropdown {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(218, 165, 32, 0.5);
  color: #daa520;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
}

.options-inline {
  display: flex;
  gap: 15px;
  align-items: center;
}

.options-inline label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  cursor: pointer;
}

.options-inline input[type="checkbox"] {
  cursor: pointer;
}

.upload-section input[type="file"] {
  display: none;
}

.upload-section .file-label {
  background: linear-gradient(135deg, rgba(218, 165, 32, 0.2), rgba(184, 134, 11, 0.2));
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.upload-section .file-label:hover {
  background: linear-gradient(135deg, rgba(218, 165, 32, 0.3), rgba(184, 134, 11, 0.3));
  transform: translateY(-1px);
}

/* === Slot & Options Section === */
.slot-section,
.options-section {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.slot-section h3,
.options-section h3 {
  color: var(--gold);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

select#slot-selector {
  width: 100%;
  padding: 12px;
  background-color: rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
}

select#slot-selector option {
  background-color: rgba(0, 0, 0, 0.115);
  color: var(--text-primary);
}

.option-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.option-item:last-child {
  border-bottom: none;
}

.option-item input[type="checkbox"] {
  margin-right: 10px;
  cursor: pointer;
}

.option-item label {
  cursor: pointer;
  flex: 1;
}

/* === Button === */
button {
  background: linear-gradient(135deg, var(--gold) 0%, #b8941f 100%);
  color: #000;
  border: none;
  padding: 15px 40px;
  font-family: 'Mantinia', serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  width: 100%;
  margin-top: 20px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(212, 175, 55, 0.4);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* === Loading Spinner === */
.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid var(--gold);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* === Dashboard === */
.dashboard {
  background: rgba(40, 35, 30, 0.6);
  border: 1px solid rgba(218, 165, 32, 0.3);
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 15px;
}

.global-stats-horizontal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.character-info {
  font-size: 14px;
  color: #bbb;
}

.character-info strong {
  color: #daa520;
  font-size: 16px;
}

.progress-large {
  font-size: 24px;
  color: #daa520;
  font-weight: bold;
}

.progress-large strong {
  font-size: 32px;
}

.items-count {
  font-size: 14px;
  color: #888;
}

.items-count span {
  color: #daa520;
  font-weight: 600;
}

/* === Progress Bar === */
.progress-bar-container {
  background-color: rgba(54, 54, 54, 0.3);
}

.progress-bar {
  background-color: rgba(255, 233, 37, 0.5);
  height: 30px;
  border-radius: 15px;
  overflow: hidden;
  margin: 15px 0;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50 0%, #8bc34a 100%);
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}

/* === Category Stats === */
.category-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.category-card {
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 15px;
  text-align: center;
}

.category-card h4 {
  color: var(--gold);
  margin-bottom: 10px;
  font-size: 1rem;
}

.category-card .count {
  color: var(--text-primary);
  font-size: 1.3rem;
  margin-bottom: 8px;
}

/* === Filters === */
.filters-compact {
  background: rgba(40, 35, 30, 0.6);
  border: 1px solid rgba(218, 165, 32, 0.3);
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: 1px solid rgba(218, 165, 32, 0.5);
  border-radius: 4px;
  font-size: 14px;
}

.search-input::placeholder {
  color: #888;
}

.filter-radio {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  cursor: pointer;
  color: #bbb;
}

.filter-radio input[type="radio"] {
  cursor: pointer;
}

.filter-select {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.4);
  color: #daa520;
  border: 1px solid rgba(218, 165, 32, 0.5);
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-select:hover {
  background: rgba(0, 0, 0, 0.6);
  border-color: var(--gold);
}

.filter-select option {
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
}

/* === Regions Accordion === */
.regions-container {
  margin-top: 30px;
}

.region {
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.3);
}

/* Region Header */
.region-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.region-header:hover {
  background: rgba(212, 175, 55, 0.1);
}

.region-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Mantinia', serif;
  font-weight: 800;
  font-size: 1.4em;
  color: var(--gold);
  letter-spacing: 1px;
}

.region-title .arrow::before {
  content: '►';
  font-size: 0.7em;
  transition: transform 0.3s ease;
  display: inline-block;
}

.region-header.active .region-title .arrow::before {
  content: '▼';
}

.region-stats {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 1rem;
}

.counter {
  color: var(--text-secondary);
  font-weight: 600;
}

.region-percentage {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1em;
}

/* Region Content */
.region-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.region-content.active {
  max-height: 10000px;
}

/* Subregion */
.subregion {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.subregion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--gold);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  margin: 12px 0;
}

.subregion-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.subregion-title {
  font-family: 'Mantinia', serif;
  font-weight: 600;
  font-size: 1.15em;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.subregion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  padding: 0 15px;
}

.subregion-content.active {
  max-height: 10000px;
  padding: 15px;
}

/* === Items Grid (Flexbox like progression tracker) === */
.items-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  width: 100%;
}

/* === Item Card (Card-based like progression tracker) === */
.item-card {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  width: calc((100% - 35px) / 8);
  /* Fit 8 items per row by default */
  min-width: 130px;
  min-height: 220px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
}

.item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(212, 175, 55, 0.3);
}

.item-card.owned {
  background: rgba(116, 116, 110, 0.15);
  border: 2px solid var(--success-color);
}

.item-card.missing {
  background: rgba(100, 100, 100, 0.3);
  opacity: 0.8;
  border: 1px solid var(--border-color);
}

.item-card.missing img {
  opacity: 0.5;
}

/* Item Card Components */
.item-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
  width: 100%;
}

.item-name {
  font-weight: 600;
  color: var(--gold);
  font-size: 0.85em;
  word-wrap: break-word;
  width: 100%;
  line-height: 1.2;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Item Image (Main) */
.item-image {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
}

.item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Type Icons (Below image) */
.item-type-icons {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
  min-height: 24px;
}

.item-type-icons .type-icon {
  width: 24px;
  height: 24px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
}

.item-type-icons .farmable-icon {
  font-size: 1.4em;
}

.item-hint {
  color: var(--text-muted);
  font-size: 0.7em;
  line-height: 1.3;
  padding: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  width: 100%;
  max-height: 60px;
  overflow-y: auto;
  overflow-x: auto;
  text-align: left;
  flex: 1;
}

.item-hint a {
  color: var(--gold);
  text-decoration: none;
  display: block;
  margin-top: 6px;
  font-size: 0.85em;
  text-align: center;
}

.item-hint a:hover {
  text-decoration: underline;
}

/* Custom scrollbar for hints */
.item-hint::-webkit-scrollbar {
  width: 3px;
}

.item-hint::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.item-hint::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 2px;
}

/* === Error Display === */
.error {
  background-color: rgba(244, 67, 54, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
  padding: 15px;
  border-radius: 6px;
  margin: 20px 0;
  text-align: center;
}

/* === Footer === */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer .container {
  margin: 0 auto;
  padding: 25px;
}

.footer p {
  margin: 10px 0;
}

.footer a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  text-decoration: underline;
  color: #fff;
}

.footer .credits {
  font-size: 0.85rem;
  opacity: 0.8;
}

.footer .disclaimer {
  font-size: 0.8rem;
  opacity: 0.6;
}

.footer-donation {
  margin-bottom: 20px;
}

.donate-btn-footer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(218, 165, 32, 0.15), rgba(184, 134, 11, 0.15));
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 10px 22px;
  border-radius: 24px;
  font-family: 'Mantinia', serif;
  font-size: 1rem;
  letter-spacing: 1.5px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.donate-btn-footer:hover {
  background: linear-gradient(135deg, rgba(218, 165, 32, 0.35), rgba(184, 134, 11, 0.35));
  color: #fff;
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(218, 165, 32, 0.35);
  text-decoration: none;
}

/* === Hidden Utility === */
.hidden {
  display: none !important;
}

/* === Responsive Design === */
@media (max-width: 1200px) {
  .container {
    margin: 30px 20px;
    padding: 20px;
  }

  .header h1 {
    font-size: 2.4rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .upload-section .file-label {
    font-size: 13px;
  }

  .file-hint {
    font-size: 12px;
  }

  .item-card {
    width: 145px;
    min-height: 210px;
  }
}

@media (max-width: 768px) {
  .header-nav {
    position: static;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
  }

  .donate-btn {
    font-size: 0.85rem;
    padding: 6px 14px;
  }

  .logo {
    height: 100px;
  }

  .header h1 {
    font-size: 1.8rem;
    letter-spacing: 2px;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .upload-section .file-label {
    font-size: 12px;
    padding: 6px 12px;
  }

  .file-hint {
    font-size: 10px;
    width: 100%;
  }

  .footer {
    font-size: 0.85rem;
  }

  .stats-row {
    flex-direction: column;
  }

  .filter-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .item-card {
    width: 140px;
    min-height: 200px;
    margin: 4px;
  }

  .region-title {
    font-size: 1.2em;
  }

  .subregion-title {
    font-size: 1em;
  }
}

@media (max-width: 480px) {
  .logo {
    height: 50px;
  }

  .header h1 {
    font-size: 1.4rem;
    letter-spacing: 1px;
  }

  .subtitle {
    font-size: 0.75rem;
  }

  .upload-section .file-label {
    font-size: 11px;
    padding: 6px 10px;
  }

  .file-hint {
    font-size: 9px;
    display: block;
    width: 100%;
    overflow-x: auto;
  }

  .footer {
    font-size: 0.75rem;
  }

  .footer p {
    margin: 8px 0;
  }

  .container {
    margin: 15px 10px;
    padding: 15px;
  }

  .item-card {
    width: calc(50% - 10px);
    min-height: 180px;
  }
}

/* === Print Styles === */
@media print {
  body {
    background: white;
    color: black;
  }

  .header-nav,
  .footer-donation,
  .upload-section,
  .options-section,
  .filters,
  button {
    display: none;
  }
}
