/*
 * InstaGrab — Neobrutalism Theme
 * Vanilla rewrite of the Ionic global.scss styles.
 */

:root {
  --color-primary: #D62976;
  --color-primary-shade: #bc2468;
  --color-secondary: #962FBF;
  --color-secondary-shade: #8429a8;
  --color-tertiary: #FA7E1E;
  --color-success: #10B981;
  --color-danger: #EF4444;
  --color-medium: #92949c;

  --bg: #FFF8F0;
  --surface: #FFFFFF;
  --text: #1A1A2E;
  --text-muted: #6B7280;
  --hairline: #EFEFEF;

  --shadow-brutal: 4px 4px 0px var(--text);
  --shadow-brutal-sm: 2px 2px 0px var(--text);
  --shadow-brutal-active: 1px 1px 0px var(--text);

  --radius-card: 16px;
  --radius-button: 14px;
  --radius-input: 12px;

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
  min-height: 100vh;
}

button { font-family: inherit; }

/* ─── App shell ─── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 2.5px solid var(--text);
}

.toolbar {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 16px;
}

.toolbar-title {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  margin: 0;
}

.app-content {
  flex: 1;
  padding-bottom: 96px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-button);
  border: 2.5px solid var(--text);
  box-shadow: var(--shadow-brutal);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
  min-height: 48px;
  padding: 0 18px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
  user-select: none;
}

.btn:active:not(:disabled) {
  box-shadow: var(--shadow-brutal-active);
  transform: translate(3px, 3px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
}

.btn-clear {
  border: 0;
  box-shadow: none;
  background: transparent;
  min-height: 36px;
  padding: 0 6px;
  color: var(--color-medium);
}

.btn-clear:active {
  transform: none;
  box-shadow: none;
}

.btn .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ─── Card ─── */
.card {
  background: var(--surface);
  border: 2.5px solid var(--text);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-brutal);
  overflow: hidden;
  margin: 16px 0;
}

.card-content {
  padding: 14px 16px;
  white-space: pre-line;
  word-break: break-word;
}

.card-danger {
  background: var(--color-danger);
  color: #fff;
}

/* ─── Rich error card (categorized failures) ─── */
.error-card {
  background: var(--surface);
  color: var(--text);
  padding: 18px 18px 20px;
}

.error-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.error-icon-bubble {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2.5px solid var(--text);
  box-shadow: 3px 3px 0 var(--text);
  background: #fff;
}

.error-icon-bubble .icon {
  width: 28px;
  height: 28px;
}

.error-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.15;
}

.error-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.error-body {
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-line;
  word-break: break-word;
}

/* Per-code accent colors on the icon bubble */
.error-card.error-private .error-icon-bubble { background: #fff3e0; color: #b65a00; }
.error-card.error-age .error-icon-bubble,
.error-card.error-sensitive .error-icon-bubble { background: #fde4e4; color: #c0392b; }
.error-card.error-notfound .error-icon-bubble { background: #e8eef6; color: #355987; }
.error-card.error-invalid .error-icon-bubble { background: #fff3e0; color: #b65a00; }
.error-card.error-rate .error-icon-bubble { background: #fff8d6; color: #8a6d00; }
.error-card.error-network .error-icon-bubble { background: #ececec; color: #444; }
.error-card.error-unknown .error-icon-bubble { background: #fde4e4; color: #c0392b; }

/* ─── Item row (post header) ─── */
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1.5px solid var(--hairline);
}

.item-row .item-label {
  flex: 1;
  min-width: 0;
}

.item-row .item-label h2 {
  font-size: 0.95rem;
  margin: 0 0 2px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.item-row .item-label p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* ─── Avatar ─── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FEDA75, #FA7E1E, #D62976, #962FBF, #4F5BD5);
  border: 2px solid var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar strong {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
}

/* ─── Chip / Badge ─── */
.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  border: 2px solid var(--text);
  background: var(--color-secondary);
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  border: 1.5px solid var(--text);
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  vertical-align: middle;
}

/* ─── Input ─── */
.input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  padding: 12px 4px 12px 12px;
  min-width: 0;
}

.input::placeholder { color: var(--color-medium); }

/* ─── Skeleton ─── */
.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, #ececec 0%, #f6f6f6 50%, #ececec 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
}

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

/* ─── Spinner (crescent) ─── */
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

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

/* ─── Utility ─── */
.margin-horizontal { margin-left: 16px; margin-right: 16px; }
.hidden { display: none !important; }
