/* Ratkaisija Browse – page specific styles */

/* Filters */
.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.filters input {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #334155;
  background: #1e293b;
  color: white;
  font-size: 1rem;
  flex: 1;
  min-width: 200px;
}

.filters input:focus {
  outline: none;
  border-color: #0ea5e9;
}

.sort-btns {
  display: flex;
  gap: 0.5rem;
}

.sort-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.sort-btn:hover {
  border-color: #475569;
}

.sort-btn.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: white;
}

/* Category pills */
.category-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.cat-btn {
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cat-btn:hover {
  border-color: #475569;
  color: white;
}

.cat-btn.active {
  background: linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 100%);
  border-color: transparent;
  color: white;
}

.cat-icon { font-size: 1rem; }

/* App cards */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.app-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 1rem;
  padding: 1.25rem;
  transition: all 0.2s;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.4s ease forwards;
}

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

.app-card:hover {
  border-color: #0ea5e9;
  transform: translateY(-2px);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.app-icon { font-size: 2rem; }

.app-info { flex: 1; }

.app-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.app-id {
  font-size: 0.75rem;
  color: #64748b;
  font-family: monospace;
}

.app-desc {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.app-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #64748b;
}

.app-category {
  background: #334155;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  text-transform: capitalize;
}

.app-link {
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 500;
}

.app-link:hover { text-decoration: underline; }

/* Loading */
.load-more-trigger {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.9rem;
}

.loading-spinner {
  display: none;
  width: 24px;
  height: 24px;
  border: 2px solid #334155;
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner.visible { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Bottom CTA */
.bottom-cta {
  text-align: center;
  padding: 3rem 1rem;
  margin-top: 2rem;
  border-top: 1px solid #334155;
}

.bottom-cta p {
  color: #64748b;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.bottom-cta .cta-link {
  font-size: 1.1rem;
  padding: 1rem 2rem;
}

/* No results */
.no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: #64748b;
}

.no-results h3 {
  color: white;
  margin-bottom: 0.5rem;
}

.no-results .cta-link {
  margin-top: 1.5rem;
  display: inline-flex;
}

/* Staggered animation delays */
.app-card:nth-child(1) { animation-delay: 0.0s; }
.app-card:nth-child(2) { animation-delay: 0.05s; }
.app-card:nth-child(3) { animation-delay: 0.1s; }
.app-card:nth-child(4) { animation-delay: 0.15s; }
.app-card:nth-child(5) { animation-delay: 0.2s; }
.app-card:nth-child(6) { animation-delay: 0.25s; }
.app-card:nth-child(7) { animation-delay: 0.3s; }
.app-card:nth-child(8) { animation-delay: 0.35s; }
.app-card:nth-child(9) { animation-delay: 0.4s; }
.app-card:nth-child(10) { animation-delay: 0.45s; }
.app-card:nth-child(11) { animation-delay: 0.5s; }
.app-card:nth-child(12) { animation-delay: 0.55s; }

/* Collections promo */
.collections {
  margin: 1.25rem 0 1.5rem;
  padding: 1.15rem;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.78) 0%, rgba(30, 41, 59, 0.55) 100%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  box-shadow: 0 18px 50px rgba(0,0,0,0.25);
}

.collections::before{
  content: "";
  display: block;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(14,165,233,0.0) 0%, rgba(14,165,233,0.85) 45%, rgba(139,92,246,0.85) 55%, rgba(139,92,246,0.0) 100%);
  margin: 0 0 0.85rem;
}

.collections-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.collections-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.collections-sub {
  margin: 0;
  color: #94a3b8;
  font-size: 0.9rem;
}

.collections-hint{
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.88rem;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.collection-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.95rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(17, 28, 47, 0.92);
  text-decoration: none;
  color: #e2e8f0;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.collection-card:visited{ color: #e2e8f0; }

.collection-card:hover {
  transform: translateY(-2px);
  border-color: rgba(14,165,233,0.7);
  background: rgba(17, 28, 47, 1);
  box-shadow: 0 14px 40px rgba(0,0,0,0.32);
}

.collection-top {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:0.75rem;
}

.collection-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.collection-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(14,165,233,0.25) 0%, rgba(139,92,246,0.25) 100%);
  border: 1px solid rgba(14,165,233,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex: 0 0 auto;
}

.collection-name {
  font-weight: 750;
  color: #f1f5f9;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-desc {
  color: #94a3b8;
  font-size: 0.88rem;
  line-height: 1.35;
  margin: 0;
}

.collection-cta {
  color: #e2e8f0;
  font-weight: 650;
  font-size: 0.85rem;
  white-space: nowrap;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(14,165,233,0.35);
  background: rgba(14,165,233,0.12);
}

.collection-card:hover .collection-cta{
  border-color: rgba(14,165,233,0.65);
  background: rgba(14,165,233,0.18);
}
