/* Groups page specific styles */
.groups-page {
  min-height: 100vh;
  background: var(--background);
}

.groups-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.groups-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0;
}

.groups-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0 1rem;
}

.groups-search {
  flex: 1;
  min-width: 250px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

.groups-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary)20;
}

.groups-filters {
  display: flex;
  gap: 0.5rem;
}

.filter-button {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  /* Minimum touch target size for accessibility */
  min-height: 44px;
  min-width: 44px;
}

.filter-button:hover {
  background: var(--muted);
}

.filter-button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 0 1rem;
}

.group-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--background);
}

.group-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}

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

.group-card-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.3;
}

.group-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.group-badge--owner {
  background: var(--primary);
  color: white;
}

.group-badge--member {
  background: var(--muted);
  color: var(--muted-foreground);
}

.group-description {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.group-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.group-stat {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  background: var(--muted);
  border-radius: 6px;
}

.group-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.25rem;
}

.group-stat-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.group-actions {
  display: flex;
  gap: 0.75rem;
}

.group-action-btn {
  flex: 1;
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: center;
  border: none;
  /* Minimum touch target size for accessibility */
  min-height: 44px;
  min-width: 44px;
}

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

.group-action-btn--primary:hover {
  opacity: 0.9;
}

.group-action-btn--secondary {
  background: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.group-action-btn--secondary:hover {
  background: var(--border);
}

/* Loading states */
.groups-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.loading-text {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* Error states */
.groups-error {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted-foreground);
}

.error-title {
  color: #dc2626;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.error-message {
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.error-retry-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: opacity 0.2s ease;
}

.error-retry-btn:hover {
  opacity: 0.9;
}

/* Empty states */
.groups-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted-foreground);
}

.empty-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.empty-message {
  margin-bottom: 1.5rem;
  line-height: 1.5;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.empty-action-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.empty-action-btn:hover {
  opacity: 0.9;
}

/* Responsive design */
@media (max-width: 768px) {
  .groups-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .groups-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .groups-filters {
    justify-content: center;
    flex-wrap: wrap;
  }

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

  .group-actions {
    flex-direction: column;
  }
}

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

  .group-card {
    padding: 1rem;
  }

  .group-stats {
    gap: 0.5rem;
  }

  .group-stat {
    padding: 0.5rem;
  }
}

/* Rating pills styling */
.rating-excellent { background: #10b981 !important; }
.rating-good { background: #3b82f6 !important; }
.rating-average { background: #f59e0b !important; }
.rating-poor { background: #ef4444 !important; }

.rating-pill {
  transition: transform 0.2s ease;
}

.rating-pill:hover {
  transform: scale(1.1);
}

/* Animation for loading spinner */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Member management styling */
.member-manage-item {
  transition: background-color 0.2s ease;
}

.member-manage-item:hover {
  background: var(--muted);
}

/* Invite and Add tab styling */
.invite-sections {
  max-height: 60vh;
  overflow-y: auto;
}

.invite-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  background: var(--background);
}

.invite-section h3 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem !important;
}

.user-search-results {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--background);
}

.user-search-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

.user-search-item:hover {
  background: var(--muted);
}

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

.user-checkbox {
  margin-right: 0.75rem;
}

.user-info {
  flex: 1;
}

.user-name {
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.25rem;
}

.user-email {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.former-member-badge {
  background: #f59e0b;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

#invitation-output {
  border: 1px solid var(--border);
  background: var(--muted);
}

#invitation-link {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  background: var(--background);
  border: 1px solid var(--border);
}

#qr-code-display img {
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Button styling for invite actions */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  cursor: pointer;
}

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

.btn-secondary:hover {
  background: var(--border);
  transform: translateY(-1px);
}

/* Sharing options styling */
.sharing-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.share-option-btn {
  transition: all 0.2s ease;
  min-width: 80px;
  text-align: center;
}

.share-option-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

@media (max-width: 480px) {
  .sharing-options {
    gap: 0.5rem;
  }
  
  .share-option-btn {
    min-width: 70px;
    padding: 0.5rem !important;
  }
  
  .share-option-btn i {
    font-size: 1rem !important;
  }
  
  .share-option-btn span {
    font-size: 0.7rem !important;
  }
}