/* ═══════════════════════════════════════
   RESET & GLOBAL DESIGN SYSTEM
═══════════════════════════════════════ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--color-bg);
  font-family: 'Nunito', sans-serif;
  padding: 12px;
  color: #111111;
  width: 100%;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}
.icon svg { width: 100%; height: 100%; display: block; }

/* ═══════════════════════════════════════
   THEME ENGINE (brand color tokens)
═══════════════════════════════════════ */
:root {
  --color-bg: #FAF8FC;
  --color-secondary: #A855F7;
  --color-primary: #6D28D9;
  --color-ink: #111111;
  --color-whatsapp: #0a8a0a;
}

/* ═══════════════════════════════════════
   STICKY HEADER
═══════════════════════════════════════ */
.header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--color-bg);
  padding: 16px 14px;
  border-radius: 0 0 24px 24px;
  margin: -12px -12px 18px -12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  position: relative;
}
.sticky-header { position: sticky; top: 0; z-index: 900; }

.title-wrapper { display: flex; align-items: center; }
.title {
  color: #000000;
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

/* ═══════════════════════════════════════
   WAIT TOAST
═══════════════════════════════════════ */
.wait-toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-140%);
  background: #111111; color: #FFFFFF; padding: 10px 18px; border-radius: 30px;
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700;
  z-index: 99999; box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.wait-toast.show { transform: translateX(-50%) translateY(0); }
.wait-toast-spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #FFFFFF; border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ═══════════════════════════════════════
   TOOLS GRID & CARDS
═══════════════════════════════════════ */
.tools-view { padding: 4px; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}

.tool-card {
  position: relative;
  min-width: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #FFFFFF;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.tool-card:active { transform: scale(0.97); }
.tool-card:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.tool-card:disabled { cursor: default; }

.tool-card-content { display: flex; flex-direction: column; flex: 1; width: 100%; min-width: 0; }
.tool-card-loading .tool-card-content { display: none; }

.tool-card-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.tool-card-icon-report { background: var(--color-secondary); color: #FFFFFF; }
.tool-card-icon-community { background: rgba(10,138,10,0.12); color: var(--color-whatsapp); }
.tool-card-icon .icon { width: 22px; height: 22px; }

.tool-card-title {
  font-size: 15px; font-weight: 800; color: var(--color-ink);
  line-height: 1.25; margin-bottom: 6px;
  overflow-wrap: break-word;
}
.tool-card-desc {
  font-size: 12px; font-weight: 600; color: #666666;
  line-height: 1.45; flex: 1;
  overflow-wrap: break-word;
}

.tool-card-footer {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
}
.tool-card-badge {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; color: var(--color-whatsapp);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.tool-card-badge .icon { width: 13px; height: 13px; }
.tool-card-arrow {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-bg); color: var(--color-primary);
  display: flex; align-items: center; justify-content: center; padding: 5px;
}

/* SKELETON LOADING */
@keyframes skeleton-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, #ECECEC 25%, #F7F7F7 37%, #ECECEC 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
.skeleton-circle { border-radius: 50%; flex-shrink: 0; }

.tool-card-skeleton { display: none; flex-direction: column; align-items: flex-start; width: 100%; }
.tool-card-loading .tool-card-skeleton { display: flex; }
.tool-card-loading { box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .skeleton, .wait-toast-spinner { animation: none; }
}

/* ═══════════════════════════════════════
   ERROR STATE
═══════════════════════════════════════ */
.tools-error {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 48px 20px; text-align: center; color: #666; font-weight: 700;
}
.tools-error .icon { width: 40px; height: 40px; color: #C0392B; }
.retry-btn {
  padding: 10px 24px; background: var(--color-primary); color: #FFFFFF;
  border: none; border-radius: 12px; font-weight: 800;
  font-family: 'Nunito', sans-serif; cursor: pointer;
}
.retry-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
