/* Profile Page Styles */

/* ==================== PROFILE CARD ==================== */

.profile-card {
  max-width: 800px;
  margin: 0 auto;
}

/* Not Logged In State */
.profile-not-logged-in {
  text-align: center;
  padding: 40px 20px;
}

.profile-icon-large {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.8;
}

.profile-not-logged-in h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: var(--text);
}

.profile-not-logged-in > p {
  color: var(--text-light);
  margin-bottom: 30px;
}

.profile-benefits {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg);
  border-radius: 12px;
  text-align: left;
}

.benefit-icon {
  font-size: 1.5rem;
}

.profile-auth-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 20px;
}

.profile-auth-buttons button {
  min-width: 140px;
}

.back-link {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 10px;
  box-shadow: none;
}

.back-link:hover {
  color: var(--primary);
  text-decoration: underline;
  transform: none;
  background: none;
}

/* ==================== TOP BAR ==================== */

.profile-top-bar {
  margin-bottom: 30px;
}

.create-puzzle-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
}

.create-puzzle-btn:hover {
  background: var(--primary-dark, #ff6b9d);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
}

/* ==================== JIGPOINTS DISPLAY ==================== */

.jigpoints-display {
  background: var(--accent-orange);
  border-radius: 16px;
  padding: 12px 20px;
  box-shadow: 0 4px 15px rgba(255, 165, 0, 0.3);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.jigpoints-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  animation: jigpointsShimmer 3s infinite;
}

@keyframes jigpointsShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.jigpoints-content {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.jigpoints-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  animation: jigpointsPulse 2s ease-in-out infinite;
}

@keyframes jigpointsPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.jigpoints-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.jigpoints-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.jigpoints-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ==================== PROFILE HEADER ==================== */

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  gap: 20px;
}

.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 600;
  border: 4px solid white;
  box-shadow: 0 4px 15px rgba(255, 107, 157, 0.2);
}

.profile-info h2 {
  font-size: 1.5rem;
  margin-bottom: 5px;
  color: var(--text);
}

.profile-email {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ==================== USERNAME SECTION ==================== */

.username-section {
  margin-top: 10px;
}

.username-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.username-label {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
}

.username-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  box-shadow: none;
}

.username-edit-btn:hover {
  opacity: 1;
  background: none;
  transform: none;
}

.username-set-btn {
  background: var(--bg);
  border: 2px dashed var(--border);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
}

.username-set-btn:hover {
  border-color: var(--primary);
  background: rgba(255, 107, 157, 0.05);
  transform: none;
}

.username-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 5px;
}

.username-input-wrapper {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color 0.2s ease;
}

.username-input-wrapper:focus-within {
  border-color: var(--primary);
}

.username-prefix {
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.95rem;
}

.username-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 8px;
  font-size: 0.95rem;
  color: var(--text);
  min-width: 0;
}

.username-input:focus {
  outline: none;
}

.username-input.available {
  color: var(--success);
}

.username-input.taken {
  color: #ef4444;
}

.username-status {
  font-weight: 600;
  font-size: 1rem;
}

.username-status.available {
  color: var(--success);
}

.username-status.taken {
  color: #ef4444;
}

.username-error {
  color: #ef4444;
  font-size: 0.8rem;
  margin: 0;
  padding-left: 4px;
}

/* Dark theme username adjustments */
body.theme-neonNights .username-input.taken,
body.theme-neonNights .username-status.taken,
body.theme-neonNights .username-error,
body.theme-midnight .username-input.taken,
body.theme-midnight .username-status.taken,
body.theme-midnight .username-error {
  color: #FF8A8A;
}

.username-actions {
  display: flex;
  gap: 8px;
}

.username-save-btn,
.username-cancel-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.username-save-btn {
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 2px 8px var(--shadow);
}

/* Dark theme username save button adjustments */
body.theme-neonNights .username-save-btn {
  color: #0A0A0F;
}

body.theme-midnight .username-save-btn,
body.theme-minimal .username-save-btn {
  color: white;
}

.username-save-btn:hover:not(:disabled) {
  background: var(--primary-dark, #e85a8f);
  transform: translateY(-1px);
}

.username-save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.username-cancel-btn {
  background: var(--bg);
  color: var(--text-light);
  border: 1px solid var(--border);
  box-shadow: none;
}

.username-cancel-btn:hover {
  background: var(--border);
  transform: none;
}

.username-hint {
  color: var(--text-light);
  font-size: 0.75rem;
  margin: 0;
  padding-left: 4px;
}

/* ==================== STATS SECTION ==================== */

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg);
  padding: 20px;
  border-radius: 18px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 107, 157, 0.15);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
}

/* ==================== TABS ==================== */

.profile-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  border-radius: 0;
  box-shadow: none;
}

.tab-btn:hover {
  color: var(--primary);
  background: none;
  transform: none;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ==================== PUZZLE GRID ==================== */

.profile-puzzles {
  min-height: 200px;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.puzzle-card {
  background: var(--card-bg);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px var(--shadow);
}

.puzzle-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(255, 107, 157, 0.2);
  border-color: var(--primary);
}

.puzzle-thumbnail {
  width: 100%;
  height: 140px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.puzzle-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.puzzle-placeholder {
  font-size: 3rem;
  opacity: 0.5;
}

.puzzle-download-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.puzzle-card:hover .puzzle-download-btn {
  opacity: 1;
  transform: scale(1);
}

.puzzle-download-btn:hover {
  background: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

.puzzle-download-btn:active {
  transform: scale(0.95);
}

/* Puzzle overlay buttons container */
.puzzle-overlay-btns {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.puzzle-overlay-btns .puzzle-download-btn,
.puzzle-overlay-btns .puzzle-copy-btn {
  position: static;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.puzzle-card:hover .puzzle-overlay-btns .puzzle-download-btn,
.puzzle-card:hover .puzzle-overlay-btns .puzzle-copy-btn {
  opacity: 1;
  transform: scale(1);
}

.puzzle-overlay-btns .puzzle-download-btn:hover,
.puzzle-overlay-btns .puzzle-copy-btn:hover {
  background: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

/* Puzzle name display */
.puzzle-name {
  padding: 8px 15px;
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid var(--border);
}

.puzzle-meta {
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.puzzle-pieces {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.puzzle-date {
  font-size: 0.8rem;
  color: var(--text-light);
}

.puzzle-stats {
  padding: 10px 15px;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-light);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.empty-state button {
  padding: 12px 25px;
}


/* ==================== SHARE MODAL UPDATES ==================== */

.share-modal {
  max-width: 480px;
}

.share-modal .auth-prompt {
  background: var(--bg);
  margin: 20px -30px -30px;
  padding: 20px 30px 30px;
  border-radius: 0 0 24px 24px;
  border-top: none;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .profile-card {
    padding: 20px;
  }
  
  .profile-top-bar {
    margin-bottom: 20px;
  }
  
  .create-puzzle-btn {
    width: 100%;
    margin-bottom: 15px;
  }
  
  .profile-header {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
  
  .jigpoints-display {
    width: 100%;
    padding: 15px;
  }
  
  .jigpoints-content {
    justify-content: center;
  }
  
  .jigpoints-icon {
    width: 36px;
    height: 36px;
  }
  
  .jigpoints-value {
    font-size: 1.5rem;
  }
  
  .jigpoints-label {
    font-size: 0.7rem;
  }
  
  .jigpoints-info {
    align-items: center;
  }
  
  .profile-avatar-section {
    flex-direction: column;
    text-align: center;
    align-items: center;
    width: 100%;
  }
  
  .profile-avatar,
  .profile-avatar-placeholder {
    width: 70px;
    height: 70px;
  }
  
  .profile-avatar-placeholder {
    font-size: 1.75rem;
  }
  
  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .stat-card {
    padding: 15px 10px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.75rem;
  }
  
  .profile-tabs {
    justify-content: center;
  }
  
  .tab-btn {
    padding: 10px 15px;
    font-size: 0.9rem;
  }
  
  .puzzle-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
  }
  
  .puzzle-thumbnail {
    height: 110px;
  }
  
  .puzzle-download-btn {
    opacity: 1;
    transform: scale(1);
  }
  
  .profile-auth-buttons {
    flex-direction: column;
  }
  
  .profile-auth-buttons button {
    width: 100%;
  }
  
  .share-modal .auth-prompt {
    margin: 20px -20px -20px;
    padding: 15px 20px 20px;
  }
  
  /* Username section mobile */
  .username-section {
    margin-top: 15px;
    text-align: center;
  }
  
  .username-display {
    justify-content: center;
  }
  
  .username-edit-form {
    align-items: center;
  }
  
  .username-input-wrapper {
    width: 100%;
    max-width: 280px;
  }
  
  .username-actions {
    justify-content: center;
  }
  
  .username-hint {
    text-align: center;
  }
  
  /* Puzzle overlay buttons mobile */
  .puzzle-overlay-btns .puzzle-download-btn,
  .puzzle-overlay-btns .puzzle-copy-btn {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 480px) {
  .jigpoints-display {
    padding: 12px 15px;
  }
  
  .jigpoints-content {
    gap: 8px;
    justify-content: center;
  }
  
  .jigpoints-icon {
    width: 32px;
    height: 32px;
  }
  
  .jigpoints-value {
    font-size: 1.25rem;
  }
  
  .jigpoints-label {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
  }
  
  .jigpoints-info {
    align-items: center;
  }
  
  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px 10px;
    aspect-ratio: 1;
    min-height: 0;
  }
  
  .stat-value {
    font-size: 1.5rem;
    margin-bottom: 5px;
  }
  
  .stat-label {
    font-size: 0.75rem;
    text-align: center;
  }
}

