/* ACI App Store — modern UI */
:root {
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --accent: #10b981;
  --accent-600: #059669;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --header-h: 64px;
}

* { box-sizing: border-box; }
html, body { padding: 0; margin: 0; overflow-x: hidden; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }
input { font-family: inherit; }

/* Layout */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 32px 0 64px; }
.container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 32px; }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-header__inner {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand__logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: grid; place-items: center; color: #fff; font-weight: 700;
  box-shadow: var(--shadow-md);
}
.brand__name { color: var(--text); }
.brand__sub { color: var(--muted); font-weight: 500; font-size: 12px; }

/* Hero */
.hero {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
  color: #fff; border-radius: 20px; padding: 40px 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: -50% -10% auto auto;
  width: 320px; height: 320px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); filter: blur(40px);
}
.hero__title { margin: 0 0 8px; font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -.02em; }
.hero__subtitle { margin: 0 0 24px; opacity: .9; font-size: 15px; }
.hero__search {
  position: relative; max-width: 640px;
}
.hero__search input {
  width: 100%; padding: 14px 16px 14px 46px;
  border-radius: 12px; border: 0; background: rgba(255, 255, 255, .95);
  color: var(--text); font-size: 15px;
  box-shadow: var(--shadow-md);
  transition: box-shadow .2s, transform .2s;
}
.hero__search input:focus { outline: 2px solid #fff; outline-offset: 2px; }
.hero__search svg {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted);
}

/* Card grid */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 0 20px; font-size: 18px; font-weight: 600;
}
.section-title small { color: var(--muted); font-weight: 500; font-size: 13px; }

.grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* App card */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }

.card__media {
  position: relative; aspect-ratio: 4 / 3;
  background:
    radial-gradient(circle at 30% 20%, rgba(124, 58, 237, .08), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(79, 70, 229, .08), transparent 60%),
    linear-gradient(135deg, #f8fafc, #eef2ff);
  display: grid; place-items: center; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card__media::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 70%, rgba(15, 23, 42, .04));
  pointer-events: none;
}
.card__media img {
  max-width: 72%; max-height: 72%;
  width: auto; height: auto; object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(15, 23, 42, .12));
  transition: transform .35s ease;
}
.card:hover .card__media img { transform: scale(1.06) translateY(-2px); }
.card__body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__title {
  font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.card__meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  background: var(--primary-50); color: var(--primary-600); font-size: 11px; font-weight: 600;
}
.badge--soft {
  background: #f1f5f9; color: var(--muted);
}
.card__actions {
  margin-top: auto; padding-top: 12px; display: flex; gap: 8px;
}
.card__actions .btn {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 8px;
  letter-spacing: .01em;
}
.card__actions .btn svg { width: 14px; height: 14px; }
.card__actions .btn--copy {
  flex: 1;
  background: #fff;
  color: var(--primary-600);
  border: 1px solid var(--primary-50);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, .04);
  transition: background .2s, border-color .2s, color .2s;
}
.card__actions .btn--copy:hover {
  background: var(--primary-50);
  border-color: #c7d2fe;
  color: var(--primary-600);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; transition: background .2s, transform .1s, box-shadow .2s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: #fff; flex: 1; }
.btn--primary:hover { background: var(--primary-600); }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--primary-50); color: var(--primary-600); border-color: var(--primary-50); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-600); }
.btn--icon { padding: 9px 11px; }
.btn--lg { padding: 12px 18px; font-size: 14px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

/* Detail page */
.detail {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px; box-shadow: var(--shadow-sm);
  display: grid; gap: 32px; grid-template-columns: 280px 1fr;
}
.detail__media {
  aspect-ratio: 1; border-radius: 18px; overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 30% 20%, rgba(124, 58, 237, .1), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(79, 70, 229, .1), transparent 60%),
    linear-gradient(135deg, #f8fafc, #eef2ff);
  display: grid; place-items: center;
  border: 1px solid var(--border);
}
.detail__media img {
  max-width: 70%; max-height: 70%;
  width: auto; height: auto; object-fit: contain;
  filter: drop-shadow(0 16px 28px rgba(15, 23, 42, .15));
}
.detail__info h1 { margin: 0 0 8px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.detail__meta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; color: var(--muted); font-size: 14px; }
.detail__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Skeleton */
.skel-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.skel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.skel-bar, .skel-media {
  background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite;
}
.skel-media { aspect-ratio: 4 / 3; }
.skel-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.skel-bar { height: 12px; border-radius: 6px; }
.skel-bar.w-50 { width: 50%; }
.skel-bar.w-70 { width: 70%; }
.skel-bar.w-100 { width: 100%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty state */
.empty {
  text-align: center; padding: 64px 24px;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--muted);
}
.empty__title { font-size: 16px; font-weight: 600; color: var(--text); margin: 12px 0 4px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px; z-index: 100;
}
.toast svg { width: 16px; height: 16px; color: var(--accent); }
.toast-enter-active, .toast-leave-active { transition: opacity .25s, transform .25s; }
.toast-enter, .toast-leave-to { opacity: 0; transform: translate(-50%, 12px); }

/* Footer */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0; text-align: center;
  color: var(--muted); font-size: 13px; background: var(--surface);
}

/* Page transitions */
.page-enter-active, .page-leave-active { transition: opacity .2s ease, transform .2s ease; }
.page-enter, .page-leave-to { opacity: 0; transform: translateY(8px); }

/* Responsive — full coverage */
@media (max-width: 1280px) {
  .container { padding: 0 24px; }
}

@media (max-width: 1024px) {
  .container { padding: 0 20px; }
  .grid, .skel-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
  .hero { padding: 36px 28px; }
}

@media (max-width: 768px) {
  :root { --header-h: 60px; }
  .app-main { padding: 20px 0 40px; }
  .container { padding: 0 16px; }
  .hero { padding: 28px 20px; border-radius: 16px; margin-bottom: 24px; }
  .hero__title { font-size: 22px; }
  .hero__subtitle { font-size: 14px; margin-bottom: 18px; }
  .hero__search input { padding: 12px 14px 12px 42px; font-size: 14px; }
  .detail { grid-template-columns: 1fr; padding: 20px; gap: 20px; border-radius: 16px; }
  .detail__media { max-width: 220px; margin: 0 auto; }
  .detail__info h1 { font-size: 22px; text-align: center; }
  .detail__meta { justify-content: center; }
  .detail__actions { justify-content: center; }
  .grid, .skel-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  .section-title { font-size: 16px; margin-bottom: 14px; }
  .btn--lg { padding: 11px 16px; font-size: 13px; }
}

@media (max-width: 560px) {
  .grid, .skel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card__body { padding: 12px 12px 14px; gap: 6px; }
  .card__title { font-size: 13px; }
  .card__actions { padding-top: 8px; gap: 6px; }
  .btn { padding: 8px 10px; font-size: 12px; }
  .btn--icon { padding: 8px 9px; }
  .hero { padding: 22px 16px; border-radius: 14px; }
  .hero__title { font-size: 20px; }
  .empty { padding: 40px 16px; }
  .detail { padding: 16px; }
  .detail__actions .btn { flex: 1; }
}

@media (max-width: 380px) {
  .grid, .skel-grid { grid-template-columns: 1fr; }
  .container { padding: 0 12px; }
  .app-header__inner { gap: 12px; }
  .brand { font-size: 16px; }
  .brand__logo { width: 32px; height: 32px; }
  .header-nav .btn { padding: 7px 10px; font-size: 12px; }
}

/* Touch / accessibility */
@media (hover: none) {
  .card:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
