/**
 * APK Download Site - Professional Theme
 * Header, Main, Footer - Distinct Colors
 */

/* ========== Base ========== */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: #0f172a;
  color: #f1f5f9;
}

a { color: #38bdf8; text-decoration: none; }
a:hover { color: #7dd3fc; text-decoration: underline; }

/* ========== Layout ========== */
.site-container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }

/* ========== HEADER - Dark Blue Navy ========== */
.site-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 100%);
  border-bottom: 2px solid #2563eb;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.site-header .header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header .logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #38bdf8 !important;
  text-decoration: none !important;
}

.site-header .logo:hover { color: #7dd3fc !important; text-decoration: none !important; }

/* Single Nav - No Duplicates */
.site-header .main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header .main-nav a {
  color: #cbd5e1;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.site-header .main-nav a:hover {
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.1);
  text-decoration: none !important;
}

/* ========== Search Bar ========== */
.search-bar-wrap {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 1rem 0;
}

.search-bar-wrap .search-form { max-width: 600px; margin: 0 auto; }
.search-bar-wrap .search-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  background: #0f172a;
  border: 2px solid #475569;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar-wrap .search-input-wrap:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
.search-bar-wrap .search-form input {
  flex: 1;
  padding: 0.75rem 1.25rem 0.75rem 1.25rem;
  padding-right: 6.5rem;
  font-size: 1rem;
  border: none;
  background: transparent;
  color: #f1f5f9;
  outline: none;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}
.search-bar-wrap .search-form input::placeholder { color: #64748b; }
.search-bar-wrap .search-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  margin: 2px;
  padding: 0 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: #38bdf8;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.search-bar-wrap .search-btn:hover { background: #7dd3fc; }
@media (max-width: 480px) {
  .search-bar-wrap .search-form input { padding-right: 5.5rem; font-size: 0.95rem; padding-top: 0.65rem; padding-bottom: 0.65rem; }
  .search-bar-wrap .search-btn { padding: 0 1rem; font-size: 0.875rem; margin: 2px; }
}

/* ========== MAIN - Slate Dark ========== */
.site-main {
  background: #0f172a;
  min-height: 60vh;
  padding: 2rem 0;
}

.site-main h1, .site-main h2 {
  color: #f1f5f9;
  margin-top: 0;
  margin-bottom: 1rem;
  font-weight: 700;
}

.site-main .section-title {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  color: #38bdf8;
  border-bottom: 2px solid #334155;
  padding-bottom: 0.5rem;
}

/* ========== Cards Grid ========== */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (min-width: 1024px) {
  .app-grid { grid-template-columns: repeat(5, 1fr); }
}

.app-card {
  display: block;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: all 0.2s;
  position: relative;
}

.app-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.15);
  transform: translateY(-2px);
}

.app-card img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  margin: 0 auto 0.75rem;
  display: block;
}

.app-card h3 {
  font-size: 0.95rem;
  color: #f1f5f9;
  margin: 0 0 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-card .meta { font-size: 0.75rem; color: #cbd5e1; margin-bottom: 0.75rem; }
.app-card .btn-visit {
  display: block;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  padding: 0.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
}

.app-card:hover .btn-visit { background: rgba(56, 189, 248, 0.3); }
.app-card .badge-sponsored {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #f59e0b;
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
}

.pagination a {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
}

.pagination a:hover {
  background: #334155;
  color: #7dd3fc;
  text-decoration: none;
}

.pagination span { color: #94a3b8; }

/* ========== Recent App / Last Search Sections ========== */
.footer-section {
  background: #1e293b;
  border-top: 1px solid #334155;
  padding: 2rem 0;
  margin-top: 2rem;
}

.footer-section h2 {
  color: #f1f5f9;
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.footer-section p { color: #94a3b8; margin-bottom: 1rem; }

.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-tags a {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  background: #334155;
  color: #cbd5e1;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.search-tags a:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  text-decoration: none;
}

/* ========== FOOTER - Darkest ========== */
.site-footer {
  background: linear-gradient(180deg, #0a0f1a 0%, #020617 100%);
  border-top: 2px solid #1e3a5f;
  padding: 2rem 0;
  margin-top: 0;
}

.site-footer .footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.site-footer .copyright { color: #64748b; font-size: 0.875rem; }

.site-footer .footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer .footer-nav a {
  color: #cbd5e1;
  font-size: 0.875rem;
  font-weight: 500;
}

.site-footer .footer-nav a:hover {
  color: #38bdf8 !important;
  text-decoration: none !important;
}

/* ========== App Detail / Article ========== */
.app-detail { max-width: 900px; margin: 0 auto; }
.article-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
}
.article-card .card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
}
.article-card .card-top img {
  width: 128px;
  height: 128px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}
.article-card .card-top .info { flex: 1; min-width: 200px; }
.article-card .card-top h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.article-card .card-top .meta { color: #94a3b8; font-size: 0.875rem; margin: 0.5rem 0; }
.article-card .card-top .meta a { color: #38bdf8; }
.btn-download {
  display: inline-block;
  background: #38bdf8;
  color: #0f172a !important;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  margin-top: 0.5rem;
  text-decoration: none !important;
}
.btn-download:hover { background: #7dd3fc; }
.article-card .card-section {
  padding: 1.5rem 2rem;
  border-top: 1px solid #334155;
}
.article-card .card-section h2 { margin: 0 0 1rem; font-size: 1.125rem; }
.article-card input, .article-card textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #0f172a;
  color: #f1f5f9;
  margin-bottom: 1rem;
}
.article-card label { display: block; color: #94a3b8; font-size: 0.875rem; margin-bottom: 0.25rem; }
.btn-submit { background: #38bdf8; color: #0f172a; padding: 0.5rem 1.25rem; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-submit:hover { background: #7dd3fc; }
.comment-box { background: #0f172a; padding: 1rem; border-radius: 8px; margin-bottom: 1rem; }
.comment-box p { margin: 0.25rem 0; }
.screenshots-row { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 0.5rem; }
.screenshots-row img { width: 180px; height: 192px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }

/* Rich content (Pages & App descriptions - TinyMCE output) */
.rich-content { line-height: 1.7; color: #e2e8f0; }
.rich-content h1, .rich-content h2, .rich-content h3, .rich-content h4 { color: #f1f5f9; margin: 1.5rem 0 0.75rem; font-weight: 700; }
.rich-content h1 { font-size: 1.5rem; }
.rich-content h2 { font-size: 1.25rem; }
.rich-content h3 { font-size: 1.1rem; }
.rich-content h4 { font-size: 1rem; }
.rich-content p { margin: 0 0 1rem; }
.rich-content ul, .rich-content ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.rich-content li { margin-bottom: 0.25rem; }
.rich-content a { color: #38bdf8; text-decoration: none; }
.rich-content a:hover { text-decoration: underline; }
.rich-content blockquote { border-left: 4px solid #334155; margin: 1rem 0; padding-left: 1rem; color: #94a3b8; }
.rich-content pre, .rich-content code { background: #0f172a; padding: 0.2rem 0.4rem; border-radius: 4px; font-size: 0.9em; }
.rich-content img { max-width: 100%; height: auto; border-radius: 8px; }

/* Category grid */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.cat-card {
  display: block;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s;
}
.cat-card:hover { border-color: #38bdf8; }
.cat-card img, .cat-card .cat-icon { width: 64px; height: 64px; margin: 0 auto 0.75rem; border-radius: 10px; object-fit: cover; display: block; }
.cat-card .cat-icon { background: rgba(56, 189, 248, 0.2); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.cat-card p { margin: 0.25rem 0; }
.cat-card .cat-name { font-weight: 600; color: #f1f5f9; }
.cat-card .cat-count { font-size: 0.8rem; color: #94a3b8; }

/* ========== Utility ========== */
.text-muted { color: #94a3b8; }
.text-center { text-align: center; }
.btn-home { display: inline-block; background: #38bdf8; color: #0f172a !important; padding: 0.75rem 1.5rem; border-radius: 10px; font-weight: 600; text-decoration: none !important; }
.btn-home:hover { background: #7dd3fc; }
