/*
Theme Name: WA Group Directory
Theme URI: https://example.com/wa-group-directory
Author: WA Directory
Description: Production-ready WhatsApp Group Directory theme with multi-step join flow, SEO, submissions, analytics, and admin tools.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wa-group-directory
Tags: directory, custom-post-type, seo, responsive, mobile-first
*/

/* Base reset & tokens */
:root {
  --wad-primary: #25D366;
  --wad-primary-dark: #128C7E;
  --wad-accent: #075E54;
  --wad-bg: #f5f7f9;
  --wad-surface: #ffffff;
  --wad-text: #1a1a1a;
  --wad-muted: #5c6b73;
  --wad-border: #e2e8f0;
  --wad-danger: #dc2626;
  --wad-warning: #f59e0b;
  --wad-radius: 12px;
  --wad-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --wad-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wad-max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--wad-font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--wad-text);
  background: var(--wad-bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--wad-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--wad-primary); outline-offset: 2px; }

.wad-container {
  width: min(100% - 2rem, var(--wad-max));
  margin-inline: auto;
}

/* Header */
.wad-header {
  background: var(--wad-surface);
  border-bottom: 1px solid var(--wad-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.wad-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
  justify-content: space-between;
}
.wad-logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--wad-accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.wad-logo:hover { text-decoration: none; }
.wad-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.wad-nav a {
  color: var(--wad-text);
  font-weight: 500;
  font-size: .95rem;
}
.wad-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--wad-border);
  border-radius: 8px;
  padding: .5rem .75rem;
  cursor: pointer;
  font-size: 1.1rem;
}
.wad-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .7rem 1.25rem;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .1s;
  min-height: 44px;
}
.wad-btn:hover { text-decoration: none; }
.wad-btn--primary {
  background: var(--wad-primary);
  color: #fff;
}
.wad-btn--primary:hover { background: var(--wad-primary-dark); color: #fff; }
.wad-btn--outline {
  background: transparent;
  border: 2px solid var(--wad-primary);
  color: var(--wad-primary-dark);
}
.wad-btn--ghost {
  background: #eef2f5;
  color: var(--wad-text);
}
.wad-btn--lg { padding: .9rem 1.75rem; font-size: 1.05rem; min-height: 52px; }
.wad-btn--block { width: 100%; }

/* Hero */
.wad-hero {
  background: linear-gradient(145deg, #075E54 0%, #128C7E 55%, #25D366 130%);
  color: #fff;
  padding: 3rem 0 3.5rem;
}
.wad-hero h1 {
  margin: 0 0 .75rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
}
.wad-hero p {
  margin: 0 0 1.5rem;
  opacity: .92;
  max-width: 36rem;
  font-size: 1.05rem;
}
.wad-search-form {
  display: flex;
  gap: .5rem;
  max-width: 560px;
  flex-wrap: wrap;
}
.wad-search-form input[type="search"] {
  flex: 1 1 220px;
  min-height: 48px;
  border: none;
  border-radius: 999px;
  padding: 0 1.25rem;
  font-size: 1rem;
}
.wad-hero-cats {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.25rem;
}
.wad-hero-cats a {
  background: rgba(255,255,255,.18);
  color: #fff;
  padding: .35rem .85rem;
  border-radius: 999px;
  font-size: .85rem;
  text-decoration: none;
}
.wad-hero-cats a:hover { background: rgba(255,255,255,.28); }

/* Sections */
.wad-section { padding: 2.5rem 0; }
.wad-section__title {
  margin: 0 0 1.25rem;
  font-size: 1.35rem;
}
.wad-section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* Category grid */
.wad-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}
.wad-cat-card {
  background: var(--wad-surface);
  border: 1px solid var(--wad-border);
  border-radius: var(--wad-radius);
  padding: 1.15rem .9rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, border-color .15s;
}
.wad-cat-card:hover {
  box-shadow: var(--wad-shadow);
  border-color: var(--wad-primary);
  text-decoration: none;
}
.wad-cat-card__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto .65rem;
  border-radius: 12px;
  background: #e8f8ef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
}
.wad-cat-card__icon img { width: 100%; height: 100%; object-fit: cover; }
.wad-cat-card__name { font-weight: 600; font-size: .95rem; }
.wad-cat-card__count { color: var(--wad-muted); font-size: .8rem; margin-top: .25rem; }

/* Group cards */
.wad-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.15rem;
}
.wad-group-card {
  background: var(--wad-surface);
  border: 1px solid var(--wad-border);
  border-radius: var(--wad-radius);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  box-shadow: var(--wad-shadow);
}
.wad-group-card__top {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
}
.wad-group-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  background: #e8f8ef;
  flex-shrink: 0;
}
.wad-group-card__title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}
.wad-group-card__title a { color: inherit; text-decoration: none; }
.wad-group-card__title a:hover { color: var(--wad-primary-dark); }
.wad-group-card__desc {
  margin: 0;
  color: var(--wad-muted);
  font-size: .9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wad-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  font-size: .78rem;
  color: var(--wad-muted);
}
.wad-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .5rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  background: #eef2f5;
  color: var(--wad-muted);
}
.wad-badge--featured { background: #fef3c7; color: #92400e; }
.wad-badge--verified { background: #dbeafe; color: #1e40af; }
.wad-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.wad-tag {
  background: #f0fdf4;
  color: var(--wad-primary-dark);
  padding: .15rem .5rem;
  border-radius: 6px;
  font-size: .75rem;
  text-decoration: none;
}
.wad-tag:hover { background: #dcfce7; text-decoration: none; }
.wad-group-card__actions { margin-top: auto; padding-top: .35rem; }

/* Filters */
.wad-filters {
  background: var(--wad-surface);
  border: 1px solid var(--wad-border);
  border-radius: var(--wad-radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  align-items: end;
}
.wad-filters label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: .3rem;
  color: var(--wad-muted);
}
.wad-filters select,
.wad-filters input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--wad-border);
  border-radius: 8px;
  padding: 0 .75rem;
  font-size: .95rem;
  background: #fff;
}

/* Join flow */
.wad-join {
  max-width: 520px;
  margin: 2rem auto;
  background: var(--wad-surface);
  border-radius: var(--wad-radius);
  border: 1px solid var(--wad-border);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--wad-shadow);
}
.wad-join__icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  margin: 0 auto 1rem;
  object-fit: cover;
  background: #e8f8ef;
}
.wad-join h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
.wad-join__desc { color: var(--wad-muted); margin: 0 0 1.25rem; }
.wad-notice {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: .9rem 1rem;
  font-size: .9rem;
  text-align: left;
  margin: 1rem 0 1.5rem;
  color: #713f12;
}
.wad-steps {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
  font-size: .8rem;
  color: var(--wad-muted);
}
.wad-steps span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef2f5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.wad-steps span.is-active { background: var(--wad-primary); color: #fff; }
.wad-rules-list {
  text-align: left;
  margin: 1rem 0 1.5rem;
  padding-left: 1.25rem;
}
.wad-rules-list li { margin-bottom: .4rem; }

/* Forms */
.wad-form {
  background: var(--wad-surface);
  border: 1px solid var(--wad-border);
  border-radius: var(--wad-radius);
  padding: 1.5rem;
  max-width: 640px;
  margin: 0 auto;
}
.wad-form .wad-field { margin-bottom: 1.1rem; }
.wad-form label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
  font-size: .9rem;
}
.wad-form .required::after { content: " *"; color: var(--wad-danger); }
.wad-form input[type="text"],
.wad-form input[type="url"],
.wad-form input[type="file"],
.wad-form textarea,
.wad-form select {
  width: 100%;
  border: 1px solid var(--wad-border);
  border-radius: 8px;
  padding: .65rem .85rem;
  font-size: 1rem;
  font-family: inherit;
}
.wad-form textarea { min-height: 110px; resize: vertical; }
.wad-form .hint { font-size: .8rem; color: var(--wad-muted); margin-top: .3rem; }
.wad-hp { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.wad-alert {
  padding: .9rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: .95rem;
}
.wad-alert--success { background: #dcfce7; color: #14532d; }
.wad-alert--error { background: #fee2e2; color: #7f1d1d; }

/* Breadcrumbs */
.wad-breadcrumbs {
  font-size: .85rem;
  color: var(--wad-muted);
  padding: 1rem 0 0;
}
.wad-breadcrumbs a { color: var(--wad-muted); }
.wad-breadcrumbs span[aria-current] { color: var(--wad-text); }

/* Pagination */
.wad-pagination {
  display: flex;
  justify-content: center;
  gap: .35rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.wad-pagination a,
.wad-pagination span {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--wad-border);
  background: var(--wad-surface);
  color: var(--wad-text);
  text-decoration: none;
  font-size: .9rem;
  padding: 0 .5rem;
}
.wad-pagination .current {
  background: var(--wad-primary);
  border-color: var(--wad-primary);
  color: #fff;
  font-weight: 600;
}

/* Empty / 404 */
.wad-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--wad-muted);
}
.wad-empty h1, .wad-empty h2 { color: var(--wad-text); }

/* Footer */
.wad-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
  font-size: .9rem;
}
.wad-footer a { color: #cbd5e1; }
.wad-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.wad-footer h3 {
  color: #fff;
  font-size: .95rem;
  margin: 0 0 .75rem;
}
.wad-footer ul { list-style: none; margin: 0; padding: 0; }
.wad-footer li { margin-bottom: .4rem; }
.wad-footer__bottom {
  border-top: 1px solid #1e293b;
  padding-top: 1rem;
  text-align: center;
}

/* Ad slots */
.wad-ad {
  min-height: 0;
  margin: 1rem 0;
  text-align: center;
}
.wad-ad:empty { display: none; }

/* Report modal-ish */
.wad-report-form {
  margin-top: 1.5rem;
  text-align: left;
  border-top: 1px solid var(--wad-border);
  padding-top: 1.25rem;
}

/* Archive layout */
.wad-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 900px) {
  .wad-layout--sidebar {
    grid-template-columns: 240px 1fr;
  }
}
.wad-sidebar {
  background: var(--wad-surface);
  border: 1px solid var(--wad-border);
  border-radius: var(--wad-radius);
  padding: 1rem;
  height: fit-content;
}

/* Mobile nav */
@media (max-width: 768px) {
  .wad-nav-toggle { display: inline-flex; }
  .wad-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 64px;
    background: var(--wad-surface);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    border-bottom: 1px solid var(--wad-border);
    gap: .75rem;
  }
  .wad-nav.is-open { display: flex; }
  .wad-header { position: relative; }
}

/* Screen reader */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}
