/* ═══════════════════════════════════════════════════════════════
   PROFILE PAGE STYLES
   Matches Flutter other_user_profile_screen layout
   ═══════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────
   Page Layout
   ─────────────────────────────────────────────────────────────── */
.profile-page {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--page-padding);
  padding-bottom: 80px; /* Space for potential footer */
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
}

/* ───────────────────────────────────────────────────────────────
   Profile Header
   ─────────────────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 4%;
  margin-bottom: var(--space-lg);
}

.profile-picture-container {
  flex-shrink: 0;
  width: 30%;
  max-width: 140px;
}

.profile-picture-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 100%; /* 1:1 aspect ratio */
  border-radius: var(--radius-md);
  overflow: hidden;
}

.profile-picture {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-picture-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--text-secondary);
  color: var(--text-on-primary);
  font-size: 2.5em;
  font-weight: 600;
}

.profile-info {
  flex: 1;
  min-width: 0; /* Enable text truncation */
  display: flex;
  flex-direction: column;
}

.profile-username {
  font-size: clamp(16px, 4.5vw, 20px);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Description box with color */
.profile-description-box {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-description-text {
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  text-align: center;
  width: 100%;
}

.profile-description-text:empty::after {
  content: 'No description';
  color: inherit;
  font-style: italic;
  opacity: 0.6;
}

/* ───────────────────────────────────────────────────────────────
   Stats Section
   ─────────────────────────────────────────────────────────────── */
.stats-section {
  display: flex;
  justify-content: space-around;
  padding: var(--space-md) var(--space-sm);
  margin-bottom: var(--space-lg);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 60px;
}

.stat-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ───────────────────────────────────────────────────────────────
   Inline Ask Form
   ─────────────────────────────────────────────────────────────── */
.inline-ask-section {
  margin-bottom: var(--space-xl);
}

.inline-ask-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.clay-textarea {
  width: 100%;
  min-height: 80px;
  padding: 14px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--background-color);
  color: var(--text-primary);
  font-size: var(--font-size-md);
  font-family: inherit;
  resize: vertical;
  box-shadow: inset 2px 2px 6px rgba(0,0,0,0.1), inset -2px -2px 6px rgba(255,255,255,0.7);
  outline: none;
  transition: box-shadow 0.2s ease;
}

.clay-textarea:focus {
  box-shadow: inset 3px 3px 8px rgba(0,0,0,0.15), inset -3px -3px 8px rgba(255,255,255,0.8);
}

.clay-textarea::placeholder {
  color: var(--text-secondary);
}

.ask-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.templates-label {
  width: 100%;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin: 0;
}

.template-chip {
  background: var(--background-color);
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: var(--font-size-xs);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: -2px -2px 5px rgba(255,255,255,0.8), 2px 2px 5px rgba(0,0,0,0.12);
  transition: all 0.15s ease;
}

.template-chip:active {
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.1), inset -2px -2px 4px rgba(255,255,255,0.7);
  transform: scale(0.97);
}

.send-ask-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: var(--font-size-lg);
  border-radius: var(--radius-sm);
}

.send-ask-btn .button-icon {
  font-size: 20px;
  font-weight: bold;
}

#btn-nickname {
  font-weight: 700;
}

.send-ask-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (hover: hover) {
  .send-ask-btn:hover:not(:disabled) {
    transform: translateY(-2px);
  }
  .template-chip:hover {
    box-shadow: -3px -3px 7px rgba(255,255,255,0.9), 3px 3px 7px rgba(0,0,0,0.15);
  }
}

@media (hover: none) {
  .send-ask-btn:active:not(:disabled) {
    transform: scale(0.98);
  }
}

/* ───────────────────────────────────────────────────────────────
   Asks Section
   ─────────────────────────────────────────────────────────────── */
.asks-section {
  margin-top: var(--space-lg);
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  padding-left: 4px;
}

.asks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.asks-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
}

.asks-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.asks-empty-text {
  font-size: var(--font-size-md);
}

/* ───────────────────────────────────────────────────────────────
   Clickable elements
   ─────────────────────────────────────────────────────────────── */
.clickable {
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.clickable:active {
  opacity: 0.8;
}

/* ───────────────────────────────────────────────────────────────
   Ask Card (matches AskListItem)
   ─────────────────────────────────────────────────────────────── */
.ask-card {
  padding: 3.5%;
  border-radius: var(--radius-sm);
  transition: transform var(--transition-fast);
  position: relative;
}

.ask-card:hover {
  transform: translateY(-1px);
}

.ask-card__inner {
  display: flex;
  align-items: flex-start;
  gap: 3%;
}

.ask-card__avatar {
  flex-shrink: 0;
  width: 10%;
  min-width: 36px;
  max-width: 48px;
}

.ask-card__avatar-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
}

.ask-card__avatar-initial {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: 600;
  opacity: 0.8;
}

/* Neumorphic cloud icon for anonymous */
.ask-card__avatar-anonymous {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ask-card__avatar-anonymous svg {
  width: 70%;
  height: 70%;
}

.ask-card__content {
  flex: 1;
  min-width: 0;
}

.ask-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.ask-card__author {
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 600;
  min-width: 0;
}

.ask-card__time {
  font-size: clamp(11px, 3vw, 13px);
  opacity: 0.7;
  flex-shrink: 0;
  margin-left: 8px;
}

.ask-card__text {
  font-size: clamp(13px, 3.5vw, 15px);
  line-height: 1.3;
  opacity: 0.9;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ask-card__chevron {
  flex-shrink: 0;
  opacity: 0.5;
  margin-left: 2%;
  display: flex;
  align-items: center;
}

.ask-card__chevron svg {
  width: 20px;
  height: 20px;
}

/* Answered state - reduced opacity like Flutter */
.ask-card--answered {
  opacity: 0.6;
}

/* Answered badge - positioned bottom right */
.ask-card__answered-badge {
  position: absolute;
  bottom: 6px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.ask-card__answered-badge svg {
  width: 10px;
  height: 10px;
}

.ask-card__answered-text {
  font-size: 9px;
  font-weight: 600;
  text-shadow:
    -0.5px -0.5px 0 rgba(255, 255, 255, 0.5),
    0.4px 0.4px 0 rgba(0, 0, 0, 0.08);
}

/* Ask card hover states for touch/pointer devices */
@media (hover: hover) {
  .ask-card:hover {
    transform: translateY(-2px);
  }
}

@media (hover: none) {
  .ask-card:active {
    transform: scale(0.98);
  }
}

/* ───────────────────────────────────────────────────────────────
   Loading States
   ─────────────────────────────────────────────────────────────── */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  min-height: 200px;
}

.loading-more {
  display: flex;
  justify-content: center;
  padding: var(--space-lg);
}

/* Skeleton loading */
.skeleton-profile {
  display: flex;
  align-items: flex-start;
  gap: 4%;
  margin-bottom: var(--space-lg);
}

.skeleton-avatar {
  width: 25%;
  max-width: 120px;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

.skeleton-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.skeleton-username {
  height: 20px;
  width: 50%;
}

.skeleton-description {
  flex: 1;
  min-height: 60px;
  border-radius: var(--radius-sm);
}

.skeleton-stats {
  height: 60px;
  width: 100%;
  margin-bottom: var(--space-lg);
}

.skeleton-button {
  height: 50px;
  width: 200px;
  margin: 0 auto var(--space-xl);
  border-radius: var(--radius-lg);
}

.skeleton-ask-card {
  height: 80px;
  width: 100%;
  margin-bottom: var(--space-md);
}

/* ───────────────────────────────────────────────────────────────
   Error State
   ─────────────────────────────────────────────────────────────── */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  text-align: center;
  min-height: 300px;
}

.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #F44336;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  margin-bottom: var(--space-md);
}

.error-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.error-message {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  max-width: 300px;
}

/* ───────────────────────────────────────────────────────────────
   Responsive Adjustments
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .profile-picture-container {
    width: 28%;
    max-width: 100px;
  }

  .profile-username {
    font-size: 14px;
  }
}

@media (min-width: 768px) {
  .profile-page {
    padding-top: var(--space-xl);
    width: 100%;
  }

  .profile-picture-container {
    width: 25%;
    max-width: 150px;
  }

  .send-ask-section {
    margin-bottom: var(--space-xl);
  }

  .ask-card {
    padding: 4%;
  }
}

@media (min-width: 1024px) {
  .profile-page {
    padding-top: 40px;
  }

  .profile-header {
    gap: 5%;
  }

  .profile-picture-container {
    max-width: 160px;
  }
}

/* ───────────────────────────────────────────────────────────────
   App Download Banner (sticky bottom, mobile only)
   ─────────────────────────────────────────────────────────────── */
.app-download-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--background-color, #F6F5EF);
  border-top: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.app-banner-content {
  max-width: var(--max-content-width, 480px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-banner-text strong {
  font-size: 15px;
  color: var(--text-primary, rgba(0,0,0,0.87));
}

.app-banner-text span {
  font-size: 13px;
  color: var(--text-secondary, rgba(0,0,0,0.54));
}

.app-banner-btn {
  white-space: nowrap;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
