/* ─────────────────────────────────────────────────────────────────────── */
/* Apps Page — App Management, Settings                                      */
/* ─────────────────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────────────── */
/* Page Container                                                            */
/* ─────────────────────────────────────────────────────────────────────── */

.page-apps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Apps Grid                                                                 */
/* ─────────────────────────────────────────────────────────────────────── */

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

.app-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background-color: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: var(--transition-colors);
  cursor: pointer;
}

.app-card:hover {
  background-color: var(--bg-3);
  border-color: var(--hover-bd);
  transform: translateY(-2px);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* App Card Header                                                           */
/* ─────────────────────────────────────────────────────────────────────── */

.app-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.app-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-h));
  color: var(--accent-ink);
  font-size: 20px;
  flex-shrink: 0;
}

.app-card-info {
  flex: 1;
  min-width: 0;
}

.app-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-slug {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-action-menu {
  position: relative;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* App Card Stats                                                            */
/* ─────────────────────────────────────────────────────────────────────── */

.app-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.app-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background-color: var(--bg-3);
  border-radius: 4px;
  text-align: center;
}

.app-stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.app-stat-label {
  font-size: 10px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* App Card Description                                                      */
/* ─────────────────────────────────────────────────────────────────────── */

.app-description {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────── */
/* App Card Footer (Status, Badge)                                          */
/* ─────────────────────────────────────────────────────────────────────── */

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.app-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-mute);
}

.app-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--st-accepted);
}

.app-status-dot.inactive {
  background-color: var(--text-mute);
  opacity: 0.5;
}

.app-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-dim);
  transition: var(--transition-colors);
  font-size: 12px;
}

.app-action-btn:hover {
  background-color: var(--bg-2);
  border-color: var(--hover-bd);
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Add App Card (empty state)                                               */
/* ─────────────────────────────────────────────────────────────────────── */

.app-card.add-app {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 2px dashed var(--line);
  background-color: transparent;
}

.app-card.add-app:hover {
  border-color: var(--accent);
  background-color: var(--bg-2);
}

.add-app-icon {
  font-size: 28px;
}

.add-app-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

/* ─────────────────────────────────────────────────────────────────────── */
/* Responsive                                                                */
/* ─────────────────────────────────────────────────────────────────────── */

@media (max-width: 1280px) {
  .apps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 880px) {
  .apps-grid {
    grid-template-columns: 1fr;
  }

  .app-stats {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .apps-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .app-card {
    padding: 12px;
  }

  .app-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-stats {
    grid-template-columns: 1fr;
  }
}
