/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-red: #ff3131;
  --color-gold: #d9a837;
  --color-beige: #e6e1d8;
  --color-white: #ffffff;
  --color-dark: #2c2c2c;
  --color-gray: #666666;
  --color-light-gray: #f5f5f5;

  --font-heading: "Anton", sans-serif;
  --font-body: "Montserrat", sans-serif;
}

body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--color-dark);
  background-color: var(--color-beige);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--color-red) 0%, #d92828 100%);
  color: var(--color-white);
  padding: 0.75rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: block;
  line-height: 0;
}

.logo-image {
  height: 50px;
  width: auto;
  display: block;
  transition: opacity 0.3s ease;
}

.logo:hover .logo-image {
  opacity: 0.9;
}

nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

nav > a {
  color: var(--color-white);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.3s ease;
}

nav > a:hover {
  opacity: 0.8;
}

/* Navigation Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  color: var(--color-white);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.3s ease;
}

.nav-dropdown-toggle:hover {
  opacity: 0.8;
}

.dropdown-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.nav-dropdown-toggle[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-white);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 0.5rem;
}

.nav-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--color-dark);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 4px;
  margin: 0.25rem;
}

.nav-dropdown-item:hover {
  background-color: var(--color-light-gray);
  color: var(--color-red);
}

.nav-dropdown-item:first-child {
  font-weight: 600;
  color: var(--color-red);
}

.nav-dropdown-divider {
  height: 1px;
  background-color: var(--color-beige);
  margin: 0.5rem 0;
}

.communities-list {
  max-height: 300px;
  overflow-y: auto;
}

.communities-list::-webkit-scrollbar {
  width: 4px;
}

.communities-list::-webkit-scrollbar-track {
  background: var(--color-light-gray);
  border-radius: 2px;
}

.communities-list::-webkit-scrollbar-thumb {
  background: var(--color-gold);
  border-radius: 2px;
}

.communities-list::-webkit-scrollbar-thumb:hover {
  background: #c89730;
}

/* Hero Section */
.hero {
  background: linear-gradient(
    135deg,
    var(--color-white) 0%,
    var(--color-beige) 100%
  );
  padding: 1.5rem 0 1rem;
}

.hero-layout {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.hero-copy {
  max-width: 720px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-red);
  margin-bottom: 0.25rem;
  letter-spacing: 1px;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--color-gold);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.hero-description {
  font-size: 0.93rem;
  color: var(--color-gray);
  line-height: 1.4;
  max-width: 100%;
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.search-toggle {
  background: var(--color-white);
  border: 2px solid var(--color-gold);
  color: var(--color-red);
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: var(--font-body);
}

.search-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-panel {
  max-width: 480px;
  margin: 1rem auto 0;
  padding: 1rem 1.5rem;
  background: var(--color-white);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  padding-right: 3rem;
}

.search-panel[data-open="false"] {
  display: none;
}

.search-panel.open {
  animation: fadeSlideDown 0.25s ease;
}

@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-box {
  position: relative;
  max-width: none;
  margin: 0;
}

.search-box input {
  width: 100%;
  padding: 1rem 3rem 1rem 1.5rem;
  font-size: 1rem;
  font-family: var(--font-body);
  border: 2px solid var(--color-beige);
  border-radius: 50px;
  outline: none;
  transition: border-color 0.3s ease;
}

.search-box input:focus {
  border-color: var(--color-gold);
}

.search-icon {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  pointer-events: none;
}

.search-helper {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-gray);
}

.search-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: none;
  background: none;
  color: var(--color-gray);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.search-close:hover {
  color: var(--color-red);
  transform: scale(1.1);
}

.search-close:focus-visible {
  color: var(--color-red);
  transform: scale(1.1);
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .hero {
    padding: 1.25rem 0 0.75rem;
  }

  .hero-layout {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .search-toggle {
    width: 100%;
    text-align: left;
  }

  .search-panel {
    max-width: none;
    margin: 0.75rem 1.25rem 0;
    align-self: stretch;
  }
}

/* Communities Section */
.communities-section {
  padding: 3rem 0;
}

.community-group {
  margin-bottom: 3rem;
}

.community-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-red);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--color-gold);
  letter-spacing: 1px;
}

.community-group {
  transition: all 0.3s ease;
}

.children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

/* Child Card */
.child-card {
  background: var(--color-white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.child-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.child-card.finished {
  opacity: 0.7;
}

.child-image {
  width: 100%;
  height: 165px;
  object-fit: cover;
}

.child-info {
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.child-name {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--color-red);
  letter-spacing: 0.5px;
}

.child-description {
  color: var(--color-gray);
  font-size: 0.9rem;
  line-height: 1.45;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.child-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-gold);
}

.child-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.btn {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

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

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #d92828 0%, #c92020 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 49, 49, 0.3);
}

.btn-secondary {
  background-color: var(--color-gold);
  color: var(--color-white);
}

.btn-secondary:hover {
  background-color: #c89730;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(217, 168, 55, 0.3);
}

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

.status-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  background-color: var(--color-gold);
  color: var(--color-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.status-badge.finished {
  background-color: #4caf50;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--color-white);
  padding: 1.5rem;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.3s ease;
}

.close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--color-gray);
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover {
  color: var(--color-red);
}

#modalChildName {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-red);
  margin-bottom: 1rem;
  padding-right: 2rem;
}

#modalLetterContent {
  color: var(--color-dark);
  line-height: 1.8;
}

#modalLetterContent p {
  margin-bottom: 1rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
  font-size: 1.2rem;
  color: var(--color-gray);
}

/* Footer */
footer {
  background-color: var(--color-dark);
  color: var(--color-white);
  padding: 2rem 0;
  text-align: center;
  margin-top: 4rem;
}

footer p {
  margin: 0.5rem 0;
}

footer a {
  color: var(--color-gold);
  text-decoration: none;
  font-weight: 600;
}

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

/* About Page Styles */
.about-page {
  background-color: var(--color-white);
}

.about-hero {
  background: linear-gradient(
    135deg,
    var(--color-white) 0%,
    var(--color-beige) 100%
  );
  color: var(--color-dark);
  padding: 4rem 0;
  text-align: center;
}

.about-hero .hero-title {
  color: var(--color-red);
}

.about-hero .hero-subtitle {
  color: var(--color-gold);
}

.about-content {
  padding: 4rem 0;
}

.about-section {
  margin-bottom: 3rem;
  padding: 2rem;
  background-color: var(--color-light-gray);
  border-radius: 12px;
  border-left: 4px solid var(--color-gold);
}

.about-section h3 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: var(--color-red);
  margin-bottom: 1rem;
  letter-spacing: 0.5px;
}

.about-section p {
  margin-bottom: 1rem;
  color: var(--color-gray);
}

.about-section ul,
.about-section ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
  color: var(--color-gray);
}

.about-section li {
  margin-bottom: 0.5rem;
}

.about-section a {
  color: var(--color-red);
  font-weight: 600;
}

.cta-section {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(
    135deg,
    var(--color-beige) 0%,
    var(--color-white) 100%
  );
  border-radius: 12px;
  margin-top: 2rem;
}

.cta-section h3 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-red);
  margin-bottom: 2rem;
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-buttons .btn {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .children-grid {
    grid-template-columns: 1fr;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  nav {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-dropdown {
    width: 100%;
  }

  .nav-dropdown-toggle {
    width: 100%;
    justify-content: center;
  }

  .nav-dropdown-menu {
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: 90vw;
    max-width: 300px;
  }

  .nav-dropdown-menu.show {
    transform: translateX(-50%) translateY(0);
  }

  .cta-buttons {
    flex-direction: column;
  }

  .cta-buttons .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 1.5rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .community-title {
    font-size: 1.5rem;
  }
}

/* Progress Bar Styles */
.progress-container {
  margin: 0.75rem 0;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background-color: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold) 0%, #f0c050 100%);
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 5px;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--color-gray);
  margin-top: 0.25rem;
  text-align: center;
  font-weight: 600;
}

/* Donation Modal Styles */
.donation-modal-body {
  padding: 0.5rem 0;
}

.donation-modal-body p {
  margin-bottom: 0.4rem;
  line-height: 1.5;
  font-size: 0.95rem;
}

.donation-info {
  color: var(--color-gray);
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 0.75rem;
  padding: 0.6rem;
  background-color: var(--color-light-gray);
  border-radius: 6px;
  border-left: 3px solid var(--color-gold);
}

.donation-amount-section {
  margin: 1rem 0;
}

.donation-amount-section label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-dark);
  font-size: 0.95rem;
}

.donation-amount-section input {
  width: 100%;
  padding: 0.65rem;
  font-size: 1rem;
  border: 2px solid var(--color-gold);
  border-radius: 6px;
  font-family: var(--font-body);
  transition: border-color 0.3s ease;
}

.donation-amount-section input:focus {
  outline: none;
  border-color: var(--color-red);
}

/* Donor Information Section */
.donor-info-section {
  margin: 1rem 0;
  padding: 1rem;
  background-color: var(--color-beige);
  border-radius: 6px;
  border: 1px solid rgba(217, 168, 55, 0.3);
}

.donor-info-notice {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-gray);
  line-height: 1.4;
}

.donor-info-notice em {
  font-style: italic;
}

.donor-field {
  margin-bottom: 0.75rem;
}

.donor-field:last-child {
  margin-bottom: 0;
}

.donor-field label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--color-dark);
  font-size: 0.9rem;
}

.donor-field input {
  width: 100%;
  padding: 0.55rem;
  font-size: 0.95rem;
  border: 1px solid rgba(217, 168, 55, 0.4);
  border-radius: 6px;
  font-family: var(--font-body);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  background-color: white;
}

.donor-field input:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(217, 168, 55, 0.1);
}

.donor-field input::placeholder {
  color: #aaa;
  font-style: italic;
}

/* Validation Error Styles */
.field-error {
  border-color: var(--color-red) !important;
  background-color: rgba(255, 49, 49, 0.05) !important;
}

.field-error:focus {
  box-shadow: 0 0 0 3px rgba(255, 49, 49, 0.15) !important;
}

.donation-error-message {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background-color: rgba(255, 49, 49, 0.1);
  border: 1px solid var(--color-red);
  border-radius: 6px;
  color: var(--color-red);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.donation-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.donation-buttons .btn {
  flex: 1;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--color-red) 0%, #d92828 100%);
  color: var(--color-white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 49, 49, 0.3);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  z-index: 999;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top:hover {
  background: linear-gradient(135deg, #d92828 0%, #c92020 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 49, 49, 0.4);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top-arrow {
  font-weight: bold;
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }

  .back-to-top-arrow {
    font-size: 16px;
  }
}
