/* === Transitions === */
[data-screen] {
  transition: opacity 150ms ease;
}

/* === Skeleton Loading === */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-subtle) 25%,
    var(--color-bg-card) 50%,
    var(--color-bg-subtle) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-photo {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--space-sm);
}

.skeleton-text-short {
  height: 14px;
  width: 60%;
  margin-bottom: var(--space-sm);
}

.skeleton-text-xs {
  height: 12px;
  width: 40%;
}

.skeleton-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.skeleton-card .skeleton-body {
  padding: var(--space-md);
}

/* === Toast Animation === */
.toast {
  animation: toastSlideUp 300ms ease forwards;
}

@keyframes toastSlideUp {
  from {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* === Spinner === */
.spinner {
  display: inline-block;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-sm {
  width: 24px;
  height: 24px;
}

.spinner-md {
  width: 36px;
  height: 36px;
}

.spinner-lg {
  width: 48px;
  height: 48px;
}

.spinner-inline {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Pull-to-Refresh === */
.pull-refresh-indicator {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 200ms ease, opacity 200ms ease;
  opacity: 0;
}

.pull-refresh-indicator.refreshing {
  opacity: 1;
}

.pull-refresh-indicator .spinner {
  margin: var(--space-sm) auto;
}

/* === Action Sheet (REQ-00-125) === */
.action-sheet {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  overflow: hidden;
  max-width: 100vw;
}

.action-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 300ms ease;
  z-index: 0;
}

.action-sheet.open .action-sheet-backdrop {
  opacity: 1;
}

.action-sheet-content {
  position: relative;
  width: 100%;
  max-width: 414px;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}

.action-sheet.open .action-sheet-content {
  transform: translateY(0);
}

.action-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.action-sheet-header h3 {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-semibold);
}

.action-sheet-close {
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: 50%;
  background: var(--color-bg-subtle);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.action-sheet-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 56px;
  transition: var(--transition-fast);
}

.action-sheet-option:hover {
  background: var(--color-bg-subtle);
}

.action-sheet-option:active {
  background: var(--color-bg-subtle);
}

.action-sheet-option .option-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.action-sheet-option .option-text {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
}

/* === Dialog / Modal === */
.dialog {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 200ms ease;
}

.dialog.open .dialog-backdrop {
  opacity: 1;
}

.dialog-content {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  z-index: 1;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}

.dialog.open .dialog-content {
  transform: scale(1);
  opacity: 1;
}

.dialog-title {
  font-size: var(--font-size-card-title);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-sm);
}

.dialog-description {
  font-size: var(--font-size-body);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  line-height: var(--line-height-normal);
}

.dialog-actions {
  display: flex;
  gap: var(--space-sm);
}

.dialog-actions .btn {
  flex: 1;
}

/* === Offline Banner === */
.offline-banner {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: #FEF3CD;
  color: #856404;
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-medium);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.offline-banner .offline-icon {
  font-size: 18px;
}

/* === Carousel === */
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.carousel-track {
  display: flex;
  transition: transform 300ms ease;
}

.carousel-slide {
  min-width: 100%;
  aspect-ratio: 16/9;
  background: var(--color-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.carousel-dots {
  position: absolute;
  bottom: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-xs);
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: var(--transition-fast);
}

.carousel-dot.active {
  background: white;
  width: 24px;
  border-radius: 4px;
}

.carousel-counter {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-caption);
}

/* === Message Bubbles === */
.message-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
}

.message-bubble {
  max-width: 80%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
}

.message-bubble.sent {
  align-self: flex-end;
  background-color: var(--color-primary);
  color: var(--color-text-on-primary);
  border-bottom-right-radius: var(--space-xs);
}

.message-bubble.received {
  align-self: flex-start;
  background-color: var(--color-bg-subtle);
  color: var(--color-text-primary);
  border-bottom-left-radius: var(--space-xs);
}

.message-time {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.message-time.sent {
  text-align: right;
}

/* === Phone Reveal Banner === */
.phone-reveal-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-radius: var(--radius-md);
  margin: var(--space-sm) var(--space-md);
}

.phone-reveal-banner .phone-number {
  flex: 1;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-body);
}

.phone-reveal-banner .phone-action {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: rgba(255,255,255,0.2);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  border: none;
  color: inherit;
}

/* === Message Input Bar === */
.message-input-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  position: sticky;
  bottom: 0;
}

.message-input-bar .message-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: var(--font-size-body);
  font-family: var(--font-family-body);
  resize: none;
  outline: none;
  line-height: var(--line-height-normal);
}

.message-input-bar .message-input:focus {
  border-color: var(--color-primary);
}

.message-input-bar .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.message-input-bar .send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
