:root {
  --profile-primary: #4f46e5;
  --profile-primary-hover: #4338ca;
  --profile-secondary: #6366f1;
  --profile-bg: #f8fafc;
  --profile-card-bg: #ffffff;
  --profile-text-main: #1e293b;
  --profile-text-muted: #64748b;
  --profile-border: #e2e8f0;
  --profile-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --profile-streak: #f59e0b;
}

.profile-container {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: 'Poppins', sans-serif;
}

.profile-card {
  background: var(--profile-card-bg);
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: var(--profile-shadow);
  border: 1px solid var(--profile-border);
}

.profile-header {
  background: linear-gradient(135deg, var(--profile-primary) 0%, var(--profile-secondary) 100%);
  padding: 3rem 2rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
}

.profile-avatar-wrapper {
  position: relative;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  object-fit: cover;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.profile-avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  border: 4px solid rgba(255, 255, 255, 0.3);
}

.profile-info h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
}

.profile-email {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.profile-actions {
  display: flex;
  gap: 1rem;
}

.btn-profile-edit {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.btn-profile-edit:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.profile-streak-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  padding: 1.5rem;
  border-radius: 1.25rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 120px;
  backdrop-filter: blur(4px);
}

.streak-count {
  font-size: 2.5rem;
  font-weight: 700;
  display: block;
  line-height: 1;
}

.streak-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

.streak-icon {
  color: #fbbf24;
  margin-top: 0.5rem;
  font-size: 1.2rem;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #f8fafc;
  border-bottom: 1px solid var(--profile-border);
}

.stat-item {
  padding: 2rem;
  text-align: center;
  border-right: 1px solid var(--profile-border);
}

.stat-item:last-child {
  border-right: none;
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--profile-text-main);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--profile-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.profile-content {
  padding: 2.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.content-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--profile-text-main);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-all-link {
  font-size: 0.875rem;
  color: var(--profile-primary);
  text-decoration: none;
  font-weight: 500;
}

.view-all-link:hover {
  text-decoration: underline;
}

.attempts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.attempt-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-radius: 1rem;
  border: 1px solid var(--profile-border);
  transition: all 0.2s ease;
}

.attempt-card:hover {
  border-color: var(--profile-secondary);
  background: white;
  transform: translateX(4px);
}

.attempt-word {
  font-weight: 700;
  color: var(--profile-text-main);
  display: block;
}

.attempt-date {
  font-size: 0.75rem;
  color: var(--profile-text-muted);
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-badge.correct {
  background: #dcfce7;
  color: #166534;
}

.status-badge.incorrect {
  background: #fee2e2;
  color: #991b1b;
}

.contests-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.contest-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contest-group .contests-list {
  gap: 0.75rem;
}

.contest-group-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--profile-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  display: block;
}

.contest-card {
  display: block;
  padding: 1.25rem;
  border-radius: 1rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid var(--profile-border);
}

.contest-card.created {
  background: #eff6ff;
  border-color: #dbeafe;
}

.contest-card.created:hover {
  background: #dbeafe;
  transform: translateY(-2px);
}

.contest-card.participating {
  background: #f8fafc;
}

.contest-card.participating:hover {
  background: #f1f5f9;
  transform: translateY(-2px);
}

.contest-title {
  display: block;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.25rem;
}

.contest-card.participating .contest-title {
  color: var(--profile-text-main);
}

.contest-meta {
  font-size: 0.75rem;
  color: #60a5fa;
}

.contest-card.participating .contest-meta {
  color: var(--profile-text-muted);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #f8fafc;
  border-radius: 1rem;
  border: 2px dashed var(--profile-border);
}

.empty-state p {
  color: var(--profile-text-muted);
  margin-bottom: 1rem;
}

.empty-state-link {
  color: var(--profile-primary);
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 768px) {
  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .profile-streak-badge {
    margin-left: 0;
    width: 100%;
  }

  .profile-stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-item {
    border-right: none;
    border-bottom: 1px solid var(--profile-border);
  }

  .profile-content {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }
}

/* ==== Invitations Page Styling ==== */
.invitations-container {
  max-width: 800px;
  margin: 4rem auto;
  padding: 0 1.5rem;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

.invitations-header {
  text-align: center;
  margin-bottom: 3rem;
}

.invitations-header .page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.invitations-header .subtitle {
  color: #64748b;
  font-size: 1.1rem;
}

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

.invitation-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.invitation-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}

.invitation-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.invitation-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #3b82f6;
}

.invitation-contest-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.invitation-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.invitation-actions form {
  margin: 0;
}

/* Empty State Card */
.empty-state-card {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 4rem 2rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
  border: 2px dashed #cbd5e1;
  max-width: 650px;
  margin: 0 auto;
}

.empty-state-card .empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem auto;
  color: #94a3b8;
  background: #f8fafc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-card .empty-icon svg {
  width: 32px;
  height: 32px;
}

.empty-state-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.75rem;
}

.empty-state-card p {
  color: #64748b;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Invitation Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-success {
  background-color: #10b981;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background-color: transparent;
  color: #ef4444;
  border: 1px solid #ef4444;
}

.btn-danger:hover {
  background-color: #fef2f2;
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .invitation-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .invitation-actions {
    width: 100%;
    justify-content: stretch;
  }

  .invitation-actions form,
  .invitation-actions .btn {
    width: 100%;
    justify-content: center;
  }
}