/* ============================================================
   Portal Aplikasi — Pendidikan Matematika FKIP ULM
   style.css
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
  --font-body: 'Inter', sans-serif;
  --font-display: 'Plus Jakarta Sans', sans-serif;

  /* dark theme (default) */
  --bg-base: #080d1a;
  --bg-surface: #0e1628;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(14, 22, 40, 0.7);

  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);

  --text-primary: #f0f4ff;
  --text-secondary: #8b9bc8;
  --text-muted: #4a5a80;

  --accent-blue: #3b82f6;
  --accent-gold: #f0b429;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;

  --gradient-hero: linear-gradient(180deg, rgba(8, 13, 26, 0.2) 0%, rgba(14, 30, 58, 0.45) 60%, rgba(8, 13, 26, 0.8) 100%);
  --gradient-gold: linear-gradient(135deg, #f0b429, #e88c00);
  --gradient-blue: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --gradient-green: linear-gradient(135deg, #22c55e, #15803d);
  --gradient-red: linear-gradient(135deg, #ef4444, #b91c1c);
  --gradient-text: linear-gradient(135deg, #60a5fa 0%, #f0b429 100%);

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-card-hover: 0 12px 48px rgba(0,0,0,0.6);
  --shadow-glow-blue: 0 0 40px rgba(59,130,246,0.15);
  --shadow-glow-gold: 0 0 40px rgba(240,180,41,0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --header-height: 68px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Light Theme ---- */
[data-theme="light"] {
  --bg-base: #f4f7ff;
  --bg-surface: #e8eef8;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(244, 247, 255, 0.85);

  --border: rgba(0, 0, 50, 0.08);
  --border-hover: rgba(59, 130, 246, 0.3);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --gradient-hero: linear-gradient(180deg, rgba(219, 234, 254, 0.3) 0%, rgba(237, 233, 254, 0.4) 60%, rgba(244, 247, 255, 0.8) 100%);
  --shadow-card: 0 4px 20px rgba(0,0,50,0.08);
  --shadow-card-hover: 0 12px 40px rgba(0,0,50,0.14);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* ---- 3D Geometry Background Canvas ---- */
.bg-3d-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.95;
  transition: opacity var(--transition);
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.logo-stack {
  display: inline-flex;
  align-items: center;
  position: relative;
  padding-left: 2px;
  padding-right: 6px;
}

.logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.35s ease, z-index 0.35s;
  flex-shrink: 0;
}

.logo-img--siapeka {
  width: 44px;
  height: 44px;
  margin-left: -14px;
  position: relative;
  z-index: 2;
  border-radius: 50%;
  box-shadow: 0 0 0 2.5px var(--bg-surface), 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 16px rgba(240, 180, 41, 0.35);
  background: var(--bg-surface);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease, z-index 0.35s;
}

.brand:hover .logo-img:first-child,
.logo-stack:hover .logo-img:first-child {
  transform: translateX(-4px) scale(1.08) rotate(-4deg);
  filter: drop-shadow(0 6px 14px rgba(239, 68, 68, 0.35)) drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
}

.brand:hover .logo-img--siapeka,
.logo-stack:hover .logo-img--siapeka {
  transform: translateX(4px) scale(1.12) rotate(4deg);
  box-shadow: 0 0 0 2.5px var(--bg-surface), 0 8px 22px rgba(0, 0, 0, 0.5), 0 0 22px rgba(240, 180, 41, 0.6);
  z-index: 3;
}

.logo-img:hover {
  z-index: 5 !important;
  transform: scale(1.18) !important;
}

.logo-circle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.logo-circle--blue {
  background: var(--gradient-blue);
  color: #fff;
  box-shadow: 0 0 16px rgba(59,130,246,0.4);
}

.logo-circle--gold {
  background: var(--gradient-gold);
  color: #fff;
  box-shadow: 0 0 16px rgba(240,180,41,0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---- Search ---- */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
}

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 8px 16px 8px 38px;
  font-size: 13.5px;
  font-family: var(--font-body);
  color: var(--text-primary);
  width: 240px;
  outline: none;
  transition: all var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.search-input:focus + .search-icon,
.search-wrapper:focus-within .search-icon {
  color: var(--accent-blue);
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--accent-gold);
  transform: rotate(15deg);
}

/* ---- PWA Install Button ---- */
.btn-install-pwa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.35);
  color: var(--accent-gold);
  padding: 8px 14px;
  border-radius: 40px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  animation: pulse 2.5s infinite;
}

.btn-install-pwa:hover {
  background: var(--gradient-gold);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(240, 180, 41, 0.4);
}

/* ---- Hero Section ---- */
.hero {
  position: relative;
  z-index: 1;
  padding: 80px 24px 60px;
  text-align: center;
  background: var(--gradient-hero);
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.hero-content {
  max-width: 680px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 40px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #60a5fa;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 24px;
  animation: fadeInDown 0.6s ease both;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.85); }
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 20px;
  animation: fadeInDown 0.6s 0.1s ease both;
}

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 40px;
  animation: fadeInDown 0.6s 0.2s ease both;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  animation: fadeInDown 0.6s 0.3s ease both;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: 40px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--gradient-blue);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}

.filter-count {
  background: rgba(255,255,255,0.15);
  border-radius: 40px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}

.filter-btn:not(.active) .filter-count {
  background: var(--border);
  color: var(--text-muted);
}

/* ---- Main Content ---- */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ---- Apps Grid ---- */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* ---- App Card ---- */
.app-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  cursor: default;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeInUp 0.5s ease both;
}

.app-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
}

/* Shine effect */
.card-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

.app-card:hover .card-shine { opacity: 1; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ---- App Icons ---- */
.app-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card-logo-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.app-card:hover .app-icon { transform: scale(1.08) rotate(-3deg); }

.app-icon--red    { background: var(--gradient-red);   box-shadow: 0 8px 20px rgba(239,68,68,0.35);  color: #fff; }
.app-icon--green  { background: var(--gradient-green); box-shadow: 0 8px 20px rgba(34,197,94,0.35);  color: #fff; }
.app-icon--blue   { background: var(--gradient-blue);  box-shadow: 0 8px 20px rgba(59,130,246,0.35); color: #fff; }
.app-icon--gold   { background: var(--gradient-gold);  box-shadow: 0 8px 20px rgba(240,180,41,0.35); color: #fff; }
.app-icon--purple { background: linear-gradient(135deg,#a855f7,#7c3aed); box-shadow: 0 8px 20px rgba(168,85,247,0.35); color: #fff; }
.app-icon--cyan   { background: linear-gradient(135deg,#06b6d4,#0891b2); box-shadow: 0 8px 20px rgba(6,182,212,0.35); color: #fff; }
.app-icon--orange { background: linear-gradient(135deg,#f97316,#ea580c); box-shadow: 0 8px 20px rgba(249,115,22,0.35); color: #fff; }
.app-icon--pink   { background: linear-gradient(135deg,#ec4899,#db2777); box-shadow: 0 8px 20px rgba(236,72,153,0.35); color: #fff; }
.app-icon--teal   { background: linear-gradient(135deg,#14b8a6,#0d9488); box-shadow: 0 8px 20px rgba(20,184,166,0.35); color: #fff; }
.app-icon--indigo { background: linear-gradient(135deg,#6366f1,#4338ca); box-shadow: 0 8px 20px rgba(99,102,241,0.35); color: #fff; }
.app-icon--slate  { background: linear-gradient(135deg,#64748b,#334155); box-shadow: 0 8px 20px rgba(100,116,139,0.35); color: #fff; }
.app-icon--yellow { background: linear-gradient(135deg,#eab308,#ca8a04); box-shadow: 0 8px 20px rgba(234,179,8,0.35); color: #fff; }

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Star Favorite Pin Button */
.btn-fav {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-fav:hover {
  background: rgba(240, 180, 41, 0.15);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: scale(1.15) rotate(15deg);
}

.btn-fav.is-fav {
  background: rgba(240, 180, 41, 0.2);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(240, 180, 41, 0.3);
}

/* Pinned Favorite Card Highlight */
.app-card--fav {
  border-color: rgba(240, 180, 41, 0.35);
  box-shadow: 0 4px 20px rgba(240, 180, 41, 0.1);
}

.app-card--fav:hover {
  border-color: rgba(240, 180, 41, 0.6);
  box-shadow: 0 12px 36px rgba(240, 180, 41, 0.2);
}

/* Favorite Filter Tab */
.filter-btn--fav.active {
  background: var(--gradient-gold);
  box-shadow: 0 4px 16px rgba(240, 180, 41, 0.4);
}

.filter-btn--fav:not(.active) {
  color: var(--accent-gold);
  border-color: rgba(240, 180, 41, 0.3);
}

.filter-count--fav {
  background: rgba(240, 180, 41, 0.3);
  color: #fff;
}

.app-category-badge {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 40px;
  letter-spacing: 0.04em;
}

[data-category="administrasi"] .app-category-badge {
  background: rgba(240, 180, 41, 0.1);
  border-color: rgba(240, 180, 41, 0.2);
  color: var(--accent-gold);
}

.app-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-green);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse 2s ease infinite;
}

.app-status--offline { color: var(--text-muted); }
.app-status--offline .status-dot { background: var(--text-muted); box-shadow: none; animation: none; }

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-bottom: 20px;
}

.app-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-fullname {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
  line-height: 1.4;
  min-height: 2.8em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.8em;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.card-footer-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.app-domain {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-clicks-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  transition: transform 0.25s ease, color 0.25s ease;
}

.app-clicks-pill svg {
  color: var(--accent-blue);
  flex-shrink: 0;
}

.app-clicks-pill .clicks-val {
  font-weight: 700;
  color: var(--text-primary);
}

.app-clicks-pill.pop-anim {
  transform: scale(1.18);
  color: var(--accent-gold);
}

.app-clicks-pill.pop-anim svg {
  color: var(--accent-gold);
}

.btn-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gradient-blue);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 8px 18px;
  border-radius: 40px;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}

.btn-open:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59,130,246,0.5);
}

.btn-open:active { transform: translateY(0); }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  filter: grayscale(1);
  opacity: 0.5;
}

.empty-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.btn-reset {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-reset:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* ---- Footer ---- */
.site-footer {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 28px 24px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logos {
  display: inline-flex;
  align-items: center;
  position: relative;
  padding-right: 4px;
}

.footer-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
  flex-shrink: 0;
}

.footer-logo-img.logo-img--siapeka {
  width: 36px;
  height: 36px;
  margin-left: -11px;
  position: relative;
  z-index: 2;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg-surface), 0 3px 10px rgba(0, 0, 0, 0.4), 0 0 12px rgba(240, 180, 41, 0.3);
  background: var(--bg-surface);
}

.footer-logos:hover .footer-logo-img:first-child {
  transform: translateX(-3px) scale(1.08);
}

.footer-logos:hover .footer-logo-img.logo-img--siapeka {
  transform: translateX(3px) scale(1.12);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 5px 14px rgba(0, 0, 0, 0.5), 0 0 18px rgba(240, 180, 41, 0.5);
  z-index: 3;
}

.footer-logo-circle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--gradient-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-family: var(--font-display);
}

.footer-logo-circle--gold { background: var(--gradient-gold); }

.footer-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}

.footer-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.footer-right { text-align: right; }

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.footer-sep {
  color: var(--text-muted);
}

.footer-admin-link {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-admin-link:hover {
  color: var(--accent-gold);
}

.footer-domain {
  font-size: 12px;
  color: var(--accent-blue);
  font-family: 'Courier New', monospace;
}

/* ---- Animations ---- */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-card:nth-child(1) { animation-delay: 0.1s; }
.app-card:nth-child(2) { animation-delay: 0.2s; }
.app-card:nth-child(3) { animation-delay: 0.3s; }
.app-card:nth-child(4) { animation-delay: 0.4s; }
.app-card:nth-child(5) { animation-delay: 0.5s; }
.app-card:nth-child(6) { animation-delay: 0.6s; }

/* ---- Responsive Styles for Mobile & Tablets ---- */
@media (max-width: 768px) {
  :root {
    --header-height: auto;
  }

  .site-header {
    height: auto !important;
    min-height: unset;
    padding: 10px 0 10px;
    border-bottom: 1px solid var(--border);
  }

  .header-inner {
    height: auto !important;
    padding: 0 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
  }

  .brand {
    order: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .logo-stack {
    display: inline-flex;
    align-items: center;
    position: relative;
    width: auto;
    height: 36px;
    flex-shrink: 0;
    margin-right: 4px;
    padding: 0;
  }

  .logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
  }

  .logo-img--siapeka {
    width: 36px;
    height: 36px;
    margin-left: -12px;
    position: relative;
    z-index: 2;
  }

  .brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .brand-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-sub {
    font-size: 9.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block !important;
  }

  .header-right {
    order: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .btn-install-pwa {
    padding: 6px 12px;
    font-size: 11.5px;
    gap: 4px;
    border-radius: 20px;
    white-space: nowrap;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  /* Full-width elegant search on row 2 */
  .search-wrapper {
    order: 3;
    flex-basis: 100%;
    width: 100% !important;
    margin: 4px 0 0 0 !important;
  }

  .search-input {
    width: 100% !important;
    font-size: 13px;
    padding: 9px 14px 9px 38px;
    box-sizing: border-box;
    border-radius: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border);
  }

  .search-input:focus {
    width: 100% !important;
  }

  .search-icon {
    left: 12px;
    width: 15px;
    height: 15px;
  }

  .hero {
    padding: 36px 16px 30px;
  }

  .hero-badge {
    font-size: 11px;
    padding: 4px 12px;
    margin-bottom: 14px;
  }

  .hero-title {
    font-size: 1.85rem;
    margin-bottom: 12px;
  }

  .hero-desc {
    font-size: 13.5px;
    margin-bottom: 24px;
  }

  .hero-stats {
    gap: 14px;
  }

  .stat-num {
    font-size: 1.35rem;
  }

  .stat-label {
    font-size: 10px;
  }

  .main-content {
    padding: 20px 16px 50px;
  }

  /* Horizontal swipe for filter categories on mobile */
  .filter-bar {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
    margin-bottom: 20px;
    gap: 6px;
  }

  .filter-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    flex-shrink: 0;
    padding: 7px 14px;
    font-size: 12.5px;
  }

  .apps-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .app-card {
    padding: 20px;
    border-radius: var(--radius-lg);
  }

  .app-icon {
    width: 50px;
    height: 50px;
    border-radius: 13px;
  }

  .app-icon svg {
    width: 24px;
    height: 24px;
  }

  .app-name {
    font-size: 1.3rem;
  }

  .app-desc {
    font-size: 13px;
  }

  .btn-open {
    padding: 9px 18px;
    font-size: 13px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .footer-right {
    text-align: left;
    width: 100%;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 420px) {
  .header-inner {
    padding: 0 12px;
    gap: 6px;
  }

  .brand-title {
    font-size: 12px;
    max-width: 135px;
  }

  .logo-stack {
    width: auto;
    height: 32px;
    padding: 0;
  }

  .logo-img {
    width: 32px;
    height: 32px;
  }

  .logo-img--siapeka {
    width: 32px;
    height: 32px;
    margin-left: -10px;
    left: auto;
  }

  .btn-install-pwa span {
    display: none;
  }

  .btn-install-pwa {
    padding: 7px;
    border-radius: 8px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
  }

  .hero-title {
    font-size: 1.6rem;
  }
}
