/*
Theme Name: AppVerse
Theme URI: https://appverse.io
Author: AppVerse
Author URI: https://appverse.io
Description: The official AppVerse dark marketplace theme. Built for independent app distribution with a sleek, modern dark UI inspired by the world's best app stores.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: appverse
Tags: dark, custom-menu, custom-logo, featured-images, full-width-template, threaded-comments, translation-ready
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --bg:        #0a0a0f;
  --surface:   #111118;
  --surface2:  #1a1a24;
  --surface3:  #22223a;
  --border:    rgba(255,255,255,0.07);
  --accent:    #6c63ff;
  --accent2:   #ff6584;
  --accent3:   #43e8b0;
  --text:      #f0f0fa;
  --muted:     #6b6b8a;
  --tag-bg:    rgba(108,99,255,0.15);
  --radius:    16px;
  --radius-sm: 10px;
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --nav-h:     64px;
  --max-w:     1280px;
  --gutter:    32px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #9d97ff; }

ul, ol { list-style: none; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.3px;
  color: var(--text);
}
h1 { font-size: clamp(28px, 4vw, 48px); font-weight: 800; letter-spacing: -1px; }
h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 700; }
h3 { font-size: clamp(18px, 2.5vw, 22px); }
h4 { font-size: 18px; }
h5 { font-size: 15px; }
h6 { font-size: 13px; }

p { margin-bottom: 1em; color: var(--muted); font-size: 15px; }
p:last-child { margin-bottom: 0; }

strong { color: var(--text); font-weight: 600; }
em { font-style: italic; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 16px 24px;
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 24px 0;
  color: var(--muted);
  font-size: 15px;
  font-style: italic;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--accent3);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-content {
  padding-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
}

/* Grid utilities */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(10,10,15,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Logo */
.site-logo a,
.site-logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}
.site-logo img {
  height: 36px;
  width: auto;
}

/* Primary Navigation */
.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.primary-nav .menu-item a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  display: block;
  transition: all 0.2s;
  text-decoration: none;
}
.primary-nav .menu-item a:hover,
.primary-nav .menu-item.current-menu-item a {
  color: var(--text);
  background: var(--surface);
}

/* Dropdown */
.primary-nav .menu-item-has-children {
  position: relative;
}
.primary-nav .sub-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.2s;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
}
.primary-nav .menu-item-has-children:hover .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.primary-nav .sub-menu .menu-item a {
  font-size: 13px;
  border-radius: 6px;
  padding: 8px 12px;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn,
button.btn,
input[type="submit"],
input[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary,
input[type="submit"] {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover,
input[type="submit"]:hover {
  background: #7d76ff;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(108,99,255,0.3);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface3);
  color: var(--text);
}

.btn-ghost {
  background: none;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-accent2 {
  background: var(--accent2);
  color: #fff;
}
.btn-accent2:hover {
  background: #ff7a97;
  color: #fff;
}

.btn-sm { padding: 7px 16px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 32px; font-size: 15px; border-radius: 12px; }
.btn-full { width: 100%; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.25s;
}
.card:hover {
  border-color: rgba(108,99,255,0.25);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.card-sm { padding: 16px; border-radius: var(--radius-sm); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
}
.badge-accent  { background: var(--tag-bg); border-color: rgba(108,99,255,0.2); color: var(--accent); }
.badge-green   { background: rgba(67,232,176,0.1); border-color: rgba(67,232,176,0.2); color: var(--accent3); }
.badge-red     { background: rgba(255,101,132,0.1); border-color: rgba(255,101,132,0.2); color: var(--accent2); }
.badge-yellow  { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.2); color: #fbbf24; }
.badge-muted   { background: var(--surface2); border-color: var(--border); color: var(--muted); }

/* ============================================================
   SECTION UTILITIES
   ============================================================ */
.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }
.section-lg { padding: 96px 0; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.section-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.section-link:hover { text-decoration: underline; }

/* Eyebrow label */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent3);
  margin-bottom: 12px;
  display: block;
}

/* ============================================================
   HERO (default page hero)
   ============================================================ */
.page-hero {
  padding: 72px var(--gutter) 64px;
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
}

.page-hero-inner {
  background: linear-gradient(135deg, #1a1030 0%, #0f1a30 50%, #101a20 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 60px 64px;
  position: relative;
  overflow: hidden;
}
.page-hero-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 80% 50%, rgba(108,99,255,0.15) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(67,232,176,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.page-hero-content { position: relative; z-index: 1; max-width: 600px; }
.page-hero h1 { margin-bottom: 16px; }
.page-hero p { font-size: 16px; line-height: 1.7; margin-bottom: 28px; max-width: 480px; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================================================
   POSTS / BLOG
   ============================================================ */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  border-color: rgba(108,99,255,0.3);
  transform: translateY(-3px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}

.post-thumbnail {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface2);
}
.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.post-card:hover .post-thumbnail img { transform: scale(1.03); }

.post-thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: linear-gradient(135deg, var(--surface2), var(--surface3));
}

.post-body { padding: 24px; flex: 1; display: flex; flex-direction: column; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.post-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}
.post-date { font-size: 12px; color: var(--muted); }

.post-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
}
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--accent); }

.post-excerpt {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
}

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.post-author { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.post-author img { width: 28px; height: 28px; border-radius: 50%; }
.post-author-name { color: var(--muted); }
.post-read-more { font-size: 13px; font-weight: 600; color: var(--accent); }

/* Single Post */
.single-post {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px var(--gutter);
}

.single-post-header { margin-bottom: 40px; }
.single-post-header h1 { margin-bottom: 20px; }

.post-content h2 { margin: 32px 0 16px; font-size: 24px; }
.post-content h3 { margin: 28px 0 12px; font-size: 20px; }
.post-content p  { font-size: 16px; line-height: 1.8; color: var(--muted); margin-bottom: 20px; }
.post-content ul,
.post-content ol { padding-left: 24px; margin-bottom: 20px; }
.post-content li { font-size: 15px; color: var(--muted); margin-bottom: 8px; line-height: 1.7; }
.post-content ul li { list-style: disc; }
.post-content ol li { list-style: decimal; }
.post-content img { border-radius: var(--radius-sm); margin: 24px 0; }
.post-content a { color: var(--accent); }
.post-content a:hover { text-decoration: underline; }

/* ============================================================
   COMMENTS
   ============================================================ */
.comments-area {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--gutter) 48px;
}
.comments-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.comment-list { display: flex; flex-direction: column; gap: 20px; margin-bottom: 40px; }
.comment-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}
.comment-author { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.comment-author img { border-radius: 50%; }
.comment-author-name { font-weight: 600; font-size: 14px; }
.comment-date { font-size: 12px; color: var(--muted); }
.comment-text { font-size: 14px; color: var(--muted); line-height: 1.6; }
.comment-form label { font-size: 13px; color: var(--muted); font-weight: 500; }
.comment-form-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.form-submit input[type="submit"] { margin-top: 8px; }

/* ============================================================
   SIDEBAR & WIDGETS
   ============================================================ */
.sidebar-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px var(--gutter);
}

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.widget-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.widget ul li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li a { color: var(--muted); }
.widget ul li a:hover { color: var(--accent); }

/* Search widget */
.widget_search .search-field {
  background: var(--surface2);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 48px 0 32px;
  flex-wrap: wrap;
}
.page-numbers {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.2s;
  text-decoration: none;
}
.page-numbers:hover,
.page-numbers.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 32px;
  margin-top: 80px;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 48px;
}

.footer-brand .footer-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  margin-bottom: 16px;
}
.footer-brand p {
  font-size: 13px;
  line-height: 1.7;
  max-width: 240px;
}

.footer-col-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text);
  margin-bottom: 16px;
}
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col ul li a {
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s;
}
.footer-col ul li a:hover { color: var(--text); }

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-copy { font-size: 12px; color: var(--muted); }
.footer-legal { display: flex; gap: 20px; }
.footer-legal a { font-size: 12px; color: var(--muted); }
.footer-legal a:hover { color: var(--text); }

/* ============================================================
   404 PAGE
   ============================================================ */
.error-404 {
  text-align: center;
  padding: 100px var(--gutter);
  max-width: 480px;
  margin: 0 auto;
}
.error-404 .error-code {
  font-family: var(--font-display);
  font-size: 120px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 20px;
}
.error-404 h2 { margin-bottom: 12px; }
.error-404 p { margin-bottom: 28px; }

/* ============================================================
   MEDIA QUERIES
   ============================================================ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --gutter: 20px; }

  .primary-nav,
  .header-actions .btn-ghost { display: none; }

  .menu-toggle { display: flex; }

  .mobile-menu-open .primary-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(10,10,15,0.98);
    backdrop-filter: blur(20px);
    padding: 20px;
    border-bottom: 1px solid var(--border);
    gap: 4px;
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .mobile-menu-open .primary-nav .menu-item a { font-size: 16px; padding: 12px 16px; }

  .sidebar-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-hero-inner { padding: 36px 28px; }
  .posts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* ============================================================
   WORDPRESS CORE CLASSES
   ============================================================ */
.alignleft  { float: left;  margin: 0 24px 16px 0; }
.alignright { float: right; margin: 0 0 16px 24px; }
.aligncenter { display: block; margin: 16px auto; }
.alignwide  { margin-left: -40px; margin-right: -40px; }
.alignfull  { margin-left: calc(-50vw + 50%); margin-right: calc(-50vw + 50%); max-width: 100vw; }

.wp-block-image img { border-radius: var(--radius-sm); }
.wp-caption { font-size: 13px; color: var(--muted); margin-top: 8px; }

.sticky { border-left: 3px solid var(--accent); padding-left: 20px; }

.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;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  z-index: 999;
  border-radius: 0 0 8px 0;
  font-size: 13px;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }
