/* =========================================================
   WHATSAPP-PREVIEW.HTML — WhatsApp preview-specific styles
   (shared tool-widget styles live in css/app-shared.css,
   design tokens live in css/style.css)
========================================================= */

/* ===== WhatsApp Message ===== */
.whatsapp-message {
  width: 100%;
  max-width: 480px;
  font-family: var(--font-body);
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: background 0.2s ease;
}

.whatsapp-message__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f0f0f0;
  border-bottom: 1px solid #e0e0e0;
}

.whatsapp-message__sender {
  font-weight: 600;
  font-size: 0.88rem;
  color: #075E54;
}

.whatsapp-message__time {
  font-size: 0.7rem;
  color: #999;
}

.whatsapp-message__body {
  padding: 14px 16px 16px;
  background: #e8f0fe;
}

/* ===== WhatsApp Card ===== */
.whatsapp-card {
  width: 100%;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.whatsapp-card__image-wrap {
  aspect-ratio: 1.91/1;
  background: #e8e8e8;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.whatsapp-card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.whatsapp-card__content {
  padding: 10px 12px 12px;
}

.whatsapp-card__domain {
  font-size: 0.7rem;
  color: #999;
  margin: 0 0 4px;
  text-transform: lowercase;
}

.whatsapp-card__title {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  color: #0A0A0A;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.whatsapp-card__description {
  font-size: 0.82rem;
  line-height: 1.3;
  color: #404040;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Dark Mode ===== */
.whatsapp-message.is-dark {
  background: #1a1a1a;
}

.whatsapp-message.is-dark .whatsapp-message__header {
  background: #2d2d2d;
  border-bottom-color: #3d3d3d;
}

.whatsapp-message.is-dark .whatsapp-message__sender {
  color: #4fc3f7;
}

.whatsapp-message.is-dark .whatsapp-message__time {
  color: #888;
}

.whatsapp-message.is-dark .whatsapp-message__body {
  background: #1a1a1a;
}

.whatsapp-card.is-dark {
  background: #2d2d2d;
  border-color: #3d3d3d;
}

.whatsapp-card.is-dark .whatsapp-card__title {
  color: #E7E9EA;
}

.whatsapp-card.is-dark .whatsapp-card__description {
  color: #AAAAAA;
}

.whatsapp-card.is-dark .whatsapp-card__domain {
  color: #888888;
}

.whatsapp-card.is-dark .whatsapp-card__image-wrap {
  background: #1a1a1a;
}

/* ===== Validation Results ===== */
.preview-section,
.validation-section,
.raw-tags-section {
  margin-bottom: 20px;
}

.section-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 10px;
  text-transform: lowercase;
}

#previewContainer {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#validationList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.validation-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.validation-item .validation-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 1px;
}

.validation-item--success .validation-icon {
  background: var(--green);
  color: #fff;
}

.validation-item--warning .validation-icon {
  background: var(--amber);
  color: #fff;
}

.validation-item--error .validation-icon {
  background: var(--red);
  color: #fff;
}

.validation-item strong {
  font-weight: 600;
  color: var(--ink);
  display: block;
}

.validation-item .validation-detail {
  color: var(--muted);
  font-size: 0.82rem;
  display: block;
}

/* Dark mode validation items */
.app-preview__stage.is-dark .validation-item {
  background: #1A1A1A;
  border-color: #2A2A2A;
}

.app-preview__stage.is-dark .validation-item strong {
  color: #E7E9EA;
}

/* ===== Raw Tags ===== */
.raw-tags {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.raw-tags .tag {
  color: var(--blue-ink);
}

.raw-tags .attr {
  color: var(--pink);
}

.raw-tags .value {
  color: var(--green);
}

.raw-tags .comment {
  color: var(--muted);
  font-style: italic;
}

.app-preview__stage.is-dark .raw-tags {
  background: #1A1A1A;
  border-color: #2A2A2A;
  color: #AAAAAA;
}

/* ===== URL Input ===== */
.url-input-wrap {
  display: flex;
  gap: 10px;
}

.url-input-wrap input[type="url"] {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}

.url-input-wrap input[type="url"]:focus {
  border-color: var(--blue);
}

.url-input-wrap .btn {
  flex-shrink: 0;
}

/* ===== Dropzone ===== */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--blue);
  background: #EEF3FF;
}

.dropzone p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.image-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.image-preview-row img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 520px) {
  .url-input-wrap {
    flex-direction: column;
  }

  .url-input-wrap .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Loading State ===== */
.validation-item--loading .validation-icon {
  animation: spin 1s linear infinite;
  border: 2px solid var(--border-strong);
  border-top-color: var(--blue);
  background: transparent;
}

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

/* ===== Shared app styles (reused from other tools) ===== */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.breadcrumb a {
  text-decoration: none;
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--blue-ink);
}

.breadcrumb span[aria-current] {
  color: var(--ink);
  font-weight: 600;
}

.app-hero {
  padding: 56px 0 40px;
}

.app-hero__title {
  font-size: clamp(2rem, 4vw, 3rem);
  max-width: 720px;
}

.app-hero__subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin-bottom: 8px;
}

.btn--sm {
  padding: 9px 16px;
  font-size: 0.85rem;
}

.btn--text {
  background: none;
  border: none;
  color: var(--muted);
  padding: 9px 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn--text:hover {
  color: var(--ink);
}

.app-tool {
  padding-top: 24px;
}

.app-tool__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 960px) {
  .app-tool__grid {
    grid-template-columns: 1fr;
  }
}

.app-form__body {
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 520px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.72rem;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="url"] {
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}

.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field input[type="url"]:focus {
  border-color: var(--blue);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
  background: var(--bg);
}

.segmented__btn {
  border: none;
  background: none;
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmented__btn.is-active {
  background: var(--ink);
  color: #fff;
}

.app-form__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.form-note {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0;
}

.app-preview {
  position: sticky;
  top: 96px;
}

.app-preview__stage {
  padding: 26px 20px;
  background: var(--bg);
  transition: background 0.2s ease;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.app-preview__stage.is-dark {
  background: #000;
}

.safe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 32px;
}

@media (max-width: 860px) {
  .safe-grid {
    grid-template-columns: 1fr;
  }
}

.safe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
}

.safe-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.safe-card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 32px;
}

@media (max-width: 960px) {
  .tips-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .tips-grid {
    grid-template-columns: 1fr;
  }
}

.tips-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
}

.tips-card__mark {
  color: var(--blue-ink);
  font-size: 0.78rem;
  display: block;
  margin-bottom: 10px;
}

.tips-card h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.tips-card p {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0;
}

.tips-card code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 32px;
}

@media (max-width: 760px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.related-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.related-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.related-card .platform-mark {
  width: 34px;
  height: 34px;
  font-size: 0.85rem;
  border-radius: 8px;
}
