/* ═══ Software Library v2.0 ═══ */

/* Hero */
.sw-hero-section {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 40px 36px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1040 40%, #0d1b3e 100%);
  border: 1px solid rgba(99,102,241,.15);
}
.sw-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(99,102,241,.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(6,182,212,.08) 0%, transparent 60%);
  pointer-events: none;
}
.sw-hero-content { position: relative; text-align: center; }
.sw-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  border-radius: 18px;
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.2);
  color: #818cf8;
  margin-bottom: 16px;
}
.sw-hero-content h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #e0e7ff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sw-hero-desc {
  color: var(--text3);
  font-size: 13px;
  letter-spacing: 2px;
  margin: 0 0 24px;
}
.sw-hero-stats { display: flex; justify-content: center; gap: 32px; }
.sw-stat { text-align: center; }
.sw-stat-num { display: block; font-size: 24px; font-weight: 700; color: var(--text); }
.sw-stat-label { display: block; font-size: 11px; color: var(--text3); margin-top: 2px; text-transform: uppercase; letter-spacing: 1px; }

/* Search */
.sw-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border-lit);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 20px;
  transition: border-color .2s;
}
.sw-search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.sw-search-bar svg { color: var(--text3); flex-shrink: 0; }
.sw-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.sw-search-bar input::placeholder { color: var(--text3); }

/* Categories */
.sw-category {
  background: var(--bg2);
  border-radius: 16px;
  border: 1px solid var(--border-lit);
  margin-bottom: 16px;
  overflow: hidden;
}
.sw-cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border-lit);
}
.sw-cat-indicator { width: 4px; height: 20px; border-radius: 2px; }
.sw-cat-title { font-size: 14px; font-weight: 600; color: var(--text); }
.sw-cat-badge {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 20px;
}

/* Cards Grid */
.sw-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  padding: 12px;
}

/* Software Card */
.sw-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg1);
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .25s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.sw-item-card:hover {
  border-color: rgba(99,102,241,.25);
  background: rgba(99,102,241,.04);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.sw-item-icon-wrap {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2);
  border-radius: 12px;
  flex-shrink: 0;
  font-size: 22px;
}
.sw-item-body { flex: 1; min-width: 0; }
.sw-item-name {
  font-size: 14px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sw-item-desc {
  font-size: 12px; color: var(--text3);
  margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sw-item-arrow { color: var(--text3); opacity: 0; transition: all .2s; flex-shrink: 0; }
.sw-item-card:hover .sw-item-arrow { opacity: 1; color: var(--accent); transform: translateX(2px); }

/* Empty state */
.sw-empty { text-align: center; padding: 60px 20px; color: var(--text3); }
.sw-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.sw-empty-hint { font-size: 12px; margin-top: 6px; opacity: .6; }

/* Detail View */
.sw-detail { max-width: 1000px; margin: 0 auto; }
.sw-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 16px; font-size: 13px; cursor: pointer;
  margin-bottom: 16px; transition: all .2s;
}
.sw-back:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.sw-detail-hero {
  display: flex; align-items: center; gap: 20px;
  padding: 28px 32px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(99,102,241,.1), rgba(6,182,212,.06));
  border: 1px solid rgba(99,102,241,.12);
  margin-bottom: 20px;
}
.sw-detail-icon-wrap {
  width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;
  background: var(--bg1); border-radius: 16px;
  box-shadow: 0 4px 20px rgba(99,102,241,.15);
  font-size: 30px; flex-shrink: 0;
}
.sw-detail-meta { flex: 1; }
.sw-detail-meta h1 { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.sw-detail-meta p { font-size: 13px; color: var(--text2); margin: 0 0 10px; }
.sw-detail-tags { display: flex; gap: 6px; }
.sw-tag {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--tag-color, var(--accent));
  color: #fff;
  opacity: .85;
}
.sw-launch-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 24px; border-radius: 14px; border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .25s;
  white-space: nowrap; flex-shrink: 0;
}
.sw-launch-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,.3);
}

/* Detail Grid */
.sw-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.sw-detail-panel {
  background: var(--bg2);
  border-radius: 14px;
  border: 1px solid var(--border-lit);
  overflow: hidden;
}
.sw-detail-panel.sw-chat-panel { grid-column: 1 / -1; min-height: 420px; }
.sw-panel-title {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-lit);
  font-size: 13px; font-weight: 600; color: var(--text2);
}

/* Actions Grid */
.sw-actions {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding: 14px;
}
.sw-action-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 12px; border-radius: 12px; border: 1px solid var(--border-lit);
  background: var(--bg1); cursor: pointer;
  transition: all .2s; text-align: center;
}
.sw-action-card:hover {
  border-color: var(--accent);
  background: rgba(99,102,241,.06);
  transform: translateY(-1px);
}
.ac-icon { font-size: 22px; }
.ac-label { font-size: 13px; font-weight: 600; color: var(--text); }
.ac-desc { font-size: 11px; color: var(--text3); }

/* Info Table */
.sw-info-table { width: 100%; border-collapse: collapse; }
.sw-info-table td {
  padding: 10px 18px; font-size: 13px;
  border-bottom: 1px solid var(--border-lit);
}
.sw-info-table td:first-child {
  color: var(--text3); width: 60px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
}

/* Chat Panel */
.sw-chat-container {
  display: flex; flex-direction: column; height: 400px;
}
.sw-chat-msgs {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.sw-msg-row {
  display: flex; gap: 10px; align-items: flex-start;
}
.sw-msg-row.user { justify-content: flex-end; }
.sw-msg-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3); font-size: 14px; flex-shrink: 0;
}
.sw-msg-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.5; max-width: 75%;
  word-break: break-word;
}
.sw-msg-bubble.sys { background: rgba(99,102,241,.08); color: var(--text2); border-bottom-left-radius: 4px; }
.sw-msg-bubble.user { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.sw-msg-bubble.ai { background: var(--bg3); color: var(--text); border: 1px solid var(--border-lit); border-bottom-left-radius: 4px; }
.sw-msg-bubble.loading { background: var(--bg3); color: var(--text3); font-style: italic; }
.sw-msg-bubble.error { background: rgba(239,68,68,.08); color: #f87171; border-color: rgba(239,68,68,.15); }
.sw-dot-pulse {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 4px;
  animation: swPulse 1.2s ease-in-out infinite;
}
@keyframes swPulse { 0%,100%{opacity:.3} 50%{opacity:1} }

.sw-chat-composer {
  display: flex; gap: 8px; padding: 12px 14px;
  border-top: 1px solid var(--border-lit);
}
.sw-chat-composer input {
  flex: 1; padding: 10px 14px; border-radius: 10px;
  background: var(--bg1); border: 1px solid var(--border-lit);
  color: var(--text); font-size: 13px; font-family: inherit;
}
.sw-chat-composer input:focus { outline: none; border-color: var(--accent); }
.sw-chat-send {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer; transition: all .2s;
}
.sw-chat-send:hover { filter: brightness(1.1); }

/* Responsive */
@media (max-width: 768px) {
  .sw-hero-section { padding: 24px 20px; }
  .sw-hero-stats { gap: 20px; }
  .sw-cards-grid { grid-template-columns: 1fr; }
  .sw-detail-hero { flex-direction: column; text-align: center; }
  .sw-detail-tags { justify-content: center; }
  .sw-detail-grid { grid-template-columns: 1fr; }
  .sw-actions { grid-template-columns: 1fr; }
}

.sw-tag-sm {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  font-size: 12px;
  font-family: monospace;
}
