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

:root {
  --primary-soft: #a8c5e8;
  --primary-medium: #7ba3d1;
  --primary-deep: #5b8bb8;
  --secondary-soft: #e8d5e0;
  --secondary-medium: #d4a5c4;
  --accent-soft: #f0e6d2;
  --accent-warm: #f5d5b8;
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --text-light: #718096;
  --bg-soft: #f7fafc;
  --bg-card: #ffffff;
  --border-soft: #e2e8f0;
  --success-soft: #c6f6d5;
  --success-medium: #68d391;
  --error-soft: #fed7d7;
  --error-medium: #fc8181;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 50%, #f0e6d2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  padding: 1.25rem 0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-deep);
  text-decoration: none;
  transition: all 0.3s ease;
  letter-spacing: -0.5px;
}

.logo:hover {
  color: var(--primary-medium);
  transform: translateY(-1px);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  align-items: center;
}

.nav-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 0.625rem 1.25rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-menu a:hover {
  background: var(--bg-soft);
  color: var(--primary-deep);
}

.nav-menu a.active {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--secondary-soft) 100%);
  color: var(--primary-deep);
  font-weight: 600;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#username-display {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}

#logout-link {
  color: var(--text-light);
  font-size: 0.9rem;
}

.container {
  max-width: 1280px;
  margin: 3rem auto;
  padding: 0 2rem;
}

.hero {
  text-align: center;
  color: var(--text-primary);
  margin: 4rem 0 3rem;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary-deep) 0%, var(--secondary-medium) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
}

.filter-section {
  background: var(--bg-card);
  padding: 1.75rem 2rem;
  border-radius: 20px;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border: 1px solid var(--border-soft);
}

.filter-section label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
}

.filter-section select {
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--border-soft);
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-soft);
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
  max-width: 250px;
}

.filter-section select:focus {
  outline: none;
  border-color: var(--primary-medium);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(123, 163, 209, 0.1);
}

.pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.pet-card {
  background: var(--bg-card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  border: 1px solid var(--border-soft);
}

.pet-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-soft);
}

.pet-image {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--bg-soft) 0%, var(--accent-soft) 100%);
  display: block;
}

.pet-info {
  padding: 1.75rem;
}

.pet-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.pet-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  flex: 1;
}

.pet-type {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--secondary-soft) 100%);
  color: var(--primary-deep);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  text-transform: capitalize;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid rgba(123, 163, 209, 0.2);
}

.pet-description {
  color: var(--text-secondary);
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.pet-votes {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-soft);
}

.vote-button {
  background: var(--bg-soft);
  border: 2px solid var(--border-soft);
  padding: 0.625rem 1.25rem;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.vote-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

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

.vote-button.upvote:hover:not(:disabled) {
  border-color: var(--success-medium);
  background: var(--success-soft);
  color: #22543d;
}

.vote-button.downvote:hover:not(:disabled) {
  border-color: var(--error-medium);
  background: var(--error-soft);
  color: #742a2a;
}

.vote-button.active.upvote {
  background: linear-gradient(135deg, var(--success-medium) 0%, #48bb78 100%);
  border-color: var(--success-medium);
  color: white;
  box-shadow: 0 4px 12px rgba(104, 211, 145, 0.3);
}

.vote-button.active.downvote {
  background: linear-gradient(135deg, var(--error-medium) 0%, #f56565 100%);
  border-color: var(--error-medium);
  color: white;
  box-shadow: 0 4px 12px rgba(252, 129, 129, 0.3);
}

.vote-count {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.2rem;
  min-width: 40px;
  text-align: center;
}

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 200px);
  padding: 2rem;
}

.auth-card {
  background: var(--bg-card);
  padding: 3.5rem;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--border-soft);
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 2.5rem;
  color: var(--text-primary);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.form-group {
  margin-bottom: 1.75rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.625rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.875rem 1.25rem;
  border: 2px solid var(--border-soft);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: var(--bg-soft);
  color: var(--text-primary);
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-medium);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(123, 163, 209, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group small {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-light);
  font-size: 0.85rem;
}

.btn {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  letter-spacing: 0.3px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-medium) 0%, var(--primary-deep) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(123, 163, 209, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(123, 163, 209, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.auth-link {
  text-align: center;
  margin-top: 2rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.auth-link a {
  color: var(--primary-deep);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.auth-link a:hover {
  color: var(--primary-medium);
  text-decoration: underline;
}

.upload-container {
  max-width: 680px;
  margin: 2rem auto;
}

.upload-card {
  background: var(--bg-card);
  padding: 3rem;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
}

.upload-card h2 {
  color: var(--text-primary);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  letter-spacing: -0.5px;
}

.image-preview {
  margin-top: 1rem;
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.image-preview img {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
  display: block;
}

.leaderboard-header {
  background: var(--bg-card);
  padding: 3rem 2rem;
  border-radius: 24px;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-md);
  text-align: center;
  border: 1px solid var(--border-soft);
}

.leaderboard-header h1 {
  color: var(--text-primary);
  margin-bottom: 2rem;
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--primary-deep) 0%, var(--secondary-medium) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.leaderboard-item {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 2rem;
  transition: all 0.3s ease;
  border: 1px solid var(--border-soft);
}

.leaderboard-item:hover {
  transform: translateX(8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-soft);
}

.rank {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--primary-medium);
  min-width: 70px;
  text-align: center;
  letter-spacing: -1px;
}

.rank.gold {
  color: #d4af37;
  text-shadow: 0 2px 4px rgba(212, 175, 55, 0.3);
}

.rank.silver {
  color: #9ca3af;
  text-shadow: 0 2px 4px rgba(156, 163, 175, 0.3);
}

.rank.bronze {
  color: #cd7f32;
  text-shadow: 0 2px 4px rgba(205, 127, 50, 0.3);
}

.leaderboard-pet-image {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 16px;
  flex-shrink: 0;
  border: 3px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.leaderboard-pet-info {
  flex: 1;
}

.leaderboard-pet-name {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: -0.3px;
}

.leaderboard-pet-type {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--secondary-soft) 100%);
  color: var(--primary-deep);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  display: inline-block;
  text-transform: capitalize;
  margin-bottom: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(123, 163, 209, 0.2);
}

.leaderboard-pet-description {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.6;
}

.leaderboard-score {
  text-align: right;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--success-medium);
  letter-spacing: -0.5px;
}

.leaderboard-score span {
  display: block;
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
  margin-top: 0.25rem;
}

.error-message {
  background: linear-gradient(135deg, var(--error-soft) 0%, #ffe5e5 100%);
  color: #742a2a;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-top: 1rem;
  display: none;
  border: 1px solid rgba(252, 129, 129, 0.3);
  font-weight: 500;
}

.error-message.show {
  display: block;
}

.success-message {
  background: linear-gradient(135deg, var(--success-soft) 0%, #e6ffed 100%);
  color: #22543d;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-top: 1rem;
  display: none;
  border: 1px solid rgba(104, 211, 145, 0.3);
  font-weight: 500;
}

.success-message.show {
  display: block;
}

.loading {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
  font-size: 1.2rem;
  font-weight: 500;
}

.admin-dashboard {
  margin-top: 3rem;
  gap: 2rem;
}

@media (min-width: 960px) {
  .admin-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-panel {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 2rem;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-lg);
}

.panel-header h2 {
  margin-bottom: 0.35rem;
  font-size: 1.5rem;
}

.panel-header p {
  margin: 0;
  color: var(--text-light);
}

.admin-section-body {
  margin-top: 1.25rem;
}

.table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.admin-table th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--text-secondary);
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-pet-card {
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.admin-pet-details h3 {
  margin: 0;
}

.admin-pet-details p {
  margin: 0.15rem 0;
  color: var(--text-secondary);
}

.admin-pet-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-danger {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  border: none;
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.contact-hero {
  text-align: center;
  margin: 3rem 0 2rem;
}

.contact-hero h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.contact-hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.contact-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 960px) {
  .contact-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.contact-card,
.contact-info-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 2.5rem;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-lg);
}

.contact-info-card ul {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.contact-info-card li {
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.admin-message-card {
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid var(--border-soft);
  margin-top: 1rem;
}

.admin-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.admin-message-header span {
  color: var(--text-light);
  font-size: 0.9rem;
}

.admin-message-body {
  margin: 0.5rem 0 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.admin-message-actions {
  display: flex;
  justify-content: flex-end;
}


@media (max-width: 768px) {
  .nav-container {
    padding: 0 1.5rem;
  }

  .nav-menu {
    gap: 0.25rem;
    font-size: 0.85rem;
  }

  .nav-menu a {
    padding: 0.5rem 0.875rem;
  }

  .container {
    padding: 0 1.5rem;
    margin: 2rem auto;
  }

  .hero {
    padding: 2rem 1.5rem;
    margin: 2rem 0;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .pets-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .filter-section {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .filter-section select {
    max-width: 100%;
  }

  .leaderboard-item {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }

  .rank {
    min-width: auto;
    font-size: 1.75rem;
  }

  .leaderboard-pet-image {
    width: 120px;
    height: 120px;
  }

  .auth-card {
    padding: 2.5rem 2rem;
  }

  .upload-card {
    padding: 2rem 1.5rem;
  }
}

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

  .hero h1 {
    font-size: 1.875rem;
  }

  .leaderboard-header h1 {
    font-size: 2rem;
  }
}
