:root {
  /* Orange based theme */
  /*
  --primary-color: #E36C0C;
  --secondary-color: #51423B;
  --bg-light: #FFF5E6;
  --bg-medium: #FFE1B0;
  --bg-container: #FFCC8F;
  --text-color: #5A5A5A;
  */
  
  /* Yellow based theme */
  --primary-color: #76520e;
  --secondary-color: #51423B;
  --bg-light: #fdf8e1;
  --bg-medium: #fcefb4;
  --bg-container: #f9dc5c;
  --text-color: #5A5A5A;
}

body {
  font-family: 'Poppins', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-medium) 100%);
  margin: 0;
  padding: 30px;
  color: var(--text-color);
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg-container);
  padding: 16px;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Stork Animation Styles */
.stork-animation-container {
  position: relative;
  width: 100%;
  height: 400px;
  margin: 20px 0 30px 0;
  overflow: hidden;
  background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 50%, var(--bg-container) 100%);
  border-radius: 15px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Branch */
.branch {
  position: absolute;
  top: 63%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 15px;
  background: linear-gradient(to bottom, #8B4513 0%, #654321 100%);
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.branch::before {
  content: '';
  position: absolute;
  left: -20px;
  top: -5px;
  width: 40px;
  height: 8px;
  background: linear-gradient(to bottom, #8B4513 0%, #654321 100%);
  border-radius: 5px;
  transform: rotate(-25deg);
}

.branch::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -5px;
  width: 40px;
  height: 8px;
  background: linear-gradient(to bottom, #8B4513 0%, #654321 100%);
  border-radius: 5px;
  transform: rotate(25deg);
}

/* Stork Container */
.stork {
  position: absolute;
  left: -150px;
  top: 50%;
  transform: translateY(-50%);
  width: 120px;
  height: 100px;
  animation: flyIn 4s ease-in-out forwards;
  z-index: 20;
}

/* Stork Body */
.stork-body {
  position: absolute;
  left: 20px;
  top: 20px;
  width: 50px;
  height: 60px;
  background: white;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Stork Head */
.stork-head {
  position: absolute;
  left: 65px;
  top: 10px;
  width: 35px;
  height: 35px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Stork Beak */
.stork-beak {
  position: absolute;
  right: -25px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 35px solid #FF6B35;
  border-radius: 5px 0 0 5px;
}

/* Drop-shaped element in Beak */
.stork-olive-branch {
  position: absolute;
  left: -22px;
  top: 12px;
  transform: translateY(-50%);
  width: 18px;
  height: 24px;
  background: linear-gradient(135deg, #E8F4F8 0%, #d8d174 50%, #97972a 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 20% 60%;
  clip-path: polygon(50% 0%, 100% 85%, 100% 100%, 0% 100%, 0% 85%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.stork-olive-branch::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

/* Stork Eye */
.stork-eye {
  position: absolute;
  left: 8px;
  top: 10px;
  width: 6px;
  height: 6px;
  background: black;
  border-radius: 50%;
}

/* Stork Wings */
.stork-wing {
  position: absolute;
  background: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border-radius: 0 100% 100% 0 / 0 50% 50% 0;
  transform-origin: left center;
}

.stork-wing-left {
  left: 42px;
  top: 45px;
  width: 60px;
  height: 25px;
  transform-origin: left center;
  transform: rotate(230deg);
  animation: flapLeft 0.3s ease-in-out infinite;
}

.stork-wing-right {
  left: 52px;
  top: 45px;
  width: 60px;
  height: 25px;
  transform-origin: left center;
  transform: rotate(200deg);
  animation: flapRight 0.3s ease-in-out infinite;
}

/* Add wing feather details */
.stork-wing::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 30%;
  height: 100%;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.05) 0%, transparent 100%);
  border-radius: 0 100% 100% 0 / 0 50% 50% 0;
}

/* Stork Legs */
.stork-legs {
  position: absolute;
  left: calc(50% - 12px);
  bottom: -6px;
  transform: translateX(-50%);
  width: 30px;
  height: 25px;
  transition: bottom 0.5s ease;
}

.stork.landed .stork-legs {
  bottom: -7px;
}

.stork-leg {
  position: absolute;
  width: 4px;
  background: #FF6B35;
  border-radius: 2px;
  transition: height 0.5s ease;
}

.stork-leg-left {
  left: 8px;
  height: 25px;
  transform-origin: top center;
}

.stork-leg-right {
  right: 8px;
  height: 25px;
  transform-origin: top center;
}

.stork.landed .stork-leg {
  height: 20px;
}

/* Animations */
@keyframes flyIn {
  0% {
    left: -150px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
  }
  50% {
    left: calc(50% - 60px);
    top: 30%;
    transform: translateY(-50%) rotate(-3deg);
  }
  70% {
    left: calc(50% - 60px);
    top: 40%;
    transform: translateY(-50%) rotate(2deg);
  }
  85% {
    left: calc(50% - 60px);
    top: 50%;
    transform: translateY(-50%) rotate(-1deg);
  }
  100% {
    left: calc(50% - 60px);
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
  }
}

@keyframes flapLeft {
  0%, 100% {
    transform: rotate(230deg) scaleY(1);
  }
  50% {
    transform: rotate(250deg) scaleY(0.8);
  }
}

@keyframes flapRight {
  0%, 100% {
    transform: rotate(200deg) scaleY(1);
  }
  50% {
    transform: rotate(220deg) scaleY(0.8);
  }
}

/* Stop wing flapping when landed */
.stork.landed .stork-wing-left {
  animation: none;
  transform: rotate(230deg) scaleY(1);
}

.stork.landed .stork-wing-right {
  animation: none;
  transform: rotate(200deg) scaleY(1);
}

/* Add landed class after animation completes */
.stork {
  animation: flyIn 4s ease-in-out forwards;
}

.stork::after {
  content: '';
  animation: flyIn 4s ease-in-out forwards;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .stork-animation-container {
    height: 300px;
    margin: 15px 0 20px 0;
  }
  
  .branch {
    width: 200px;
    top: 62%;
    transform: translate(-50%, -50%);
  }
  
  .stork {
    width: 80px;
    height: 70px;
  }
  
  /* Adjust stork position to the right on mobile */
  @keyframes flyInMobile {
    0% {
      left: -150px;
      top: 50%;
      transform: translateY(-50%) rotate(0deg);
    }
    50% {
      left: calc(50% - 30px);
      top: 30%;
      transform: translateY(-50%) rotate(-3deg);
    }
    70% {
      left: calc(50% - 30px);
      top: 40%;
      transform: translateY(-50%) rotate(2deg);
    }
    85% {
      left: calc(50% - 30px);
      top: 50%;
      transform: translateY(-50%) rotate(-1deg);
    }
    100% {
      left: calc(50% - 30px);
      top: 50%;
      transform: translateY(-50%) rotate(0deg);
    }
  }
  
  .stork {
    animation: flyInMobile 4s ease-in-out forwards;
  }
  
  .stork-body {
    width: 35px;
    height: 45px;
    left: 10px;
    top: 15px;
  }
  
  .stork-head {
    width: 25px;
    height: 25px;
    left: 40px;
    top: 5px;
  }
  
  .stork-beak {
    border-left-width: 25px;
    border-right-width: 0;
    right: -18px;
    left: auto;
  }
  
  .stork-olive-branch {
    width: 12px;
    height: 16px;
    left: -14px;
    top: 8px;
  }
  
  .stork-olive-branch::before {
    width: 3px;
    height: 3px;
    left: 3px;
    top: 3px;
  }
  
  .stork-wing-left,
  .stork-wing-right {
    width: 40px;
    height: 18px;
  }
  
  .stork-wing-left {
    left: 25px;
    top: 28px;
    transform: rotate(230deg);
  }
  
  .stork-wing-right {
    left: 35px;
    top: 28px;
    transform: rotate(200deg);
  }
}

.title {
  text-align: center;
  color: var(--primary-color);
  font-size: 5em;
  margin: 4px 0 12px 0;
  font-family: 'Dancing Script', cursive;
  letter-spacing: 1px;
}
.address, .bank-account, .recipient {
  text-align: center;
  font-size: 1.2em;
  font-weight: 500;
  font-style: italic;
  color: var(--secondary-color);
  margin: 8px 0;
}
.main-content {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}

.categories .category h2 {
  color: var(--secondary-color);
  cursor: pointer;
  margin: 4px 0;
  padding: 10px;
  background: var(--bg-medium);
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 1.1em;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.categories .category h2.active {
  background: var(--primary-color);
  color: white;
}

.category-items {
  display: none;
  margin-bottom: 20px;
}
.category-items.active {
  display: block;
}

.item {
  margin: 8px 0;
  padding: 16px;
  background: #FFFCF5;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease;
}
.item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 160px;
}
.item-content {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.product-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.product-name {
  font-weight: 600;
  color: var(--secondary-color);
  font-size: 1.1em;
  text-decoration: none;
  transition: color 0.3s ease;
}
.product-status {
  font-size: 0.85em;
  font-style: italic;
  font-weight: 300;
}
.product-status.available {
  color: #4CAF50;
}
.product-status.taken {
  color: var(--primary-color);
}
.product-url {
  font-size: 14px;
  font-weight: 300;
}
.product-price {
  font-weight: 500;
  color: var(--primary-color);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.price-info-icon {
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  margin-left: 1px;
  position: relative;
}

.price-info-icon i {
  font-size: 14px;
  color: #51423b82;
}

.price-info-icon:hover {
  opacity: 1;
}

.price-info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  padding: 4px 9px;
  background-color: #51423b82;
  color: white;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  margin-left: 8px;
  z-index: 100;
  pointer-events: none;
}

.price-info-icon:hover::after {
  visibility: visible;
  opacity: 1;
}

/* Removing claim-actions styles and merging with claim-fields.visible */
.claim-fields {
  display: none;
}
.claim-fields.visible {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  min-height: 50px;
}
.claimed-badge {
  color: #808080;
  padding: 0 4px;
  font-size: 14px;
  font-style: italic;
  height: 20px;
  line-height: 20px;
}
.save-button {
  display: block;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.3s ease;
  width: fit-content;
  min-width: 80px;
}
.save-button:disabled {
  background: #ECE6E2;
  color: #a9a9a9;
  cursor: not-allowed;
}
.item input[type="text"], .item input[type="email"] {
  padding: 6px 10px;
  border: 1px solid #ECE6E2;
  border-radius: 6px;
  width: 100%;
  max-width: 180px;
  font-size: 14px;
  background: white;
  transition: border-color 0.3s ease;
}
.item input[type="text"]::placeholder,
.item input[type="email"]::placeholder {
  color: #a9a9a9;
}
.item input[readonly] {
  background: #f5f5f5;
  color: #777;
  cursor: not-allowed;
}
.taken-by {
  display: block;
}
.feedback-message {
  display: inline-block;
  color: #4c9d4c;
  font-style: italic;
}

.subcategory {
  color: var(--secondary-color);
  font-size: 1.3em;
  font-weight: 600;
  margin: 15px 0 10px 0;
  padding-left: 10px;
  border-left: 3px solid var(--primary-color);
  line-height: 1.4;
}
.error-message {
  text-align: center;
  padding: 20px;
  margin: 20px auto;
  max-width: 600px;
  background-color: #fff3f3;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.error-message p {
  margin: 10px 0;
}
.error-message p:first-child {
  color: #d32f2f;
  font-size: 1.1em;
}
.error-message p:last-child {
  color: #e53935;
  font-size: 1.1em;
}

#items-container {
  padding: 0 8px;
  position: relative;
  flex: 1;
}

.filter-search-container {
    margin-bottom: 12px;
    border-radius: 8px;
}

.filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.filter-radio {
  display: flex;
  gap: 10px;
}

.filter-radio label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--secondary-color);
    font-size: 0.95em;
}

.filter-radio input[type="radio"] {
    accent-color: var(--primary-color);
    margin-right: 8px;
}

.search {
    position: relative;
    overflow: hidden;
}

.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-container input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--bg-medium);
    border-radius: 6px;
    font-size: 0.95em;
    color: var(--secondary-color);
    background: white;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    margin: 0;
}

.search-input-container input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-input-container input[type="text"]::placeholder {
    color: #a9a9a9;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.search-clear-btn:hover {
    color: var(--primary-color);
}

.search-clear-btn.visible {
    visibility: visible;
    opacity: 1;
}

.footer {
    margin-top: 2rem;
    padding: 1rem 0;
    text-align: center;
    border-top: 1px solid #eee;
    color: #666;
}

.footer p {
    margin: 0.5rem 0;
}

.footer a {
    color: #666;
    text-decoration: none;
}

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

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.modal-email {
  color: var(--text-color);
}

.close-modal-btn {
    margin-top: 1rem;
    padding: 0.5rem 2rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.close-modal-btn:hover {
    background-color: #45a049;
}

/* Loading Skeleton Styles */
#items-container[data-loading="true"] .loading-skeleton {
  display: block;
  opacity: 1;
}

#items-container[data-loading="true"] #items-display-wrapper {
  opacity: 0;
  pointer-events: none;
}

.loading-skeleton {
  display: none;
  padding: 20px 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#items-display-wrapper {
  transition: opacity 0.3s ease;
}

.skeleton-category {
  margin-bottom: 30px;
}

.skeleton-subcategory {
  height: 24px;
  background: #f0f0f0;
  border-radius: 4px;
  margin-bottom: 15px;
  width: 200px;
  animation: pulse 1.5s infinite;
}

.skeleton-items {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.skeleton-item {
  height: 180px;
  background: #f0f0f0;
  border-radius: 12px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Image container and lazy loading styles */
.image-container {
    position: relative;
    background-color: #f0f0f0;
    min-height: 150px;
    overflow: hidden;
    border-radius: 8px;
}

.preview {
  position: relative;
  box-sizing: border-box;
  width: 150px;
  height: 150px;
  border-radius: 8px;
}
.preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 150px;
  /* background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150' viewBox='0 0 150 150'%3E%3Crect width='150' height='150' fill='%23f0f0f0'/%3E%3Ctext x='50%25' y='50%25' font-family='Arial' font-size='14' text-anchor='middle' dominant-baseline='middle' fill='%23999'%3EImage%3C/text%3E%3C/svg%3E") no-repeat center center; */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150' viewBox='0 0 150 150'%3E%3Crect width='150' height='150' fill='%23f0f0f0' rx='8' ry='8'/%3E%3Ctext x='50%25' y='50%25' font-family='Arial' font-size='14' text-anchor='middle' dominant-baseline='middle' fill='%23999'%3EImage%3C/text%3E%3C/svg%3E") no-repeat center center;
  border-radius: 8px;
}

/* Lazy image is initially invisible */
.lazy-image {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  z-index: 1;
}

/* When lazy image is loaded, make it visible with transition */
img:not(.lazy-image) {
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

.item-image {
  /* max-width: 100%; */
  height: auto;
  border-radius: 8px;
  /* object-fit: over; */
  width: 150px;
  height: 150px;
}

/* Fallback styling */
img[src^="data:image/svg"] {
  /* Disable lazy loading for placeholder SVGs */
  opacity: 1 !important;
}



.mobile-search-input-container input {
  width: 100%;
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--secondary-color);
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.mobile-search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 16px;
  color: var(--secondary-color);
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mobile-search-clear-btn.visible {
  opacity: 1;
  visibility: visible;
}


@media (max-width: 768px) {
  .title {
    display: block;
    font-size: 3em;
    margin: 20px 0 10px 0;
    text-align: center;
  }
  .greeting {
    margin-top: 28px;
  }
  .address, .bank-account, .recipient {
    font-size: 14px;
  }
  .address-label, .bank-account-label {
    display: none;
  }
  .main-content {
    flex-direction: column;
    gap: 0;
  }
  .category-items {
    margin-bottom: 40px;
  }

  .subcategory {
    border-left: none;
    border-bottom: 3px solid var(--primary-color);
    text-align: center
  }
  
  #items-container {
    box-sizing: border-box;
    padding: 0 2px;
    width: 100%;
  }
  .loading-skeleton {
    padding: 20px 0;
  }

  .item {
    padding: 10px;
  }

  .item-content {
    flex-direction: column;
    align-items: center;
  }
  .item-details {
    min-height: initial;
    width: 100%;
    align-items: center;
  }
  
  .item-image {
    margin: 0 auto;
  }
  .claim-fields.visible {
    width: 100%;
    justify-content: center;
  }
  .claimed-badge {
    font-size: 12px;
  }

  .modal {
    align-items: flex-start;
    padding-top: 30%;
  }

  .skeleton-item {
    height: 250px;
  }

  .footer {
    padding: 20px 0;
  }
}
