/* Base styles */
:root {
  --primary-color: #047857;
  --primary-light: #d1fae5;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --background: #f9fafb;
  --white: #ffffff;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
  background-color: var(--background);
  color: var(--text-dark);
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  background-color: rgba( 255, 255, 255, 0.5 );
  height: 100hv;
}

/* Header */
header {
  margin-bottom: 1rem;
}

.header-content {
  background: var(--white);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-main h1 {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.header-main p {
  color: var(--text-light);
}

/* Search */
.search-container {
  position: relative;
  margin-bottom: 1rem;
}

.search-input-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}

#search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
}

#search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.2);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 10;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-200);
}

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

.search-result-item:hover {
  background-color: var(--gray-100);
}

.search-result-name {
  font-weight: 500;
}

.search-result-years {
  font-size: 0.875rem;
  color: var(--text-light);
}

.no-results {
  padding: 0.75rem 1rem;
  color: var(--text-light);
  font-style: italic;
}

/* Tree Container */
.tree-container {
  position: relative;
  height: 800px;
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  overflow: hidden;
}

#family-tree-canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none; /* Prevent default touch behaviors */
}

#family-tree-canvas:active {
  cursor: grabbing;
}

.tree-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 5;
}

.tree-controls button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--white);
  border: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
}

.tree-controls button:hover {
  background-color: var(--gray-100);
}

.node-tooltip {
  position: absolute;
  background-color: var(--white);
  padding: 0.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  pointer-events: none;
  display: none;
  z-index: 10;
}

/* Members Grid */
.members-section h2 {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

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

.member-card {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}

.member-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.member-card a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.member-card-content {
  padding: 0.75rem;
  position: relative;
}

.member-card h3 {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.member-card p {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.generation-label {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  background-color: rgba(255, 255, 255, 0.8);
}

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background-color: #065f46;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--gray-200);
  color: var(--text-dark);
}

.btn-secondary:hover {
  background-color: var(--gray-300);
}

/* Member Profile Page */
.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--primary-color);
  text-decoration: none;
  margin-bottom: 1.5rem;
  font-weight: 500;
  background: var(--white);
  padding: 0.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.back-link svg {
  margin-right: 0.5rem;
}

.back-link:hover {
  text-decoration: underline;
}

.member-profile {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.member-profile-content {
  padding: 1.5rem;
}

.member-profile-header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .member-profile-header {
    flex-direction: row;
  }
}

.member-photo {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  background-color: var(--gray-100);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.member-photo svg {
  width: 100px;
  height: 100px;
  color: var(--gray-400);
}

.member-info {
  flex: 1;
}

.member-name {
  font-size: 1.75rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.member-years {
  display: flex;
  align-items: center;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.member-years svg {
  margin-right: 0.5rem;
}

.member-bio {
  margin-bottom: 1.5rem;
}

.member-bio h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.member-relationships h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

.member-relationships h2 svg {
  margin-right: 0.5rem;
}

.relationship-list {
  list-style: none;
}

.relationship-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.relationship-type {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  margin-right: 0.5rem;
}

.relationship-name {
  color: var(--primary-color);
  text-decoration: none;
}

.relationship-name:hover {
  text-decoration: underline;
}

.no-relationships {
  color: var(--text-light);
  font-style: italic;
}

/* Sign Out Message */
.show-message {
  position: fixed;
  top: 2rem;
  right: 2rem;
  background: #10b981;
  color: white;
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

.show-error {
  position: fixed;
  top: 2rem;
  right: 2rem;
  background: #ed3434;
  color: white;
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

.show-message-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Header Authentication */
.header-auth {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.header-auth-actions {
  display: flex;
  gap: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    background-color: transparent;
  }

  .header-content {
    flex-direction: column;
    align-items: stretch;
  }

  .header-main h1 {
    font-size: 1.75rem;
  }

  .tree-container {
    height: 600px;
  }

  .members-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .member-profile-header {
    flex-direction: column;
  }

  .member-name {
    font-size: 1.5rem;
  }

  .header-auth {
    flex-direction: row; /* Keep as row instead of column */
  }
}

@media (max-width: 480px) {
  .btn-small {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  .btn-small svg {
    width: 14px;
    height: 14px;
  }

  .header-user-avatar {
    width: 32px;
    height: 32px;
  }

  .member-profile-content {
    padding: 1rem;
  }

/*
  .member-photo {
    max-width: 200px;
  }

  .member-photo svg {
    width: 80px;
    height: 80px;
  }
*/
}
